Auto merge of #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
This commit is contained in:
commit
56288a72be
@ -13,7 +13,6 @@
|
||||
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;
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user