fix clippy

This commit is contained in:
Evan Almloff committed 2024-03-04 16:10:04 -06:00
1 parent 3827378f68
commit 2e3a730ed5
6 files changed
+139 -143

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut};
use crate::{
any_props::AnyProps,
innerlude::{DirtyScopes, ElementRef, MountId, ScopeOrder, VComponent, WriteMutations},
innerlude::{ElementRef, MountId, ScopeOrder, VComponent, WriteMutations},
nodes::RenderReturn,
nodes::VNode,
scopes::ScopeId,
+8 -14
View File
@@ -16,8 +16,8 @@
//!
//! #[component]
//! fn Child(vec: Signal<Vec<usize>>, idx: usize) -> Element {
//! use_hook(|| {
//! spawn(async {
//! use_hook(move || {
//! spawn(async move {
//! // If we let this task run after the child is dropped, it will panic.
//! println!("Task {}", vec.read()[idx]);
//! });
@@ -30,7 +30,6 @@
use crate::ScopeId;
use crate::Task;
use std::borrow::Borrow;
use std::cell::Cell;
use std::cell::RefCell;
use std::collections::BTreeSet;
use std::hash::Hash;
@@ -83,7 +82,7 @@ impl DirtyScopes {
match self.tasks.get(&order) {
Some(scope) => scope.queue_task(task),
None => {
let mut scope = DirtyTasks::from(order);
let scope = DirtyTasks::from(order);
scope.queue_task(task);
self.tasks.insert(scope);
}
@@ -105,11 +104,6 @@ impl DirtyScopes {
self.tasks.pop_first()
}
/// Take the highest scope that needs to be rerendered
pub fn pop_scope(&mut self) -> Option<ScopeOrder> {
self.scopes.pop_first()
}
/// Take any work from the highest scope. This may include rerunning the scope and/or running tasks
pub fn pop_work(&mut self) -> Option<Work> {
let dirty_scope = self.scopes.first();
@@ -121,7 +115,7 @@ impl DirtyScopes {
std::cmp::Ordering::Less => {
let scope = self.scopes.pop_first().unwrap();
Some(Work {
scope: scope,
scope,
rerun_scope: true,
tasks: Vec::new(),
})
@@ -138,22 +132,22 @@ impl DirtyScopes {
let scope = self.scopes.pop_first().unwrap();
let task = self.tasks.pop_first().unwrap();
Some(Work {
scope: scope,
scope,
rerun_scope: true,
tasks: task.tasks_queued.into_inner(),
})
}
}
}
(Some(scope), None) => {
(Some(_), None) => {
let scope = self.scopes.pop_first().unwrap();
Some(Work {
scope: scope,
scope,
rerun_scope: true,
tasks: Vec::new(),
})
}
(None, Some(task)) => {
(None, Some(_)) => {
let task = self.tasks.pop_first().unwrap();
Some(Work {
scope: task.order,
+1 -2
View File
@@ -34,8 +34,7 @@ impl RenderSignal {
waker: None,
}));
self.wakers.borrow_mut().push(inner.clone());
let waker = RenderSignalFuture { inner };
waker
RenderSignalFuture { inner }
}
}
+2 -2
View File
@@ -20,7 +20,7 @@ use crate::{
use futures_util::StreamExt;
use rustc_hash::{FxHashMap, FxHashSet};
use slab::Slab;
use std::{any::Any, collections::BTreeSet, rc::Rc};
use std::{any::Any, rc::Rc};
use tracing::instrument;
/// A virtual node system that progresses user events and diffs UI trees.
@@ -468,7 +468,7 @@ impl VirtualDom {
// Make sure we set the runtime since we're running user code
let _runtime = RuntimeGuard::new(self.runtime.clone());
/// There isn't any more work we can do synchronously. Wait for any new work to be ready
// There isn't any more work we can do synchronously. Wait for any new work to be ready
match self.rx.next().await.expect("channel should never close") {
SchedulerMsg::Immediate(id) => self.mark_dirty(id),
SchedulerMsg::TaskNotified(id) => {