diff --git a/.cargo/config.toml b/.cargo/config.toml index 1ed474fb26ce5..a212bbaa10f23 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -29,8 +29,4 @@ rustflags = [ "-Zshare-generics=y", "-Csymbol-mangling-version=v0", "-Aclippy::too_many_arguments", - # Clippy's needless mut lint is buggy: https://github.com/rust-lang/rust-clippy/issues/11299 - "-Aclippy::needless_pass_by_ref_mut", - # Clippy's partial_eq lint is buggy: https://github.com/rust-lang/rust-clippy/issues/11178 - "-Aclippy::non_canonical_partial_ord_impl", ] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5096512a9003..031699f535a40 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -612,7 +612,7 @@ jobs: - name: Run cargo clippy run: | - RUSTFLAGS="-D warnings -A deprecated -Aclippy::too_many_arguments -Aclippy::needless_pass_by_ref_mut -Aclippy::non_canonical_partial_ord_impl" cargo groups clippy turbopack --features rustls-tls + RUSTFLAGS="-D warnings -A deprecated -Aclippy::too_many_arguments" cargo groups clippy turbopack --features rustls-tls - name: Run ast-grep lints run: | 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 b5ffdaad80fd4..03ac04eda8a03 100644 --- a/crates/turbo-tasks-memory/src/aggregation_tree/bottom_tree.rs +++ b/crates/turbo-tasks-memory/src/aggregation_tree/bottom_tree.rs @@ -555,7 +555,7 @@ impl BottomTree { ) { let mut state = self.state.write(); let change = aggregation_context.apply_change(&mut state.data, change); - propagate_change_to_upper(&mut state, aggregation_context, change); + propagate_change_to_upper(&state, aggregation_context, change); } pub fn get_root_info>( @@ -627,7 +627,7 @@ fn propagate_new_following_to_uppers( } fn propagate_change_to_upper( - state: &mut RwLockWriteGuard>, + state: &RwLockWriteGuard>, aggregation_context: &C, change: Option, ) { diff --git a/crates/turbo-tasks-memory/src/aggregation_tree/top_tree.rs b/crates/turbo-tasks-memory/src/aggregation_tree/top_tree.rs index e55684c1a32cf..da21c55d4d4c4 100644 --- a/crates/turbo-tasks-memory/src/aggregation_tree/top_tree.rs +++ b/crates/turbo-tasks-memory/src/aggregation_tree/top_tree.rs @@ -111,7 +111,7 @@ impl TopTree { ) { let mut state = self.state.lock(); let change = aggregation_context.apply_change(&mut state.data, change); - propagate_change_to_upper(&mut state, aggregation_context, change); + propagate_change_to_upper(&state, aggregation_context, change); } pub fn get_root_info>( @@ -147,7 +147,7 @@ impl TopTree { } fn propagate_change_to_upper( - state: &mut MutexGuard>, + state: &MutexGuard>, aggregation_context: &C, change: Option, ) { diff --git a/crates/turbo-tasks/src/magic_any.rs b/crates/turbo-tasks/src/magic_any.rs index 2805511171a08..cdc697bfe1969 100644 --- a/crates/turbo-tasks/src/magic_any.rs +++ b/crates/turbo-tasks/src/magic_any.rs @@ -90,7 +90,7 @@ impl Eq for dyn MagicAny {} impl PartialOrd for dyn MagicAny { fn partial_cmp(&self, other: &Self) -> Option { - Some(self.magic_cmp(other)) + Some(self.cmp(other)) } } diff --git a/crates/turbo-tasks/src/native_function.rs b/crates/turbo-tasks/src/native_function.rs index c95c8d4a64bd9..658b0c8549874 100644 --- a/crates/turbo-tasks/src/native_function.rs +++ b/crates/turbo-tasks/src/native_function.rs @@ -91,10 +91,7 @@ impl Hash for &'static NativeFunction { impl PartialOrd for &'static NativeFunction { fn partial_cmp(&self, other: &Self) -> Option { - PartialOrd::partial_cmp( - &(*self as *const NativeFunction), - &(*other as *const NativeFunction), - ) + Some(self.cmp(other)) } } impl Ord for &'static NativeFunction { diff --git a/crates/turbo-tasks/src/task/concrete_task_input.rs b/crates/turbo-tasks/src/task/concrete_task_input.rs index 24a10268f0c06..e44e4f7ffa9c9 100644 --- a/crates/turbo-tasks/src/task/concrete_task_input.rs +++ b/crates/turbo-tasks/src/task/concrete_task_input.rs @@ -47,10 +47,7 @@ impl PartialEq for SharedReference { impl Eq for SharedReference {} impl PartialOrd for SharedReference { fn partial_cmp(&self, other: &Self) -> Option { - PartialOrd::partial_cmp( - &(&*self.1 as *const (dyn Any + Send + Sync)), - &(&*other.1 as *const (dyn Any + Send + Sync)), - ) + Some(self.cmp(other)) } } impl Ord for SharedReference { diff --git a/crates/turbo-tasks/src/trait_ref.rs b/crates/turbo-tasks/src/trait_ref.rs index db254e793c4a5..27e3207531bd0 100644 --- a/crates/turbo-tasks/src/trait_ref.rs +++ b/crates/turbo-tasks/src/trait_ref.rs @@ -49,7 +49,7 @@ impl Eq for TraitRef {} impl PartialOrd for TraitRef { fn partial_cmp(&self, other: &Self) -> Option { - self.shared_reference.partial_cmp(&other.shared_reference) + Some(self.cmp(other)) } } diff --git a/crates/turbo-tasks/src/value.rs b/crates/turbo-tasks/src/value.rs index 4e2ff1b0c09f9..639fbc2d188ab 100644 --- a/crates/turbo-tasks/src/value.rs +++ b/crates/turbo-tasks/src/value.rs @@ -100,7 +100,7 @@ impl std::hash::Hash for TransientInstance { impl PartialOrd for TransientInstance { fn partial_cmp(&self, other: &Self) -> Option { - self.inner.partial_cmp(&other.inner) + Some(self.cmp(other)) } } diff --git a/crates/turbo-tasks/src/value_type.rs b/crates/turbo-tasks/src/value_type.rs index d4f37d156827e..1a637f935ddd9 100644 --- a/crates/turbo-tasks/src/value_type.rs +++ b/crates/turbo-tasks/src/value_type.rs @@ -58,7 +58,7 @@ impl PartialEq for ValueType { impl PartialOrd for ValueType { fn partial_cmp(&self, other: &Self) -> Option { - (self as *const ValueType).partial_cmp(&(other as *const ValueType)) + Some(self.cmp(other)) } } impl Ord for ValueType { @@ -225,7 +225,7 @@ impl PartialEq for TraitType { impl PartialOrd for TraitType { fn partial_cmp(&self, other: &Self) -> Option { - (self as *const TraitType).partial_cmp(&(other as *const TraitType)) + Some(self.cmp(other)) } } diff --git a/crates/turbo-tasks/src/vc/mod.rs b/crates/turbo-tasks/src/vc/mod.rs index e388c32254ea0..7039e892772ed 100644 --- a/crates/turbo-tasks/src/vc/mod.rs +++ b/crates/turbo-tasks/src/vc/mod.rs @@ -230,7 +230,7 @@ where T: ?Sized + Send, { fn partial_cmp(&self, other: &Self) -> Option { - self.node.partial_cmp(&other.node) + Some(self.cmp(other)) } } diff --git a/crates/turbopack-core/src/chunk/containment_tree.rs b/crates/turbopack-core/src/chunk/containment_tree.rs index 5949be7f22da0..33eafdc50f587 100644 --- a/crates/turbopack-core/src/chunk/containment_tree.rs +++ b/crates/turbopack-core/src/chunk/containment_tree.rs @@ -47,7 +47,7 @@ where let orphan_values = Self::add_values_to_tree(&mut trees, values); - let roots = Self::treeify(relationships, &mut trees); + let roots = Self::treeify(relationships, &trees); // optimize tree by removing unnecessary nodes Self::skip_unnecessary_nodes(&mut trees); @@ -146,7 +146,7 @@ where /// Nest each tree by relationship, compute the roots fn treeify( relationships: Vec<(Option, K)>, - trees: &mut IndexMap>>>, + trees: &IndexMap>>>, ) -> Vec>>> { relationships .into_iter() diff --git a/crates/turbopack-dev/src/ecmascript/optimize.rs b/crates/turbopack-dev/src/ecmascript/optimize.rs index 060a5a5fcf0b4..a47ce8eb4d6d0 100644 --- a/crates/turbopack-dev/src/ecmascript/optimize.rs +++ b/crates/turbopack-dev/src/ecmascript/optimize.rs @@ -139,12 +139,12 @@ async fn merge_duplicated_and_contained( impl PartialOrd for FloatOrd { fn partial_cmp(&self, other: &Self) -> Option { - self.0.partial_cmp(&other.0) + Some(self.cmp(other)) } } impl Ord for FloatOrd { fn cmp(&self, other: &Self) -> Ordering { - self.partial_cmp(other).unwrap_or(Ordering::Equal) + self.0.partial_cmp(&other.0).unwrap_or(Ordering::Equal) } } diff --git a/crates/turbopack-ecmascript/src/analyzer/graph.rs b/crates/turbopack-ecmascript/src/analyzer/graph.rs index 4e823d756c88d..2dafc012ebead 100644 --- a/crates/turbopack-ecmascript/src/analyzer/graph.rs +++ b/crates/turbopack-ecmascript/src/analyzer/graph.rs @@ -1644,7 +1644,7 @@ impl<'a> Analyzer<'a> { fn add_conditional_effect( &mut self, test: &Expr, - ast_path: &mut AstNodePath>, + ast_path: &AstNodePath>, ast_kind: AstParentKind, span: Span, mut cond_kind: ConditionalKind, diff --git a/rust-toolchain b/rust-toolchain index fe109472d242d..38686d9d69ff4 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-09-21 +nightly-2023-10-06