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/hir_def/src/nameres/collector.rs | 12 ++++++------ crates/hir_def/src/nameres/path_resolution.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'crates/hir_def/src/nameres') diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs index 93f30f23d..6fab58f15 100644 --- a/crates/hir_def/src/nameres/collector.rs +++ b/crates/hir_def/src/nameres/collector.rs @@ -500,7 +500,7 @@ impl DefCollector<'_> { let (per_ns, _) = self.def_map.resolve_path( self.db, self.def_map.root, - &path, + path, BuiltinShadowMode::Other, ); @@ -722,7 +722,7 @@ impl DefCollector<'_> { if import.is_extern_crate { let res = self.def_map.resolve_name_in_extern_prelude( self.db, - &import + import .path .as_ident() .expect("extern crate should have been desugared to one-element path"), @@ -1351,7 +1351,7 @@ impl ModCollector<'_, '_> { let imports = Import::from_use( self.def_collector.db, krate, - &self.item_tree, + self.item_tree, ItemTreeId::new(self.file_id, import_id), ); self.def_collector.unresolved_imports.extend(imports.into_iter().map( @@ -1368,7 +1368,7 @@ impl ModCollector<'_, '_> { import: Import::from_extern_crate( self.def_collector.db, krate, - &self.item_tree, + self.item_tree, ItemTreeId::new(self.file_id, import_id), ), status: PartialResolvedImport::Unresolved, @@ -1889,7 +1889,7 @@ impl ModCollector<'_, '_> { self.def_collector.def_map.with_ancestor_maps( self.def_collector.db, self.module_id, - &mut |map, module| map[module].scope.get_legacy_macro(&name), + &mut |map, module| map[module].scope.get_legacy_macro(name), ) }) }, @@ -1993,7 +1993,7 @@ mod tests { } fn do_resolve(code: &str) -> DefMap { - let (db, _file_id) = TestDB::with_single_file(&code); + let (db, _file_id) = TestDB::with_single_file(code); let krate = db.test_crate(); let edition = db.crate_graph()[krate].edition; diff --git a/crates/hir_def/src/nameres/path_resolution.rs b/crates/hir_def/src/nameres/path_resolution.rs index c984148c3..629bc7952 100644 --- a/crates/hir_def/src/nameres/path_resolution.rs +++ b/crates/hir_def/src/nameres/path_resolution.rs @@ -93,7 +93,7 @@ impl DefMap { let mut vis = match visibility { RawVisibility::Module(path) => { let (result, remaining) = - self.resolve_path(db, original_module, &path, BuiltinShadowMode::Module); + self.resolve_path(db, original_module, path, BuiltinShadowMode::Module); if remaining.is_some() { return None; } @@ -205,7 +205,7 @@ impl DefMap { None => return ResolvePathResult::empty(ReachedFixedPoint::Yes), }; log::debug!("resolving {:?} in crate root (+ extern prelude)", segment); - self.resolve_name_in_crate_root_or_extern_prelude(db, &segment) + self.resolve_name_in_crate_root_or_extern_prelude(db, segment) } PathKind::Plain => { let (_, segment) = match segments.next() { @@ -222,7 +222,7 @@ impl DefMap { if path.segments().len() == 1 { shadow } else { BuiltinShadowMode::Module }; log::debug!("resolving {:?} in module", segment); - self.resolve_name_in_module(db, original_module, &segment, prefer_module) + self.resolve_name_in_module(db, original_module, segment, prefer_module) } PathKind::Super(lvl) => { let mut module = original_module; @@ -269,7 +269,7 @@ impl DefMap { Some((_, segment)) => segment, None => return ResolvePathResult::empty(ReachedFixedPoint::Yes), }; - if let Some(def) = self.extern_prelude.get(&segment) { + if let Some(def) = self.extern_prelude.get(segment) { log::debug!("absolute path {:?} resolved to crate {:?}", path, def); PerNs::types(*def, Visibility::Public) } else { @@ -319,13 +319,13 @@ impl DefMap { }; // Since it is a qualified path here, it should not contains legacy macros - module_data.scope.get(&segment) + module_data.scope.get(segment) } ModuleDefId::AdtId(AdtId::EnumId(e)) => { // enum variant cov_mark::hit!(can_import_enum_variant); let enum_data = db.enum_data(e); - match enum_data.variant(&segment) { + match enum_data.variant(segment) { Some(local_id) => { let variant = EnumVariantId { parent: e, local_id }; match &*enum_data.variants[local_id].variant_data { -- cgit v1.2.3