Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #16518 - tetsuharuohzeki:enable-some-minor-lints, r=Veykril
Enable some minor lints that we should tackles This enables these lint rules that are commented as we should tackle at some points. - non_canonical_clone_impl - non_canonical_partial_ord_impl - self_named_constructors
bors 2024-02-09
parent 65a6441 · parent 1e4171b · commit cdc3e83
-rw-r--r--Cargo.toml3
-rw-r--r--crates/hir-def/src/attr.rs2
-rw-r--r--crates/hir-def/src/item_tree.rs2
-rw-r--r--crates/hir-def/src/lib.rs4
-rw-r--r--crates/hir-expand/src/ast_id_map.rs2
-rw-r--r--crates/hir-expand/src/db.rs2
-rw-r--r--crates/hir/src/attrs.rs2
-rw-r--r--crates/syntax/src/ptr.rs2
-rw-r--r--lib/la-arena/src/lib.rs2
9 files changed, 9 insertions, 12 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f40156b99e..8bec3893ce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -172,9 +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"
-self_named_constructors = "allow"
too_many_arguments = "allow"
type_complexity = "allow"
wrong_self_convention = "allow"
diff --git a/crates/hir-def/src/attr.rs b/crates/hir-def/src/attr.rs
index bee6f0083b..d2a975e9e6 100644
--- a/crates/hir-def/src/attr.rs
+++ b/crates/hir-def/src/attr.rs
@@ -317,7 +317,7 @@ fn parse_comma_sep<S>(subtree: &tt::Subtree<S>) -> Vec<SmolStr> {
}
impl AttrsWithOwner {
- pub fn attrs_with_owner(db: &dyn DefDatabase, owner: AttrDefId) -> Self {
+ pub fn new(db: &dyn DefDatabase, owner: AttrDefId) -> Self {
Self { attrs: db.attrs(owner), owner }
}
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/hir-expand/src/ast_id_map.rs b/crates/hir-expand/src/ast_id_map.rs
index 530f10a068..ab582741f5 100644
--- a/crates/hir-expand/src/ast_id_map.rs
+++ b/crates/hir-expand/src/ast_id_map.rs
@@ -155,7 +155,7 @@ impl PartialEq for AstIdMap {
impl Eq for AstIdMap {}
impl AstIdMap {
- pub(crate) fn ast_id_map(
+ pub(crate) fn new(
db: &dyn ExpandDatabase,
file_id: span::HirFileId,
) -> triomphe::Arc<AstIdMap> {
diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs
index d5a1a14099..6a288cf919 100644
--- a/crates/hir-expand/src/db.rs
+++ b/crates/hir-expand/src/db.rs
@@ -61,7 +61,7 @@ pub trait ExpandDatabase: SourceDatabase {
#[salsa::input]
fn proc_macros(&self) -> Arc<ProcMacros>;
- #[salsa::invoke(AstIdMap::ast_id_map)]
+ #[salsa::invoke(AstIdMap::new)]
fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>;
/// Main public API -- parses a hir file, not caring whether it's a real
diff --git a/crates/hir/src/attrs.rs b/crates/hir/src/attrs.rs
index 5c369f42e6..7d637bac09 100644
--- a/crates/hir/src/attrs.rs
+++ b/crates/hir/src/attrs.rs
@@ -30,7 +30,7 @@ macro_rules! impl_has_attrs {
impl HasAttrs for $def {
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner {
let def = AttrDefId::$def_id(self.into());
- AttrsWithOwner::attrs_with_owner(db.upcast(), def)
+ AttrsWithOwner::new(db.upcast(), def)
}
fn attr_id(self) -> AttrDefId {
AttrDefId::$def_id(self.into())
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
}
}
diff --git a/lib/la-arena/src/lib.rs b/lib/la-arena/src/lib.rs
index 1ded3b00a6..abde5deda4 100644
--- a/lib/la-arena/src/lib.rs
+++ b/lib/la-arena/src/lib.rs
@@ -70,7 +70,7 @@ impl<T> Ord for Idx<T> {
impl<T> PartialOrd for Idx<T> {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
- self.raw.partial_cmp(&other.raw)
+ Some(self.cmp(other))
}
}