From 1a950cdbcf5799d516f53a94fc9a6821e543ccc3 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Thu, 4 Jul 2019 23:01:40 -0400 Subject: &self -> self https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref --- crates/ra_hir/src/code_model.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index b3a4f4d63..b27537151 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -299,7 +299,7 @@ impl Module { .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 } } } @@ -463,33 +463,33 @@ pub struct EnumVariant { } impl EnumVariant { - pub fn module(&self, db: &impl HirDatabase) -> Module { + pub fn module(self, db: &impl HirDatabase) -> Module { self.parent.module(db) } - pub fn parent_enum(&self, _db: &impl DefDatabase) -> Enum { + pub fn parent_enum(self, _db: &impl DefDatabase) -> Enum { self.parent } - pub fn name(&self, db: &impl DefDatabase) -> Option { + pub fn name(self, db: &impl DefDatabase) -> Option { db.enum_data(self.parent).variants[self.id].name.clone() } - pub fn fields(&self, db: &impl HirDatabase) -> Vec { + pub fn fields(self, db: &impl HirDatabase) -> Vec { self.variant_data(db) .fields() .into_iter() .flat_map(|it| it.iter()) - .map(|(id, _)| StructField { parent: (*self).into(), id }) + .map(|(id, _)| StructField { parent: self.into(), id }) .collect() } - pub fn field(&self, db: &impl HirDatabase, name: &Name) -> Option { + pub fn field(self, db: &impl HirDatabase, name: &Name) -> Option { self.variant_data(db) .fields() .into_iter() .flat_map(|it| it.iter()) .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. - pub(crate) fn resolver(&self, db: &impl HirDatabase) -> Resolver { - match *self { - DefWithBody::Const(ref c) => c.resolver(db), - DefWithBody::Function(ref f) => f.resolver(db), - DefWithBody::Static(ref s) => s.resolver(db), + pub(crate) fn resolver(self, db: &impl HirDatabase) -> Resolver { + match self { + DefWithBody::Const(c) => c.resolver(db), + DefWithBody::Function(f) => f.resolver(db), + DefWithBody::Static(s) => s.resolver(db), } } } -- cgit v1.2.3