aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorMaan2003 <[email protected]>2021-06-13 04:54:16 +0100
committerMaan2003 <[email protected]>2021-06-13 04:54:16 +0100
commitc9b4ac5be4daaabc062ab1ee663eba8594750003 (patch)
tree6090c8c38c735875c916255920525cf5fff45c75 /crates/hir
parentd6737e55fb49d286b5e646f57975b27b2c95ce92 (diff)
clippy::redudant_borrow
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs8
-rw-r--r--crates/hir/src/semantics.rs4
-rw-r--r--crates/hir/src/source_analyzer.rs6
3 files changed, 9 insertions, 9 deletions
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 {
1112 .collect(); 1112 .collect();
1113 sink.push(MissingFields { 1113 sink.push(MissingFields {
1114 file: source_ptr.file_id, 1114 file: source_ptr.file_id,
1115 field_list_parent: AstPtr::new(&record_expr), 1115 field_list_parent: AstPtr::new(record_expr),
1116 field_list_parent_path: record_expr 1116 field_list_parent_path: record_expr
1117 .path() 1117 .path()
1118 .map(|path| AstPtr::new(&path)), 1118 .map(|path| AstPtr::new(&path)),
@@ -2531,13 +2531,13 @@ impl Type {
2531 match ty.kind(&Interner) { 2531 match ty.kind(&Interner) {
2532 TyKind::Adt(_, substs) => { 2532 TyKind::Adt(_, substs) => {
2533 cb(type_.derived(ty.clone())); 2533 cb(type_.derived(ty.clone()));
2534 walk_substs(db, type_, &substs, cb); 2534 walk_substs(db, type_, substs, cb);
2535 } 2535 }
2536 TyKind::AssociatedType(_, substs) => { 2536 TyKind::AssociatedType(_, substs) => {
2537 if let Some(_) = ty.associated_type_parent_trait(db) { 2537 if let Some(_) = ty.associated_type_parent_trait(db) {
2538 cb(type_.derived(ty.clone())); 2538 cb(type_.derived(ty.clone()));
2539 } 2539 }
2540 walk_substs(db, type_, &substs, cb); 2540 walk_substs(db, type_, substs, cb);
2541 } 2541 }
2542 TyKind::OpaqueType(_, subst) => { 2542 TyKind::OpaqueType(_, subst) => {
2543 if let Some(bounds) = ty.impl_trait_bounds(db) { 2543 if let Some(bounds) = ty.impl_trait_bounds(db) {
@@ -2577,7 +2577,7 @@ impl Type {
2577 TyKind::FnDef(_, substs) 2577 TyKind::FnDef(_, substs)
2578 | TyKind::Tuple(_, substs) 2578 | TyKind::Tuple(_, substs)
2579 | TyKind::Closure(.., substs) => { 2579 | TyKind::Closure(.., substs) => {
2580 walk_substs(db, type_, &substs, cb); 2580 walk_substs(db, type_, substs, cb);
2581 } 2581 }
2582 TyKind::Function(hir_ty::FnPointer { substitution, .. }) => { 2582 TyKind::Function(hir_ty::FnPointer { substitution, .. }) => {
2583 walk_substs(db, type_, &substitution.0, cb); 2583 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> {
192 node: &SyntaxNode, 192 node: &SyntaxNode,
193 offset: TextSize, 193 offset: TextSize,
194 ) -> Option<N> { 194 ) -> Option<N> {
195 if let Some(it) = find_node_at_offset(&node, offset) { 195 if let Some(it) = find_node_at_offset(node, offset) {
196 return Some(it); 196 return Some(it);
197 } 197 }
198 198
@@ -744,7 +744,7 @@ impl<'db> SemanticsImpl<'db> {
744 return None; 744 return None;
745 } 745 }
746 746
747 let func = self.resolve_method_call(&method_call_expr).map(Function::from)?; 747 let func = self.resolve_method_call(method_call_expr).map(Function::from)?;
748 let res = match func.self_param(self.db)?.access(self.db) { 748 let res = match func.self_param(self.db)?.access(self.db) {
749 Access::Shared | Access::Exclusive => true, 749 Access::Shared | Access::Exclusive => true,
750 Access::Owned => false, 750 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 {
222 Pat::Path(path) => path, 222 Pat::Path(path) => path,
223 _ => return None, 223 _ => return None,
224 }; 224 };
225 let res = resolve_hir_path(db, &self.resolver, &path)?; 225 let res = resolve_hir_path(db, &self.resolver, path)?;
226 match res { 226 match res {
227 PathResolution::Def(def) => Some(def), 227 PathResolution::Def(def) => Some(def),
228 _ => None, 228 _ => None,
@@ -329,7 +329,7 @@ impl SourceAnalyzer {
329 329
330 let (variant, missing_fields, _exhaustive) = 330 let (variant, missing_fields, _exhaustive) =
331 record_literal_missing_fields(db, infer, expr_id, &body[expr_id])?; 331 record_literal_missing_fields(db, infer, expr_id, &body[expr_id])?;
332 let res = self.missing_fields(db, krate, &substs, variant, missing_fields); 332 let res = self.missing_fields(db, krate, substs, variant, missing_fields);
333 Some(res) 333 Some(res)
334 } 334 }
335 335
@@ -347,7 +347,7 @@ impl SourceAnalyzer {
347 347
348 let (variant, missing_fields, _exhaustive) = 348 let (variant, missing_fields, _exhaustive) =
349 record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?; 349 record_pattern_missing_fields(db, infer, pat_id, &body[pat_id])?;
350 let res = self.missing_fields(db, krate, &substs, variant, missing_fields); 350 let res = self.missing_fields(db, krate, substs, variant, missing_fields);
351 Some(res) 351 Some(res)
352 } 352 }
353 353