clippy: Enable self_named_constructors rule

This commit is contained in:
Tetsuharu Ohzeki 2024-02-09 22:31:21 +09:00
parent d24bb7e289
commit 7669619f9a
5 changed files with 4 additions and 5 deletions

View file

@ -174,7 +174,6 @@ forget_non_drop = "allow"
needless_doctest_main = "allow" needless_doctest_main = "allow"
non_canonical_clone_impl = "allow" non_canonical_clone_impl = "allow"
non_canonical_partial_ord_impl = "allow" non_canonical_partial_ord_impl = "allow"
self_named_constructors = "allow"
too_many_arguments = "allow" too_many_arguments = "allow"
type_complexity = "allow" type_complexity = "allow"
wrong_self_convention = "allow" wrong_self_convention = "allow"

View file

@ -317,7 +317,7 @@ fn parse_comma_sep<S>(subtree: &tt::Subtree<S>) -> Vec<SmolStr> {
} }
impl AttrsWithOwner { 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 } Self { attrs: db.attrs(owner), owner }
} }

View file

@ -155,7 +155,7 @@ impl PartialEq for AstIdMap {
impl Eq for AstIdMap {} impl Eq for AstIdMap {}
impl AstIdMap { impl AstIdMap {
pub(crate) fn ast_id_map( pub(crate) fn new(
db: &dyn ExpandDatabase, db: &dyn ExpandDatabase,
file_id: span::HirFileId, file_id: span::HirFileId,
) -> triomphe::Arc<AstIdMap> { ) -> triomphe::Arc<AstIdMap> {

View file

@ -61,7 +61,7 @@ pub trait ExpandDatabase: SourceDatabase {
#[salsa::input] #[salsa::input]
fn proc_macros(&self) -> Arc<ProcMacros>; 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>; fn ast_id_map(&self, file_id: HirFileId) -> Arc<AstIdMap>;
/// Main public API -- parses a hir file, not caring whether it's a real /// Main public API -- parses a hir file, not caring whether it's a real

View file

@ -30,7 +30,7 @@ macro_rules! impl_has_attrs {
impl HasAttrs for $def { impl HasAttrs for $def {
fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner { fn attrs(self, db: &dyn HirDatabase) -> AttrsWithOwner {
let def = AttrDefId::$def_id(self.into()); let def = AttrDefId::$def_id(self.into());
AttrsWithOwner::attrs_with_owner(db.upcast(), def) AttrsWithOwner::new(db.upcast(), def)
} }
fn attr_id(self) -> AttrDefId { fn attr_id(self) -> AttrDefId {
AttrDefId::$def_id(self.into()) AttrDefId::$def_id(self.into())