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/src/lib.rs | 8 ++++---- crates/hir/src/semantics.rs | 4 ++-- crates/hir/src/source_analyzer.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'crates/hir') diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 2468c0dc6..f6eb23262 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -1112,7 +1112,7 @@ impl Function { .collect(); sink.push(MissingFields { file: source_ptr.file_id, - field_list_parent: AstPtr::new(&record_expr), + field_list_parent: AstPtr::new(record_expr), field_list_parent_path: record_expr .path() .map(|path| AstPtr::new(&path)), @@ -2531,13 +2531,13 @@ impl Type { match ty.kind(&Interner) { TyKind::Adt(_, substs) => { cb(type_.derived(ty.clone())); - walk_substs(db, type_, &substs, cb); + walk_substs(db, type_, substs, cb); } TyKind::AssociatedType(_, substs) => { if let Some(_) = ty.associated_type_parent_trait(db) { cb(type_.derived(ty.clone())); } - walk_substs(db, type_, &substs, cb); + walk_substs(db, type_, substs, cb); } TyKind::OpaqueType(_, subst) => { if let Some(bounds) = ty.impl_trait_bounds(db) { @@ -2577,7 +2577,7 @@ impl Type { TyKind::FnDef(_, substs) | TyKind::Tuple(_, substs) | TyKind::Closure(.., substs) => { - walk_substs(db, type_, &substs, cb); + walk_substs(db, type_, substs, cb); } TyKind::Function(hir_ty::FnPointer { substitution, .. }) => { walk_substs(db, type_, &substitution.0, cb); diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index d522d5245..613266e07 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs @@ -192,7 +192,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { node: &SyntaxNode, offset: TextSize, ) -> Option { - if let Some(it) = find_node_at_offset(&node, offset) { + if let Some(it) = find_node_at_offset(node, offset) { return Some(it); } @@ -744,7 +744,7 @@ impl<'db> SemanticsImpl<'db> { return None; } - let func = self.resolve_method_call(&method_call_expr).map(Function::from)?; + let func = self.resolve_method_call(method_call_expr).map(Function::from)?; let res = match func.self_param(self.db)?.access(self.db) { Access::Shared | Access::Exclusive => true, Access::Owned => false, diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index 37a050415..c9744d81d 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs @@ -222,7 +222,7 @@ impl SourceAnalyzer { Pat::Path(path) => path, _ => return None, }; - let res = resolve_hir_path(db, &self.resolver, &path)?; + let res = resolve_hir_path(db, &self.resolver, path)?; match res { PathResolution::Def(def) => Some(def), _ => None, @@ -329,7 +329,7 @@ impl SourceAnalyzer { let (variant, missing_fields, _exhaustive) = record_literal_missing_fields(db, infer, expr_id, &body[expr_id])?; - let res = self.missing_fields(db, krate, &substs, variant, missing_fields); + let res = self.missing_fields(db, krate, substs, variant, missing_fields); Some(res) } @@ -347,7 +347,7 @@ impl SourceAnalyzer { let (variant, missing_fields, _exhaustive) = record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?; - let res = self.missing_fields(db, krate, &substs, variant, missing_fields); + let res = self.missing_fields(db, krate, substs, variant, missing_fields); Some(res) } -- cgit v1.2.3