From c9b4ac5be4daaabc062ab1ee663eba8594750003 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:24:16 +0530 Subject: clippy::redudant_borrow --- crates/ide_db/src/call_info.rs | 2 +- crates/ide_db/src/helpers/import_assets.rs | 4 ++-- crates/ide_db/src/helpers/merge_imports.rs | 2 +- crates/ide_db/src/search.rs | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/ide_db/src') diff --git a/crates/ide_db/src/call_info.rs b/crates/ide_db/src/call_info.rs index 933bcad55..4795e2565 100644 --- a/crates/ide_db/src/call_info.rs +++ b/crates/ide_db/src/call_info.rs @@ -162,7 +162,7 @@ impl ActiveParameter { } pub fn at_token(sema: &Semantics, token: SyntaxToken) -> Option { - let (signature, active_parameter) = call_info_impl(&sema, token)?; + let (signature, active_parameter) = call_info_impl(sema, token)?; let idx = active_parameter?; let mut params = signature.params(sema.db); diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs index ae52dd8bb..9634d872e 100644 --- a/crates/ide_db/src/helpers/import_assets.rs +++ b/crates/ide_db/src/helpers/import_assets.rs @@ -323,7 +323,7 @@ fn import_for_item( } let segment_import = - find_import_for_segment(db, original_item_candidate, &unresolved_first_segment)?; + find_import_for_segment(db, original_item_candidate, unresolved_first_segment)?; let trait_item_to_import = item_as_assoc(db, original_item) .and_then(|assoc| assoc.containing_trait(db)) .map(|trait_| ItemInNs::from(ModuleDef::from(trait_))); @@ -383,7 +383,7 @@ fn find_import_for_segment( original_item } else { let matching_module = - module_with_segment_name(db, &unresolved_first_segment, original_item)?; + module_with_segment_name(db, unresolved_first_segment, original_item)?; ItemInNs::from(ModuleDef::from(matching_module)) }) } diff --git a/crates/ide_db/src/helpers/merge_imports.rs b/crates/ide_db/src/helpers/merge_imports.rs index 0dbabb44f..ec29476a4 100644 --- a/crates/ide_db/src/helpers/merge_imports.rs +++ b/crates/ide_db/src/helpers/merge_imports.rs @@ -124,7 +124,7 @@ fn recursive_merge( .map(|tree_list| tree_list.use_trees().any(tree_is_self)) .unwrap_or(false) }; - match (tree_contains_self(&lhs_t), tree_contains_self(&rhs_t)) { + match (tree_contains_self(lhs_t), tree_contains_self(&rhs_t)) { (true, false) => continue, (false, true) => { *lhs_t = rhs_t; diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index 8152630f5..8bfbba4bb 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs @@ -409,7 +409,7 @@ impl<'a> FindUsages<'a> { if let Some(ast::NameLike::NameRef(name_ref)) = sema.find_node_at_offset_with_descend(&tree, offset) { - if self.found_self_ty_name_ref(&self_ty, &name_ref, sink) { + if self.found_self_ty_name_ref(self_ty, &name_ref, sink) { return; } } @@ -424,7 +424,7 @@ impl<'a> FindUsages<'a> { name_ref: &ast::NameRef, sink: &mut dyn FnMut(FileId, FileReference) -> bool, ) -> bool { - match NameRefClass::classify(self.sema, &name_ref) { + match NameRefClass::classify(self.sema, name_ref) { Some(NameRefClass::Definition(Definition::SelfType(impl_))) if impl_.self_ty(self.sema.db) == *self_ty => { @@ -464,13 +464,13 @@ impl<'a> FindUsages<'a> { name_ref: &ast::NameRef, sink: &mut dyn FnMut(FileId, FileReference) -> bool, ) -> bool { - match NameRefClass::classify(self.sema, &name_ref) { + match NameRefClass::classify(self.sema, name_ref) { Some(NameRefClass::Definition(def)) if def == self.def => { let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); let reference = FileReference { range, name: ast::NameLike::NameRef(name_ref.clone()), - access: reference_access(&def, &name_ref), + access: reference_access(&def, name_ref), }; sink(file_id, reference) } @@ -480,7 +480,7 @@ impl<'a> FindUsages<'a> { let reference = FileReference { range, name: ast::NameLike::NameRef(name_ref.clone()), - access: reference_access(&def, &name_ref), + access: reference_access(&def, name_ref), }; sink(file_id, reference) } else { @@ -491,10 +491,10 @@ impl<'a> FindUsages<'a> { let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); let access = match self.def { Definition::Field(_) if field == self.def => { - reference_access(&field, &name_ref) + reference_access(&field, name_ref) } Definition::Local(l) if local == l => { - reference_access(&Definition::Local(local), &name_ref) + reference_access(&Definition::Local(local), name_ref) } _ => return false, }; -- cgit v1.2.3