diff --git a/crates/turbo-tasks-memory/src/aggregation_tree/bottom_tree.rs b/crates/turbo-tasks-memory/src/aggregation_tree/bottom_tree.rs index 03ac04eda8a03b..e3e2980992bf00 100644 --- a/crates/turbo-tasks-memory/src/aggregation_tree/bottom_tree.rs +++ b/crates/turbo-tasks-memory/src/aggregation_tree/bottom_tree.rs @@ -642,6 +642,7 @@ fn propagate_change_to_upper( } } +#[allow(clippy::disallowed_methods)] // Allow VecDeque::new() in this test #[cfg(test)] fn visit_graph( aggregation_context: &C, @@ -667,6 +668,7 @@ fn visit_graph( (visited.len(), edges) } +#[allow(clippy::disallowed_methods)] // Allow VecDeque::new() in this test #[cfg(test)] pub fn print_graph( aggregation_context: &C, @@ -696,7 +698,7 @@ pub fn print_graph( while let Some(item) = queue.pop_front() { let tree = bottom_tree(aggregation_context, &item, height); let name = name_fn(&item); - let label = format!("{}", name); + let label = name.to_string(); let state = tree.state.read(); if color_upper { print!(r#""{} {}" [color=red];"#, height - 1, name); diff --git a/crates/turbo-tasks-memory/src/aggregation_tree/tests.rs b/crates/turbo-tasks-memory/src/aggregation_tree/tests.rs index f24ca290453448..1f43bdc50a4385 100644 --- a/crates/turbo-tasks-memory/src/aggregation_tree/tests.rs +++ b/crates/turbo-tasks-memory/src/aggregation_tree/tests.rs @@ -79,7 +79,7 @@ struct NodeGuard { } impl NodeGuard { - unsafe fn new<'a>(guard: MutexGuard<'a, NodeInner>, node: Arc) -> Self { + unsafe fn new(guard: MutexGuard<'_, NodeInner>, node: Arc) -> Self { NodeGuard { guard: unsafe { std::mem::transmute(guard) }, node, @@ -154,13 +154,11 @@ impl<'a> AggregationContext for NodeAggregationContext<'a> { if self.add_value { info.value += change.value; } - Some(change.clone()) + Some(*change) } fn info_to_add_change(&self, info: &Self::Info) -> Option { - let change = Change { - value: info.value as i32, - }; + let change = Change { value: info.value }; if change.is_empty() { None } else { @@ -169,9 +167,7 @@ impl<'a> AggregationContext for NodeAggregationContext<'a> { } fn info_to_remove_change(&self, info: &Self::Info) -> Option { - let change = Change { - value: -(info.value as i32), - }; + let change = Change { value: -info.value }; if change.is_empty() { None } else { @@ -184,6 +180,7 @@ impl<'a> AggregationContext for NodeAggregationContext<'a> { type RootInfoType = (); fn new_root_info(&self, root_info_type: &Self::RootInfoType) -> Self::RootInfo { + #[allow(clippy::match_single_binding)] match root_info_type { () => false, } @@ -194,6 +191,7 @@ impl<'a> AggregationContext for NodeAggregationContext<'a> { info: &Self::Info, root_info_type: &Self::RootInfoType, ) -> Self::RootInfo { + #[allow(clippy::match_single_binding)] match root_info_type { () => info.active, } @@ -248,7 +246,7 @@ fn chain() { { let root_info = leaf.inner.lock().aggregation_leaf.get_root_info(&ctx, &()); - assert_eq!(root_info, false); + assert!(!root_info); } { @@ -262,7 +260,7 @@ fn chain() { { let root_info = leaf.inner.lock().aggregation_leaf.get_root_info(&ctx, &()); - assert_eq!(root_info, false); + assert!(!root_info); } leaf.incr(&ctx); @@ -274,14 +272,14 @@ fn chain() { let aggregated = aggregation_info(&ctx, ¤t); let mut aggregated = aggregated.lock(); assert_eq!(aggregated.value, 25050); - (*aggregated).active = true; + aggregated.active = true; } assert_eq!(ctx.additions.load(Ordering::SeqCst), 0); ctx.additions.store(0, Ordering::SeqCst); { let root_info = leaf.inner.lock().aggregation_leaf.get_root_info(&ctx, &()); - assert_eq!(root_info, true); + assert!(root_info); } let i = 101; @@ -310,7 +308,7 @@ fn chain() { { let root_info = leaf.inner.lock().aggregation_leaf.get_root_info(&ctx, &()); - assert_eq!(root_info, true); + assert!(root_info); } } diff --git a/crates/turbo-tasks-memory/tests/scope_stress.rs b/crates/turbo-tasks-memory/tests/scope_stress.rs index dea2b23327ad89..9670e5e72ce19f 100644 --- a/crates/turbo-tasks-memory/tests/scope_stress.rs +++ b/crates/turbo-tasks-memory/tests/scope_stress.rs @@ -8,6 +8,7 @@ use turbo_tasks_testing::register; register!(); +#[allow(clippy::no_effect)] // for *REGISTER #[test] fn rectangle_stress() { *REGISTER;