Skip to content

Commit

Permalink
Auto merge of rust-lang#122021 - oli-obk:delangitemification, r=compi…
Browse files Browse the repository at this point in the history
…ler-errors

Use hir::Node helper methods instead of repeating the same impl multiple times

I wanted to do something entirely different and stumbled upon a bunch of cleanups
  • Loading branch information
bors committed Mar 19, 2024
2 parents 003c4bc + 0dc8769 commit 56288a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clippy_lints/src/needless_pass_by_ref_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use rustc_hir::{
use rustc_hir_typeck::expr_use_visitor as euv;
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::hir::map::associated_body;
use rustc_middle::mir::FakeReadCause;
use rustc_middle::ty::{self, Ty, TyCtxt, UpvarId, UpvarPath};
use rustc_session::impl_lint_pass;
Expand Down Expand Up @@ -112,7 +111,10 @@ fn check_closures<'tcx>(
}
ctx.prev_bind = None;
ctx.prev_move_to_closure.clear();
if let Some(body) = associated_body(cx.tcx.hir_node_by_def_id(closure))
if let Some(body) = cx
.tcx
.hir_node_by_def_id(closure)
.associated_body()
.map(|(_, body_id)| hir.body(body_id))
{
euv::ExprUseVisitor::new(ctx, infcx, closure, cx.param_env, cx.typeck_results()).consume_body(body);
Expand Down

0 comments on commit 56288a7

Please sign in to comment.