diff options
| author | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2024-02-09 22:31:21 +0900 |
|---|---|---|
| committer | Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> | 2024-02-09 22:31:21 +0900 |
| commit | 7669619f9a7e5ab36448e07205800a8677dd4911 (patch) | |
| tree | bae89322a7beb7ee4b8bc8032b4bc9d72d1ad1f5 | |
| parent | d24bb7e2897a36564ab49c5bc5ef629607bd6dd2 (diff) | |
| download | rust-7669619f9a7e5ab36448e07205800a8677dd4911.tar.gz rust-7669619f9a7e5ab36448e07205800a8677dd4911.zip | |
clippy: Enable `self_named_constructors` rule
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/hir-def/src/attr.rs | 2 | ||||
| -rw-r--r-- | crates/hir-expand/src/ast_id_map.rs | 2 | ||||
| -rw-r--r-- | crates/hir-expand/src/db.rs | 2 | ||||
| -rw-r--r-- | crates/hir/src/attrs.rs | 2 |
5 files changed, 4 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml index f40156b99e5..429c29025c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -174,7 +174,6 @@ 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 bee6f0083b1..d2a975e9e67 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-expand/src/ast_id_map.rs b/crates/hir-expand/src/ast_id_map.rs index 530f10a0684..ab582741f5b 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 d5a1a14099e..6a288cf9197 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 5c369f42e6e..7d637bac096 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()) |
