mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
&self -> self
https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
This commit is contained in:
parent
6b4ec73b7e
commit
1a950cdbcf
1 changed files with 13 additions and 13 deletions
|
@ -299,7 +299,7 @@ impl Module {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with_module_id(&self, module_id: CrateModuleId) -> Module {
|
fn with_module_id(self, module_id: CrateModuleId) -> Module {
|
||||||
Module { module_id, krate: self.krate }
|
Module { module_id, krate: self.krate }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,33 +463,33 @@ pub struct EnumVariant {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EnumVariant {
|
impl EnumVariant {
|
||||||
pub fn module(&self, db: &impl HirDatabase) -> Module {
|
pub fn module(self, db: &impl HirDatabase) -> Module {
|
||||||
self.parent.module(db)
|
self.parent.module(db)
|
||||||
}
|
}
|
||||||
pub fn parent_enum(&self, _db: &impl DefDatabase) -> Enum {
|
pub fn parent_enum(self, _db: &impl DefDatabase) -> Enum {
|
||||||
self.parent
|
self.parent
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(&self, db: &impl DefDatabase) -> Option<Name> {
|
pub fn name(self, db: &impl DefDatabase) -> Option<Name> {
|
||||||
db.enum_data(self.parent).variants[self.id].name.clone()
|
db.enum_data(self.parent).variants[self.id].name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fields(&self, db: &impl HirDatabase) -> Vec<StructField> {
|
pub fn fields(self, db: &impl HirDatabase) -> Vec<StructField> {
|
||||||
self.variant_data(db)
|
self.variant_data(db)
|
||||||
.fields()
|
.fields()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|it| it.iter())
|
.flat_map(|it| it.iter())
|
||||||
.map(|(id, _)| StructField { parent: (*self).into(), id })
|
.map(|(id, _)| StructField { parent: self.into(), id })
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn field(&self, db: &impl HirDatabase, name: &Name) -> Option<StructField> {
|
pub fn field(self, db: &impl HirDatabase, name: &Name) -> Option<StructField> {
|
||||||
self.variant_data(db)
|
self.variant_data(db)
|
||||||
.fields()
|
.fields()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|it| it.iter())
|
.flat_map(|it| it.iter())
|
||||||
.find(|(_id, data)| data.name == *name)
|
.find(|(_id, data)| data.name == *name)
|
||||||
.map(|(id, _)| StructField { parent: (*self).into(), id })
|
.map(|(id, _)| StructField { parent: self.into(), id })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,11 +517,11 @@ impl DefWithBody {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builds a resolver for code inside this item.
|
/// Builds a resolver for code inside this item.
|
||||||
pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver {
|
pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver {
|
||||||
match *self {
|
match self {
|
||||||
DefWithBody::Const(ref c) => c.resolver(db),
|
DefWithBody::Const(c) => c.resolver(db),
|
||||||
DefWithBody::Function(ref f) => f.resolver(db),
|
DefWithBody::Function(f) => f.resolver(db),
|
||||||
DefWithBody::Static(ref s) => s.resolver(db),
|
DefWithBody::Static(s) => s.resolver(db),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue