diff options
| author | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2024-02-09 22:37:42 +0900 |
|---|---|---|
| committer | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2024-02-09 22:37:42 +0900 |
| commit | 2601d19bac3d5fac3235432d1b97091ea9636f0d (patch) | |
| tree | 97e8c793ad7aea49e1979509cfcbc2e1fa52d3a2 | |
| parent | 7669619f9a7e5ab36448e07205800a8677dd4911 (diff) | |
| download | rust-2601d19bac3d5fac3235432d1b97091ea9636f0d.tar.gz rust-2601d19bac3d5fac3235432d1b97091ea9636f0d.zip | |
clippy: Enable `non_canonical_clone_impl` rule
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/hir-def/src/item_tree.rs | 2 | ||||
| -rw-r--r-- | crates/hir-def/src/lib.rs | 4 | ||||
| -rw-r--r-- | crates/syntax/src/ptr.rs | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml index 429c29025c4..c8adf18a8c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,7 +172,6 @@ borrowed_box = "allow" derived_hash_with_manual_eq = "allow" forget_non_drop = "allow" needless_doctest_main = "allow" -non_canonical_clone_impl = "allow" non_canonical_partial_ord_impl = "allow" too_many_arguments = "allow" type_complexity = "allow" diff --git a/crates/hir-def/src/item_tree.rs b/crates/hir-def/src/item_tree.rs index 336e0de7fd6..27c5f14b7dc 100644 --- a/crates/hir-def/src/item_tree.rs +++ b/crates/hir-def/src/item_tree.rs @@ -372,7 +372,7 @@ impl<N> FileItemTreeId<N> { impl<N> Clone for FileItemTreeId<N> { fn clone(&self) -> Self { - Self(self.0) + *self } } impl<N> Copy for FileItemTreeId<N> {} diff --git a/crates/hir-def/src/lib.rs b/crates/hir-def/src/lib.rs index 71bc5213336..6a39e0b695b 100644 --- a/crates/hir-def/src/lib.rs +++ b/crates/hir-def/src/lib.rs @@ -219,7 +219,7 @@ pub struct ItemLoc<N: ItemTreeModItemNode> { impl<N: ItemTreeModItemNode> Clone for ItemLoc<N> { fn clone(&self) -> Self { - Self { container: self.container, id: self.id } + *self } } @@ -248,7 +248,7 @@ pub struct AssocItemLoc<N: ItemTreeModItemNode> { impl<N: ItemTreeModItemNode> Clone for AssocItemLoc<N> { fn clone(&self) -> Self { - Self { container: self.container, id: self.id } + *self } } diff --git a/crates/syntax/src/ptr.rs b/crates/syntax/src/ptr.rs index b716d367066..fb8aee9c3b0 100644 --- a/crates/syntax/src/ptr.rs +++ b/crates/syntax/src/ptr.rs @@ -36,7 +36,7 @@ impl<N: AstNode + std::fmt::Debug> std::fmt::Debug for AstPtr<N> { impl<N: AstNode> Copy for AstPtr<N> {} impl<N: AstNode> Clone for AstPtr<N> { fn clone(&self) -> AstPtr<N> { - AstPtr { raw: self.raw, _ty: PhantomData } + *self } } |
