diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-11-21 20:07:32 +0100 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-11-21 20:13:40 +0100 |
| commit | 21a870515b18e5b2b90435d0f1a6d3089b5217ae (patch) | |
| tree | 4e2c8766f7f64f8a122f38338db2614f1f909a63 /compiler/rustc_passes/src/loops.rs | |
| parent | 0ff861096449f47956521b40e5e4e88caa7fe27c (diff) | |
| download | rust-21a870515b18e5b2b90435d0f1a6d3089b5217ae.tar.gz rust-21a870515b18e5b2b90435d0f1a6d3089b5217ae.zip | |
Fix `clippy::needless_borrow` in the compiler
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
Diffstat (limited to 'compiler/rustc_passes/src/loops.rs')
| -rw-r--r-- | compiler/rustc_passes/src/loops.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_passes/src/loops.rs b/compiler/rustc_passes/src/loops.rs index 25e131d7477..8e6d5805275 100644 --- a/compiler/rustc_passes/src/loops.rs +++ b/compiler/rustc_passes/src/loops.rs @@ -39,7 +39,7 @@ struct CheckLoopVisitor<'a, 'hir> { fn check_mod_loops(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { tcx.hir().visit_item_likes_in_module( module_def_id, - &mut CheckLoopVisitor { sess: &tcx.sess, hir_map: tcx.hir(), cx: Normal }, + &mut CheckLoopVisitor { sess: tcx.sess, hir_map: tcx.hir(), cx: Normal }, ); } @@ -84,7 +84,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) { match e.kind { hir::ExprKind::Loop(ref b, _, source, _) => { - self.with_context(Loop(source), |v| v.visit_block(&b)); + self.with_context(Loop(source), |v| v.visit_block(b)); } hir::ExprKind::Closure(&hir::Closure { ref fn_decl, @@ -98,19 +98,19 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { } else { Closure(fn_decl_span) }; - self.visit_fn_decl(&fn_decl); + self.visit_fn_decl(fn_decl); self.with_context(cx, |v| v.visit_nested_body(body)); } hir::ExprKind::Block(ref b, Some(_label)) => { - self.with_context(LabeledBlock, |v| v.visit_block(&b)); + self.with_context(LabeledBlock, |v| v.visit_block(b)); } hir::ExprKind::Block(ref b, None) if matches!(self.cx, Fn) => { - self.with_context(Normal, |v| v.visit_block(&b)); + self.with_context(Normal, |v| v.visit_block(b)); } hir::ExprKind::Block(ref b, None) if matches!(self.cx, Normal | Constant | UnlabeledBlock(_)) => { - self.with_context(UnlabeledBlock(b.span.shrink_to_lo()), |v| v.visit_block(&b)); + self.with_context(UnlabeledBlock(b.span.shrink_to_lo()), |v| v.visit_block(b)); } hir::ExprKind::Break(break_label, ref opt_expr) => { if let Some(e) = opt_expr { |
