Skip to content

Commit 56288a7

Browse files
committed
Auto merge of rust-lang#122021 - oli-obk:delangitemification, r=compiler-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
2 parents 003c4bc + 0dc8769 commit 56288a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/needless_pass_by_ref_mut.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use rustc_hir::{
1313
use rustc_hir_typeck::expr_use_visitor as euv;
1414
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
1515
use rustc_lint::{LateContext, LateLintPass};
16-
use rustc_middle::hir::map::associated_body;
1716
use rustc_middle::mir::FakeReadCause;
1817
use rustc_middle::ty::{self, Ty, TyCtxt, UpvarId, UpvarPath};
1918
use rustc_session::impl_lint_pass;
@@ -112,7 +111,10 @@ fn check_closures<'tcx>(
112111
}
113112
ctx.prev_bind = None;
114113
ctx.prev_move_to_closure.clear();
115-
if let Some(body) = associated_body(cx.tcx.hir_node_by_def_id(closure))
114+
if let Some(body) = cx
115+
.tcx
116+
.hir_node_by_def_id(closure)
117+
.associated_body()
116118
.map(|(_, body_id)| hir.body(body_id))
117119
{
118120
euv::ExprUseVisitor::new(ctx, infcx, closure, cx.param_env, cx.typeck_results()).consume_body(body);

0 commit comments

Comments
 (0)