Unnamed repository; edit this file 'description' to name the repository.
clippy: Enable `non_canonical_clone_impl` rule
Tetsuharu Ohzeki 2024-02-09
parent 7669619 · commit 2601d19
-rw-r--r--Cargo.toml1
-rw-r--r--crates/hir-def/src/item_tree.rs2
-rw-r--r--crates/hir-def/src/lib.rs4
-rw-r--r--crates/syntax/src/ptr.rs2
4 files changed, 4 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 429c29025c..c8adf18a8c 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 336e0de7fd..27c5f14b7d 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 71bc521333..6a39e0b695 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 b716d36706..fb8aee9c3b 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
}
}