From dc9d839410ad28dff5dd857fba9e7e6b66673573 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 28 Nov 2019 07:12:05 -0800 Subject: [PATCH] euv moved from middle to typeck --- clippy_lints/src/escape.rs | 3 +-- clippy_lints/src/loops.rs | 4 +--- clippy_lints/src/needless_pass_by_value.rs | 13 ++++++------- clippy_lints/src/utils/usage.rs | 4 +--- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index 91433a8aab7..0e958c5ad05 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -1,8 +1,7 @@ use rustc::hir::intravisit as visit; use rustc::hir::{self, *}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::middle::expr_use_visitor::*; -use rustc::middle::mem_categorization::{Place, Categorization}; +use rustc_typeck::expr_use_visitor::*; use rustc::ty::layout::LayoutOf; use rustc::ty::{self, Ty}; use rustc::util::nodemap::HirIdSet; diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 14ba7fcdef1..52fa7a2c2e4 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -12,9 +12,7 @@ use rustc::{declare_lint_pass, declare_tool_lint}; use crate::consts::{constant, Constant}; use crate::utils::usage::mutated_variables; use crate::utils::{is_type_diagnostic_item, qpath_res, sext, sugg}; -use rustc::middle::expr_use_visitor::*; -use rustc::middle::mem_categorization::Place; -use rustc::middle::mem_categorization::Categorization; +use rustc_typeck::expr_use_visitor::*; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index bb5fc655755..c9be602fb45 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -8,8 +8,7 @@ use matches::matches; use rustc::hir::intravisit::FnKind; use rustc::hir::*; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::middle::expr_use_visitor as euv; -use rustc::middle::mem_categorization as mc; +use rustc_typeck::expr_use_visitor as euv; use rustc::traits; use rustc::ty::{self, RegionKind, TypeFoldable}; use rustc::{declare_lint_pass, declare_tool_lint}; @@ -326,7 +325,7 @@ struct MovedVariablesCtxt { } impl MovedVariablesCtxt { - fn move_common(&mut self, cmt: &mc::Place<'_>) { + fn move_common(&mut self, cmt: &euv::Place<'_>) { let cmt = unwrap_downcast_or_interior(cmt); if let mc::Categorization::Local(vid) = cmt.cat { @@ -336,18 +335,18 @@ impl MovedVariablesCtxt { } impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt { - fn consume(&mut self, cmt: &mc::Place<'tcx>, mode: euv::ConsumeMode) { + fn consume(&mut self, cmt: &euv::Place<'tcx>, mode: euv::ConsumeMode) { if let euv::ConsumeMode::Move = mode { self.move_common(cmt); } } - fn borrow(&mut self, _: &mc::Place<'tcx>, _: ty::BorrowKind) {} + fn borrow(&mut self, _: &euv::Place<'tcx>, _: ty::BorrowKind) {} - fn mutate(&mut self, _: &mc::Place<'tcx>) {} + fn mutate(&mut self, _: &euv::Place<'tcx>) {} } -fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a mc::Place<'tcx>) -> mc::Place<'tcx> { +fn unwrap_downcast_or_interior<'a, 'tcx>(mut cmt: &'a euv::Place<'tcx>) -> euv::Place<'tcx> { loop { match cmt.cat { mc::Categorization::Downcast(ref c, _) | mc::Categorization::Interior(ref c, _) => { diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs index 48901fc8257..8cd5d7d2d02 100644 --- a/clippy_lints/src/utils/usage.rs +++ b/clippy_lints/src/utils/usage.rs @@ -1,9 +1,7 @@ use rustc::hir::def::Res; use rustc::hir::*; use rustc::lint::LateContext; -use rustc::middle::expr_use_visitor::*; -use rustc::middle::mem_categorization::Place; -use rustc::middle::mem_categorization::Categorization; +use rustc_typeck::expr_use_visitor::*; use rustc::ty; use rustc_data_structures::fx::FxHashSet;