diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-13 08:18:49 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-13 08:18:49 +0100 |
commit | adbee621a75f47e0da4f30d7205dfce009138865 (patch) | |
tree | ed8dcbba37de566f00d119817e141bb8293ce164 /crates/hir/src | |
parent | f107b0f1e223dba33cb9850ce44bcbb4345eef52 (diff) | |
parent | 5ac6804bb3a07b959e8c2c3534255a8d6bb4948c (diff) |
Merge #9242
9242: Clippy r=matklad a=Maan2003
Best viewed commit wise
Co-authored-by: Maan2003 <[email protected]>
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/lib.rs | 10 | ||||
-rw-r--r-- | crates/hir/src/semantics.rs | 4 | ||||
-rw-r--r-- | crates/hir/src/source_analyzer.rs | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 2468c0dc6..bd923cba8 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -452,7 +452,7 @@ impl Module { | |||
452 | } | 452 | } |
453 | 453 | ||
454 | pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> { | 454 | pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> { |
455 | self.id.def_map(db.upcast())[self.id.local_id].scope.visibility_of(def.clone().into()) | 455 | self.id.def_map(db.upcast())[self.id.local_id].scope.visibility_of((*def).into()) |
456 | } | 456 | } |
457 | 457 | ||
458 | pub fn diagnostics( | 458 | pub fn diagnostics( |
@@ -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 | ||