Make LateCtxt be a type info delegate for EUV for clippy
This commit is contained in:
parent
dfc9c9132b
commit
db193c1c9d
9 changed files with 21 additions and 60 deletions
|
|
@ -11,7 +11,6 @@ use rustc_errors::Applicability;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::{Closure, ExprKind, HirId, MutTy, TyKind};
|
||||
use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_lint::{EarlyContext, LateContext, LintContext};
|
||||
use rustc_middle::hir::place::ProjectionKind;
|
||||
use rustc_middle::mir::{FakeReadCause, Mutability};
|
||||
|
|
@ -831,8 +830,7 @@ pub fn deref_closure_args(cx: &LateContext<'_>, closure: &hir::Expr<'_>) -> Opti
|
|||
applicability: Applicability::MachineApplicable,
|
||||
};
|
||||
|
||||
let infcx = cx.tcx.infer_ctxt().build();
|
||||
ExprUseVisitor::new(&mut visitor, &infcx, def_id, cx.param_env, cx.typeck_results()).consume_body(closure_body);
|
||||
ExprUseVisitor::for_clippy(cx, def_id, &mut visitor).consume_body(closure_body);
|
||||
|
||||
if !visitor.suggestion_start.is_empty() {
|
||||
return Some(DerefClosure {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ use hir::def::Res;
|
|||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{self as hir, Expr, ExprKind, HirId, HirIdSet};
|
||||
use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, Place, PlaceBase, PlaceWithHirId};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::mir::FakeReadCause;
|
||||
|
|
@ -17,13 +16,10 @@ pub fn mutated_variables<'tcx>(expr: &'tcx Expr<'_>, cx: &LateContext<'tcx>) ->
|
|||
used_mutably: HirIdSet::default(),
|
||||
skip: false,
|
||||
};
|
||||
let infcx = cx.tcx.infer_ctxt().build();
|
||||
ExprUseVisitor::new(
|
||||
&mut delegate,
|
||||
&infcx,
|
||||
ExprUseVisitor::for_clippy(
|
||||
cx,
|
||||
expr.hir_id.owner.def_id,
|
||||
cx.param_env,
|
||||
cx.typeck_results(),
|
||||
&mut delegate,
|
||||
)
|
||||
.walk_expr(expr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue