From aff57e0f43855925eeb747963f6875335eba596b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 30 Mar 2020 11:02:14 +0200 Subject: [PATCH] rustup https://github.com/rust-lang/rust/pull/70536 --- clippy_lints/src/as_conversions.rs | 2 +- clippy_lints/src/assign_ops.rs | 2 +- clippy_lints/src/atomic_ordering.rs | 2 +- clippy_lints/src/attrs.rs | 4 ++-- clippy_lints/src/block_in_if_condition.rs | 4 ++-- clippy_lints/src/booleans.rs | 2 +- clippy_lints/src/bytecount.rs | 2 +- clippy_lints/src/checked_conversions.rs | 2 +- clippy_lints/src/cognitive_complexity.rs | 2 +- clippy_lints/src/consts.rs | 10 ++++----- clippy_lints/src/copies.rs | 2 +- clippy_lints/src/default_trait_access.rs | 2 +- clippy_lints/src/derive.rs | 2 +- clippy_lints/src/doc.rs | 4 ++-- clippy_lints/src/drop_forget_ref.rs | 2 +- clippy_lints/src/else_if_without_else.rs | 2 +- clippy_lints/src/entry.rs | 2 +- clippy_lints/src/enum_clike.rs | 6 ++--- clippy_lints/src/escape.rs | 6 ++--- clippy_lints/src/eta_reduction.rs | 4 ++-- clippy_lints/src/eval_order_dependence.rs | 4 ++-- clippy_lints/src/fallible_impl_from.rs | 4 ++-- clippy_lints/src/float_literal.rs | 2 +- clippy_lints/src/floating_point_arithmetic.rs | 2 +- clippy_lints/src/format.rs | 2 +- clippy_lints/src/formatting.rs | 2 +- clippy_lints/src/functions.rs | 6 ++--- clippy_lints/src/identity_op.rs | 2 +- clippy_lints/src/if_not_else.rs | 2 +- clippy_lints/src/indexing_slicing.rs | 2 +- clippy_lints/src/large_enum_variant.rs | 2 +- clippy_lints/src/large_stack_arrays.rs | 4 ++-- clippy_lints/src/len_zero.rs | 2 +- clippy_lints/src/let_if_seq.rs | 2 +- clippy_lints/src/let_underscore.rs | 2 +- clippy_lints/src/lib.rs | 6 ++--- clippy_lints/src/lifetimes.rs | 4 ++-- clippy_lints/src/literal_representation.rs | 2 +- clippy_lints/src/loops.rs | 8 +++---- clippy_lints/src/map_clone.rs | 2 +- clippy_lints/src/map_unit_fn.rs | 2 +- clippy_lints/src/matches.rs | 4 ++-- clippy_lints/src/mem_replace.rs | 2 +- .../src/methods/inefficient_to_string.rs | 2 +- clippy_lints/src/methods/mod.rs | 6 ++--- .../src/methods/option_map_unwrap_or.rs | 2 +- .../src/methods/unnecessary_filter_map.rs | 2 +- clippy_lints/src/misc.rs | 2 +- clippy_lints/src/misc_early.rs | 2 +- clippy_lints/src/missing_const_for_fn.rs | 2 +- clippy_lints/src/missing_doc.rs | 2 +- clippy_lints/src/missing_inline.rs | 6 ++--- clippy_lints/src/modulo_arithmetic.rs | 2 +- clippy_lints/src/mut_key.rs | 2 +- clippy_lints/src/mut_mut.rs | 6 ++--- clippy_lints/src/mut_reference.rs | 4 ++-- clippy_lints/src/mutable_debug_assertion.rs | 4 ++-- clippy_lints/src/mutex_atomic.rs | 2 +- clippy_lints/src/needless_borrow.rs | 4 ++-- clippy_lints/src/needless_pass_by_value.rs | 2 +- clippy_lints/src/needless_update.rs | 2 +- clippy_lints/src/neg_cmp_op_on_partial_ord.rs | 2 +- clippy_lints/src/new_without_default.rs | 4 ++-- clippy_lints/src/non_copy_const.rs | 4 ++-- clippy_lints/src/ptr.rs | 2 +- clippy_lints/src/redundant_clone.rs | 14 ++++++------ clippy_lints/src/returns.rs | 2 +- clippy_lints/src/shadow.rs | 4 ++-- .../src/slow_vector_initialization.rs | 2 +- clippy_lints/src/strings.rs | 2 +- clippy_lints/src/suspicious_trait_impl.rs | 2 +- clippy_lints/src/swap.rs | 2 +- clippy_lints/src/to_digit_is_some.rs | 2 +- clippy_lints/src/transmute.rs | 2 +- clippy_lints/src/transmuting_null.rs | 2 +- .../src/trivially_copy_pass_by_ref.rs | 2 +- clippy_lints/src/try_err.rs | 4 ++-- clippy_lints/src/types.rs | 8 +++---- clippy_lints/src/unused_self.rs | 2 +- clippy_lints/src/unwrap.rs | 4 ++-- clippy_lints/src/use_self.rs | 8 +++---- clippy_lints/src/utils/author.rs | 2 +- clippy_lints/src/utils/higher.rs | 2 +- clippy_lints/src/utils/hir_utils.rs | 4 ++-- clippy_lints/src/utils/internal_lints.rs | 2 +- clippy_lints/src/utils/mod.rs | 22 +++++++++---------- clippy_lints/src/utils/ptr.rs | 2 +- clippy_lints/src/utils/usage.rs | 4 ++-- clippy_lints/src/vec.rs | 2 +- src/driver.rs | 6 ++--- tests/ui/auxiliary/proc_macro_derive.rs | 2 +- tests/ui/default_lint.rs | 2 +- tests/ui/lint_without_lint_pass.rs | 2 +- tests/ui/outer_expn_data.fixed | 2 +- tests/ui/outer_expn_data.rs | 2 +- tests/ui/useless_attribute.fixed | 2 +- tests/ui/useless_attribute.rs | 2 +- 97 files changed, 161 insertions(+), 161 deletions(-) diff --git a/clippy_lints/src/as_conversions.rs b/clippy_lints/src/as_conversions.rs index 1ec337719..4d8bbcd31 100644 --- a/clippy_lints/src/as_conversions.rs +++ b/clippy_lints/src/as_conversions.rs @@ -1,6 +1,6 @@ -use rustc::lint::in_external_macro; use rustc_ast::ast::{Expr, ExprKind}; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index b6fb6fdd2..b66e87467 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -3,11 +3,11 @@ use crate::utils::{ }; use crate::utils::{higher, sugg}; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/atomic_ordering.rs b/clippy_lints/src/atomic_ordering.rs index 871ca029b..d9ff1fe0a 100644 --- a/clippy_lints/src/atomic_ordering.rs +++ b/clippy_lints/src/atomic_ordering.rs @@ -1,9 +1,9 @@ use crate::utils::{match_def_path, span_lint_and_help}; use if_chain::if_chain; -use rustc::ty; use rustc_hir::def_id::DefId; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 35cde05e7..a406b141c 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -6,8 +6,6 @@ use crate::utils::{ span_lint_and_then, without_block_comments, }; use if_chain::if_chain; -use rustc::lint::in_external_macro; -use rustc::ty; use rustc_ast::ast::{AttrKind, AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem}; use rustc_ast::util::lev_distance::find_best_match_for_name; use rustc_errors::Applicability; @@ -15,6 +13,8 @@ use rustc_hir::{ Block, Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, StmtKind, TraitFn, TraitItem, TraitItemKind, }; use rustc_lint::{CheckLintNameResult, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 1972c53d6..9e533eaa3 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -1,10 +1,10 @@ use crate::utils::{differing_macro_contexts, higher, snippet_block_with_applicability, span_lint, span_lint_and_sugg}; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{BlockCheckMode, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index b580240be..7c9df141d 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -3,12 +3,12 @@ use crate::utils::{ span_lint_and_then, SpanlessEq, }; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_expr, FnKind, NestedVisitorMap, Visitor}; use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 9c06eb962..91d3e47d7 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -3,11 +3,11 @@ use crate::utils::{ span_lint_and_sugg, walk_ptrs_ty, }; use if_chain::if_chain; -use rustc::ty; use rustc_ast::ast::{Name, UintTy}; use rustc_errors::Applicability; use rustc_hir::{BinOpKind, BorrowKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/checked_conversions.rs b/clippy_lints/src/checked_conversions.rs index 23992ae89..88baaea9e 100644 --- a/clippy_lints/src/checked_conversions.rs +++ b/clippy_lints/src/checked_conversions.rs @@ -1,11 +1,11 @@ //! lint on manually implemented checked conversions that could be transformed into `try_from` use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::{BinOp, BinOpKind, Expr, ExprKind, QPath, TyKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::{snippet_with_applicability, span_lint_and_sugg, SpanlessEq}; diff --git a/clippy_lints/src/cognitive_complexity.rs b/clippy_lints/src/cognitive_complexity.rs index fcab45901..b90dd2864 100644 --- a/clippy_lints/src/cognitive_complexity.rs +++ b/clippy_lints/src/cognitive_complexity.rs @@ -1,10 +1,10 @@ //! calculate cognitive complexity and warn about overly complex functions -use rustc::hir::map::Map; use rustc_ast::ast::Attribute; use rustc_hir::intravisit::{walk_expr, FnKind, NestedVisitorMap, Visitor}; use rustc_hir::{Body, Expr, ExprKind, FnDecl, HirId}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; use rustc_span::BytePos; diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index fc26755a3..b1d540c97 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -2,14 +2,14 @@ use crate::utils::{clip, higher, sext, unsext}; use if_chain::if_chain; -use rustc::ty::subst::{Subst, SubstsRef}; -use rustc::ty::{self, Ty, TyCtxt}; -use rustc::{bug, span_bug}; use rustc_ast::ast::{FloatTy, LitFloatType, LitKind}; use rustc_data_structures::sync::Lrc; use rustc_hir::def::{DefKind, Res}; use rustc_hir::{BinOp, BinOpKind, Block, Expr, ExprKind, HirId, QPath, UnOp}; use rustc_lint::LateContext; +use rustc_middle::ty::subst::{Subst, SubstsRef}; +use rustc_middle::ty::{self, Ty, TyCtxt}; +use rustc_middle::{bug, span_bug}; use rustc_span::symbol::Symbol; use std::cmp::Ordering::{self, Equal}; use std::convert::TryInto; @@ -333,7 +333,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { .tcx .const_eval_resolve(self.param_env, def_id, substs, None, None) .ok() - .map(|val| rustc::ty::Const::from_value(self.lcx.tcx, val, ty))?; + .map(|val| rustc_middle::ty::Const::from_value(self.lcx.tcx, val, ty))?; let result = miri_to_const(&result); if result.is_some() { self.needed_resolution = true; @@ -460,7 +460,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { } pub fn miri_to_const(result: &ty::Const<'_>) -> Option { - use rustc::mir::interpret::{ConstValue, Scalar}; + use rustc_middle::mir::interpret::{ConstValue, Scalar}; match result.val { ty::ConstKind::Value(ConstValue::Scalar(Scalar::Raw { data: d, .. })) => match result.ty.kind { ty::Bool => Some(Constant::Bool(d == 1)), diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 996f80a75..383ee1164 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -1,9 +1,9 @@ use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span_lint_and_note, span_lint_and_then}; use crate::utils::{SpanlessEq, SpanlessHash}; -use rustc::ty::Ty; use rustc_data_structures::fx::FxHashMap; use rustc_hir::{Arm, Block, Expr, ExprKind, MatchSource, Pat, PatKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::Ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::Symbol; use std::collections::hash_map::Entry; diff --git a/clippy_lints/src/default_trait_access.rs b/clippy_lints/src/default_trait_access.rs index f99e6d96e..635d609c3 100644 --- a/clippy_lints/src/default_trait_access.rs +++ b/clippy_lints/src/default_trait_access.rs @@ -1,8 +1,8 @@ use if_chain::if_chain; -use rustc::ty; use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind, QPath}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::{any_parent_is_automatically_derived, match_def_path, paths, span_lint_and_sugg}; diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index eaff716e1..a24cfa89e 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -1,9 +1,9 @@ use crate::utils::paths; use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; use rustc_hir::{Item, ItemKind, TraitRef}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 63b8d519c..e015b1b49 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -1,12 +1,12 @@ use crate::utils::{implements_trait, is_entrypoint_fn, match_type, paths, return_ty, span_lint}; use if_chain::if_chain; use itertools::Itertools; -use rustc::lint::in_external_macro; -use rustc::ty; use rustc_ast::ast::{AttrKind, Attribute}; use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::{BytePos, MultiSpan, Span}; use rustc_span::Pos; diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index bd9bdfef0..9a60b2f02 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -1,8 +1,8 @@ use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_lint_and_note}; use if_chain::if_chain; -use rustc::ty; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/else_if_without_else.rs b/clippy_lints/src/else_if_without_else.rs index ccaa35350..fb10ca480 100644 --- a/clippy_lints/src/else_if_without_else.rs +++ b/clippy_lints/src/else_if_without_else.rs @@ -1,8 +1,8 @@ //! Lint on if expressions with an else if, but without a final else branch. -use rustc::lint::in_external_macro; use rustc_ast::ast::{Expr, ExprKind}; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 88647be02..65c9d08a6 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -2,11 +2,11 @@ use crate::utils::SpanlessEq; use crate::utils::{get_item_name, higher, match_type, paths, snippet, snippet_opt}; use crate::utils::{snippet_with_applicability, span_lint_and_then, walk_ptrs_ty}; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{BorrowKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index 5bc8a446c..ace11073a 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -3,11 +3,11 @@ use crate::consts::{miri_to_const, Constant}; use crate::utils::span_lint; -use rustc::ty; -use rustc::ty::util::IntTypeExt; use rustc_ast::ast::{IntTy, UintTy}; use rustc_hir::{Item, ItemKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; +use rustc_middle::ty::util::IntTypeExt; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::convert::TryFrom; @@ -51,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant { .tcx .const_eval_poly(def_id) .ok() - .map(|val| rustc::ty::Const::from_value(cx.tcx, val, ty)); + .map(|val| rustc_middle::ty::Const::from_value(cx.tcx, val, ty)); if let Some(Constant::Int(val)) = constant.and_then(miri_to_const) { if let ty::Adt(adt, _) = ty.kind { if adt.is_enum() { diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index db55e5ed1..94c458cc6 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -1,9 +1,9 @@ -use rustc::ty::layout::LayoutOf; -use rustc::ty::{self, Ty}; use rustc_hir::intravisit; use rustc_hir::{self, Body, FnDecl, HirId, HirIdSet, ItemKind, Node}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::layout::LayoutOf; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase}; @@ -92,7 +92,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal { } // TODO: Replace with Map::is_argument(..) when it's fixed -fn is_argument(map: rustc::hir::map::Map<'_>, id: HirId) -> bool { +fn is_argument(map: rustc_middle::hir::map::Map<'_>, id: HirId) -> bool { match map.find(id) { Some(Node::Binding(_)) => (), _ => return false, diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index c84ea4490..1a1a40902 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -1,9 +1,9 @@ use if_chain::if_chain; -use rustc::lint::in_external_macro; -use rustc::ty::{self, Ty}; use rustc_errors::Applicability; use rustc_hir::{def_id, Expr, ExprKind, Param, PatKind, QPath}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::{ diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 9cf0d3ba2..48b761260 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -1,10 +1,10 @@ use crate::utils::{get_parent_expr, span_lint, span_lint_and_note}; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::ty; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{def, BinOpKind, Block, Expr, ExprKind, Guard, HirId, Local, Node, QPath, Stmt, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs index 06608772c..d44481dd2 100644 --- a/clippy_lints/src/fallible_impl_from.rs +++ b/clippy_lints/src/fallible_impl_from.rs @@ -1,10 +1,10 @@ use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT}; use crate::utils::{is_expn_of, match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty}; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::ty::{self, Ty}; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::Span; diff --git a/clippy_lints/src/float_literal.rs b/clippy_lints/src/float_literal.rs index 55a9f6124..79040ebf8 100644 --- a/clippy_lints/src/float_literal.rs +++ b/clippy_lints/src/float_literal.rs @@ -1,10 +1,10 @@ use crate::utils::{numeric_literal, span_lint_and_sugg}; use if_chain::if_chain; -use rustc::ty; use rustc_ast::ast::{FloatTy, LitFloatType, LitKind}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::{f32, f64, fmt}; diff --git a/clippy_lints/src/floating_point_arithmetic.rs b/clippy_lints/src/floating_point_arithmetic.rs index cee14dc89..86317fb8b 100644 --- a/clippy_lints/src/floating_point_arithmetic.rs +++ b/clippy_lints/src/floating_point_arithmetic.rs @@ -4,10 +4,10 @@ use crate::consts::{ }; use crate::utils::{higher, numeric_literal, span_lint_and_sugg, sugg, SpanlessEq}; use if_chain::if_chain; -use rustc::ty; use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 10bc2f12f..30795f537 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -91,7 +91,7 @@ fn on_argumentv1_new<'a, 'tcx>( if pats.len() == 1; then { let ty = walk_ptrs_ty(cx.tables.pat_ty(&pats[0])); - if ty.kind != rustc::ty::Str && !match_type(cx, ty, &paths::STRING) { + if ty.kind != rustc_middle::ty::Str && !match_type(cx, ty, &paths::STRING) { return None; } if let ExprKind::Lit(ref lit) = format_args.kind { diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index a05f911c4..8f5f82b0a 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -1,8 +1,8 @@ use crate::utils::{differing_macro_contexts, snippet_opt, span_lint_and_help, span_lint_and_note}; use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_ast::ast::{BinOpKind, Block, Expr, ExprKind, StmtKind, UnOp}; use rustc_lint::{EarlyContext, EarlyLintPass}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index 697486c1a..cf1b65a01 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -3,9 +3,6 @@ use crate::utils::{ must_use_attr, qpath_res, return_ty, snippet, snippet_opt, span_lint, span_lint_and_help, span_lint_and_then, trait_ref_of_method, type_is_unsafe_function, }; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; -use rustc::ty::{self, Ty}; use rustc_ast::ast::Attribute; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; @@ -13,6 +10,9 @@ use rustc_hir as hir; use rustc_hir::intravisit; use rustc_hir::{def::Res, def_id::DefId}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; use rustc_target::spec::abi::Abi; diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index abd546870..088e4ab19 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -1,6 +1,6 @@ -use rustc::ty; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/if_not_else.rs b/clippy_lints/src/if_not_else.rs index 9b6e243f5..271df5b03 100644 --- a/clippy_lints/src/if_not_else.rs +++ b/clippy_lints/src/if_not_else.rs @@ -1,9 +1,9 @@ //! lint on if branches that could be swapped so no `!` operation is necessary //! on the condition -use rustc::lint::in_external_macro; use rustc_ast::ast::{BinOpKind, Expr, ExprKind, UnOp}; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/indexing_slicing.rs b/clippy_lints/src/indexing_slicing.rs index 65d2dd581..a2b1085a3 100644 --- a/clippy_lints/src/indexing_slicing.rs +++ b/clippy_lints/src/indexing_slicing.rs @@ -2,10 +2,10 @@ use crate::consts::{constant, Constant}; use crate::utils::{higher, span_lint, span_lint_and_help}; -use rustc::ty; use rustc_ast::ast::RangeLimits; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 39c8c4cfa..429f74405 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -1,10 +1,10 @@ //! lint when there is a large size difference between variants on an enum use crate::utils::{snippet_opt, span_lint_and_then}; -use rustc::ty::layout::LayoutOf; use rustc_errors::Applicability; use rustc_hir::{Item, ItemKind, VariantData}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::layout::LayoutOf; use rustc_session::{declare_tool_lint, impl_lint_pass}; declare_clippy_lint! { diff --git a/clippy_lints/src/large_stack_arrays.rs b/clippy_lints/src/large_stack_arrays.rs index e08042bcb..f67fce969 100644 --- a/clippy_lints/src/large_stack_arrays.rs +++ b/clippy_lints/src/large_stack_arrays.rs @@ -1,7 +1,7 @@ -use rustc::mir::interpret::ConstValue; -use rustc::ty::{self, ConstKind}; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::mir::interpret::ConstValue; +use rustc_middle::ty::{self, ConstKind}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use if_chain::if_chain; diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index 00cfb3b71..a875e5877 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -1,11 +1,11 @@ use crate::utils::{get_item_name, snippet_with_applicability, span_lint, span_lint_and_sugg, walk_ptrs_ty}; -use rustc::ty; use rustc_ast::ast::{LitKind, Name}; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir::def_id::DefId; use rustc_hir::{AssocItemKind, BinOpKind, Expr, ExprKind, ImplItemRef, Item, ItemKind, TraitItemRef}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::{Span, Spanned}; diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index d53438522..dbf86ba31 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -1,12 +1,12 @@ use crate::utils::{higher, qpath_res, snippet, span_lint_and_then}; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_hir::intravisit; use rustc_hir::BindingAnnotation; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/let_underscore.rs b/clippy_lints/src/let_underscore.rs index 5690a1214..1f5a6b77e 100644 --- a/clippy_lints/src/let_underscore.rs +++ b/clippy_lints/src/let_underscore.rs @@ -1,7 +1,7 @@ use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_hir::{PatKind, Stmt, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::{is_must_use_func_call, is_must_use_ty, match_type, paths, span_lint_and_help}; diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 704b46a87..73c05607b 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -18,8 +18,6 @@ #[allow(unused_extern_crates)] extern crate fmt_macros; #[allow(unused_extern_crates)] -extern crate rustc; -#[allow(unused_extern_crates)] extern crate rustc_ast; #[allow(unused_extern_crates)] extern crate rustc_ast_pretty; @@ -44,6 +42,8 @@ extern crate rustc_lexer; #[allow(unused_extern_crates)] extern crate rustc_lint; #[allow(unused_extern_crates)] +extern crate rustc_middle; +#[allow(unused_extern_crates)] extern crate rustc_mir; #[allow(unused_extern_crates)] extern crate rustc_parse; @@ -82,7 +82,7 @@ use rustc_session::Session; /// ``` /// # #![feature(rustc_private)] /// # #[allow(unused_extern_crates)] -/// # extern crate rustc; +/// # extern crate rustc_middle; /// # #[allow(unused_extern_crates)] /// # extern crate rustc_session; /// # #[macro_use] diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 1cdc48957..8a23bedfd 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -1,5 +1,3 @@ -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{ @@ -12,6 +10,8 @@ use rustc_hir::{ TyKind, WhereClause, WherePredicate, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::symbol::kw; diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index 9e6b63faf..1b0b111bc 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -7,10 +7,10 @@ use crate::utils::{ snippet_opt, span_lint_and_sugg, }; use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_ast::ast::{Expr, ExprKind, Lit, LitKind}; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; declare_clippy_lint! { diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 2d477653e..43217b6cc 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -11,10 +11,6 @@ use crate::utils::{ use crate::utils::{is_type_diagnostic_item, qpath_res, same_tys, sext, sugg}; use if_chain::if_chain; use itertools::Itertools; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; -use rustc::middle::region; -use rustc::ty::{self, Ty}; use rustc_ast::ast; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::Applicability; @@ -26,6 +22,10 @@ use rustc_hir::{ }; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; +use rustc_middle::middle::region; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::{BytePos, Symbol}; diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index 72227555b..58c94d720 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -3,11 +3,11 @@ use crate::utils::{ is_copy, match_trait_method, match_type, remove_blocks, snippet_with_applicability, span_lint_and_sugg, }; use if_chain::if_chain; -use rustc::ty; use rustc_ast::ast::Ident; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index d7ea022d8..c5bb559e1 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -1,10 +1,10 @@ use crate::utils::paths; use crate::utils::{iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 8d4e8595b..a124bf8b8 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -9,8 +9,6 @@ use crate::utils::{ walk_ptrs_ty, }; use if_chain::if_chain; -use rustc::lint::in_external_macro; -use rustc::ty::{self, Ty}; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::def::CtorKind; @@ -19,6 +17,8 @@ use rustc_hir::{ QPath, RangeEnd, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; use std::cmp::Ordering; diff --git a/clippy_lints/src/mem_replace.rs b/clippy_lints/src/mem_replace.rs index d2b1fd3a9..35b8842dc 100644 --- a/clippy_lints/src/mem_replace.rs +++ b/clippy_lints/src/mem_replace.rs @@ -3,10 +3,10 @@ use crate::utils::{ span_lint_and_sugg, span_lint_and_then, }; use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_errors::Applicability; use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, QPath}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/methods/inefficient_to_string.rs b/clippy_lints/src/methods/inefficient_to_string.rs index 1079fbf63..495f42700 100644 --- a/clippy_lints/src/methods/inefficient_to_string.rs +++ b/clippy_lints/src/methods/inefficient_to_string.rs @@ -1,10 +1,10 @@ use super::INEFFICIENT_TO_STRING; use crate::utils::{match_def_path, paths, snippet_with_applicability, span_lint_and_then, walk_ptrs_ty_depth}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::LateContext; +use rustc_middle::ty::{self, Ty}; /// Checks for the `INEFFICIENT_TO_STRING` lint pub fn lint<'tcx>(cx: &LateContext<'_, 'tcx>, expr: &hir::Expr<'_>, arg: &hir::Expr<'_>, arg_ty: Ty<'tcx>) { diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index e6c6cb6f7..527508af8 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -8,14 +8,14 @@ use std::fmt; use std::iter; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; -use rustc::ty::{self, Predicate, Ty}; use rustc_ast::ast; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::intravisit::{self, Visitor}; use rustc_lint::{LateContext, LateLintPass, Lint, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::{self, Predicate, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::symbol::{sym, Symbol, SymbolStr}; diff --git a/clippy_lints/src/methods/option_map_unwrap_or.rs b/clippy_lints/src/methods/option_map_unwrap_or.rs index c40ab7beb..2fd4bb1db 100644 --- a/clippy_lints/src/methods/option_map_unwrap_or.rs +++ b/clippy_lints/src/methods/option_map_unwrap_or.rs @@ -1,11 +1,11 @@ use crate::utils::{differing_macro_contexts, paths, snippet_with_applicability, span_lint_and_then}; use crate::utils::{is_copy, match_type}; -use rustc::hir::map::Map; use rustc_data_structures::fx::FxHashSet; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_path, NestedVisitorMap, Visitor}; use rustc_hir::{self, HirId, Path}; use rustc_lint::LateContext; +use rustc_middle::hir::map::Map; use rustc_span::source_map::Span; use rustc_span::symbol::Symbol; diff --git a/clippy_lints/src/methods/unnecessary_filter_map.rs b/clippy_lints/src/methods/unnecessary_filter_map.rs index ee6c6ef12..41c9ce7cd 100644 --- a/clippy_lints/src/methods/unnecessary_filter_map.rs +++ b/clippy_lints/src/methods/unnecessary_filter_map.rs @@ -1,11 +1,11 @@ use crate::utils::paths; use crate::utils::usage::mutated_variables; use crate::utils::{match_qpath, match_trait_method, span_lint}; -use rustc::hir::map::Map; use rustc_hir as hir; use rustc_hir::def::Res; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_lint::LateContext; +use rustc_middle::hir::map::Map; use if_chain::if_chain; diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 6dbc33d87..0dc55b7f7 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -1,5 +1,4 @@ use if_chain::if_chain; -use rustc::ty; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::intravisit::FnKind; @@ -8,6 +7,7 @@ use rustc_hir::{ TyKind, UnOp, }; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::{ExpnKind, Span}; diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index 718ec1c00..b3244453d 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -3,7 +3,6 @@ use crate::utils::{ span_lint_and_then, }; use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_ast::ast::{ BindingMode, Block, Expr, ExprKind, GenericParamKind, Generics, Lit, LitFloatType, LitIntType, LitKind, Mutability, NodeId, Pat, PatKind, StmtKind, UnOp, @@ -12,6 +11,7 @@ use rustc_ast::visit::{walk_expr, FnKind, Visitor}; use rustc_data_structures::fx::FxHashMap; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/missing_const_for_fn.rs b/clippy_lints/src/missing_const_for_fn.rs index bd67302cb..0b235bdfe 100644 --- a/clippy_lints/src/missing_const_for_fn.rs +++ b/clippy_lints/src/missing_const_for_fn.rs @@ -1,9 +1,9 @@ use crate::utils::{fn_has_unsatisfiable_preds, has_drop, is_entrypoint_fn, span_lint, trait_ref_of_method}; -use rustc::lint::in_external_macro; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; use rustc_hir::{Body, Constness, FnDecl, GenericParamKind, HirId}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::lint::in_external_macro; use rustc_mir::transform::qualify_min_const_fn::is_min_const_fn; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::Span; diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index e03f9e360..2eefb6bba 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -7,11 +7,11 @@ use crate::utils::span_lint; use if_chain::if_chain; -use rustc::ty; use rustc_ast::ast::{self, MetaItem, MetaItemKind}; use rustc_ast::attr; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::ty; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index 22b56c28b..9fc26047d 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -81,7 +81,7 @@ declare_lint_pass!(MissingInline => [MISSING_INLINE_IN_PUBLIC_ITEMS]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, it: &'tcx hir::Item<'_>) { - if rustc::lint::in_external_macro(cx.sess(), it.span) || is_executable(cx) { + if rustc_middle::lint::in_external_macro(cx.sess(), it.span) || is_executable(cx) { return; } @@ -130,8 +130,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline { } fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx hir::ImplItem<'_>) { - use rustc::ty::{ImplContainer, TraitContainer}; - if rustc::lint::in_external_macro(cx.sess(), impl_item.span) || is_executable(cx) { + use rustc_middle::ty::{ImplContainer, TraitContainer}; + if rustc_middle::lint::in_external_macro(cx.sess(), impl_item.span) || is_executable(cx) { return; } diff --git a/clippy_lints/src/modulo_arithmetic.rs b/clippy_lints/src/modulo_arithmetic.rs index 7446b732c..b24d5c1fc 100644 --- a/clippy_lints/src/modulo_arithmetic.rs +++ b/clippy_lints/src/modulo_arithmetic.rs @@ -1,9 +1,9 @@ use crate::consts::{constant, Constant}; use crate::utils::{sext, span_lint_and_then}; use if_chain::if_chain; -use rustc::ty::{self}; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::fmt::Display; diff --git a/clippy_lints/src/mut_key.rs b/clippy_lints/src/mut_key.rs index adaf82c70..0b9b7e1b8 100644 --- a/clippy_lints/src/mut_key.rs +++ b/clippy_lints/src/mut_key.rs @@ -1,7 +1,7 @@ use crate::utils::{match_def_path, paths, span_lint, trait_ref_of_method, walk_ptrs_ty}; -use rustc::ty::{Adt, Array, RawPtr, Ref, Slice, Tuple, Ty, TypeAndMut}; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{Adt, Array, RawPtr, Ref, Slice, Tuple, Ty, TypeAndMut}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/mut_mut.rs b/clippy_lints/src/mut_mut.rs index 70061f2aa..f7a20a74b 100644 --- a/clippy_lints/src/mut_mut.rs +++ b/clippy_lints/src/mut_mut.rs @@ -1,10 +1,10 @@ use crate::utils::{higher, span_lint}; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; -use rustc::ty; use rustc_hir as hir; use rustc_hir::intravisit; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index 55cb7e4a0..e5680482e 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -1,8 +1,8 @@ use crate::utils::span_lint; -use rustc::ty::subst::Subst; -use rustc::ty::{self, Ty}; use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::subst::Subst; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/mutable_debug_assertion.rs b/clippy_lints/src/mutable_debug_assertion.rs index c576fc2c1..80609d5cb 100644 --- a/clippy_lints/src/mutable_debug_assertion.rs +++ b/clippy_lints/src/mutable_debug_assertion.rs @@ -1,10 +1,10 @@ use crate::utils::{is_direct_expn_of, span_lint}; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::ty; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{BorrowKind, Expr, ExprKind, MatchSource, Mutability, StmtKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::Span; diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs index bbd2e4d83..de8feee76 100644 --- a/clippy_lints/src/mutex_atomic.rs +++ b/clippy_lints/src/mutex_atomic.rs @@ -3,10 +3,10 @@ //! This lint is **warn** by default use crate::utils::{match_type, paths, span_lint}; -use rustc::ty::{self, Ty}; use rustc_ast::ast; use rustc_hir::Expr; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index dc37c7804..422254bb0 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -4,11 +4,11 @@ use crate::utils::{snippet_opt, span_lint_and_then}; use if_chain::if_chain; -use rustc::ty; -use rustc::ty::adjustment::{Adjust, Adjustment}; use rustc_errors::Applicability; use rustc_hir::{BindingAnnotation, BorrowKind, Expr, ExprKind, HirId, Item, Mutability, Pat, PatKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; +use rustc_middle::ty::adjustment::{Adjust, Adjustment}; use rustc_session::{declare_tool_lint, impl_lint_pass}; declare_clippy_lint! { diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index dc18a745c..c352f6199 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -4,7 +4,6 @@ use crate::utils::{ snippet, snippet_opt, span_lint_and_then, }; use if_chain::if_chain; -use rustc::ty::{self, TypeFoldable}; use rustc_ast::ast::Attribute; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_errors::{Applicability, DiagnosticBuilder}; @@ -12,6 +11,7 @@ use rustc_hir::intravisit::FnKind; use rustc_hir::{BindingAnnotation, Body, FnDecl, GenericArg, HirId, ItemKind, Node, PatKind, QPath, TyKind}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self, TypeFoldable}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::{Span, Symbol}; use rustc_target::spec::abi::Abi; diff --git a/clippy_lints/src/needless_update.rs b/clippy_lints/src/needless_update.rs index e52b1cbf4..4b2586877 100644 --- a/clippy_lints/src/needless_update.rs +++ b/clippy_lints/src/needless_update.rs @@ -1,7 +1,7 @@ use crate::utils::span_lint; -use rustc::ty; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs index 2c4c29913..339c460bb 100644 --- a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs +++ b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs @@ -1,7 +1,7 @@ use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_hir::{BinOpKind, Expr, ExprKind, UnOp}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::{self, paths, span_lint}; diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index f69b145fa..09f4cccf7 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -2,13 +2,13 @@ use crate::utils::paths; use crate::utils::sugg::DiagnosticBuilderExt; use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_hir_and_then}; use if_chain::if_chain; -use rustc::lint::in_external_macro; -use rustc::ty::{self, Ty}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::HirIdSet; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index 43d76d0cb..744cade46 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -4,11 +4,11 @@ use std::ptr; -use rustc::ty::adjustment::Adjust; -use rustc::ty::{Ty, TypeFlags}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::{Expr, ExprKind, ImplItem, ImplItemKind, Item, ItemKind, Node, TraitItem, TraitItemKind, UnOp}; use rustc_lint::{LateContext, LateLintPass, Lint}; +use rustc_middle::ty::adjustment::Adjust; +use rustc_middle::ty::{Ty, TypeFlags}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::{InnerSpan, Span, DUMMY_SP}; use rustc_typeck::hir_ty_to_ty; diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 3d420cf8c..fd07df780 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -6,13 +6,13 @@ use crate::utils::{ walk_ptrs_hir_ty, }; use if_chain::if_chain; -use rustc::ty; use rustc_errors::Applicability; use rustc_hir::{ BinOpKind, BodyId, Expr, ExprKind, FnDecl, FnRetTy, GenericArg, HirId, ImplItem, ImplItemKind, Item, ItemKind, Lifetime, MutTy, Mutability, Node, PathSegment, QPath, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, }; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::{MultiSpan, Symbol}; diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 692161389..6bb11c8d9 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -3,17 +3,17 @@ use crate::utils::{ span_lint_hir_and_then, walk_ptrs_ty_depth, }; use if_chain::if_chain; -use rustc::mir::{ - self, traversal, - visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor as _}, -}; -use rustc::ty::{self, fold::TypeVisitor, Ty}; use rustc_data_structures::{fx::FxHashMap, transitive_relation::TransitiveRelation}; use rustc_errors::Applicability; use rustc_hir::intravisit::FnKind; use rustc_hir::{def_id, Body, FnDecl, HirId}; use rustc_index::bit_set::{BitSet, HybridBitSet}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::mir::{ + self, traversal, + visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor as _}, +}; +use rustc_middle::ty::{self, fold::TypeVisitor, Ty}; use rustc_mir::dataflow::BottomValue; use rustc_mir::dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor}; use rustc_session::{declare_lint_pass, declare_tool_lint}; @@ -335,7 +335,7 @@ fn base_local_and_movability<'tcx>( mir: &mir::Body<'tcx>, place: mir::Place<'tcx>, ) -> Option<(mir::Local, CannotMoveOut)> { - use rustc::mir::PlaceRef; + use rustc_middle::mir::PlaceRef; // Dereference. You cannot move things out from a borrowed value. let mut deref = false; @@ -556,7 +556,7 @@ impl TypeVisitor<'_> for ContainsRegion { } fn rvalue_locals(rvalue: &mir::Rvalue<'_>, mut visit: impl FnMut(mir::Local)) { - use rustc::mir::Rvalue::{Aggregate, BinaryOp, Cast, CheckedBinaryOp, Repeat, UnaryOp, Use}; + use rustc_middle::mir::Rvalue::{Aggregate, BinaryOp, Cast, CheckedBinaryOp, Repeat, UnaryOp, Use}; let mut visit_op = |op: &mir::Operand<'_>| match op { mir::Operand::Copy(p) | mir::Operand::Move(p) => visit(p.local), diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index ef1bbfd8f..ef1a1d7ac 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -1,9 +1,9 @@ use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_ast::ast; use rustc_ast::visit::FnKind; use rustc_errors::Applicability; use rustc_lint::{EarlyContext, EarlyLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::BytePos; diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 0ada65ec7..9b5c3306f 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -1,13 +1,13 @@ use crate::reexport::Name; use crate::utils::{contains_name, higher, iter_input_pats, snippet, span_lint_and_then}; -use rustc::lint::in_external_macro; -use rustc::ty; use rustc_hir::intravisit::FnKind; use rustc_hir::{ Block, Body, Expr, ExprKind, FnDecl, Guard, HirId, Local, MutTy, Pat, PatKind, Path, QPath, StmtKind, Ty, TyKind, UnOp, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs index 61dc7d1c9..b308692b8 100644 --- a/clippy_lints/src/slow_vector_initialization.rs +++ b/clippy_lints/src/slow_vector_initialization.rs @@ -1,12 +1,12 @@ use crate::utils::sugg::Sugg; use crate::utils::{get_enclosing_block, match_qpath, span_lint_and_then, SpanlessEq}; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_block, walk_expr, walk_stmt, NestedVisitorMap, Visitor}; use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, HirId, PatKind, QPath, Stmt, StmtKind}; use rustc_lint::{LateContext, LateLintPass, Lint}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::Symbol; diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index e777adb22..bb41e964d 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -1,7 +1,7 @@ -use rustc::lint::in_external_macro; use rustc_errors::Applicability; use rustc_hir::{BinOpKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Spanned; diff --git a/clippy_lints/src/suspicious_trait_impl.rs b/clippy_lints/src/suspicious_trait_impl.rs index e39a7b5e2..89b57ed1a 100644 --- a/clippy_lints/src/suspicious_trait_impl.rs +++ b/clippy_lints/src/suspicious_trait_impl.rs @@ -1,9 +1,9 @@ use crate::utils::{get_trait_def_id, span_lint, trait_ref_of_method}; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_hir as hir; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index a909216dc..e038c3785 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -4,10 +4,10 @@ use crate::utils::{ span_lint_and_then, walk_ptrs_ty, SpanlessEq, }; use if_chain::if_chain; -use rustc::ty; use rustc_errors::Applicability; use rustc_hir::{Block, Expr, ExprKind, PatKind, QPath, StmtKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::Symbol; diff --git a/clippy_lints/src/to_digit_is_some.rs b/clippy_lints/src/to_digit_is_some.rs index 5ec4a82b1..c6302ca03 100644 --- a/clippy_lints/src/to_digit_is_some.rs +++ b/clippy_lints/src/to_digit_is_some.rs @@ -1,9 +1,9 @@ use crate::utils::{match_def_path, snippet_with_applicability, span_lint_and_sugg}; use if_chain::if_chain; -use rustc::ty; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 6dad9eef5..3220bd9b9 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -2,11 +2,11 @@ use crate::utils::{ is_normalizable, last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then, sugg, }; use if_chain::if_chain; -use rustc::ty::{self, Ty}; use rustc_ast::ast; use rustc_errors::Applicability; use rustc_hir::{Expr, ExprKind, GenericArg, Mutability, QPath, TyKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use std::borrow::Cow; diff --git a/clippy_lints/src/transmuting_null.rs b/clippy_lints/src/transmuting_null.rs index 494dd4486..1d0332c58 100644 --- a/clippy_lints/src/transmuting_null.rs +++ b/clippy_lints/src/transmuting_null.rs @@ -1,10 +1,10 @@ use crate::consts::{constant_context, Constant}; use crate::utils::{match_qpath, paths, span_lint}; use if_chain::if_chain; -use rustc::lint::in_external_macro; use rustc_ast::ast::LitKind; use rustc_hir::{Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index 0f00ed6c1..52b07fb34 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -2,12 +2,12 @@ use std::cmp; use crate::utils::{is_copy, is_self_ty, snippet, span_lint_and_sugg}; use if_chain::if_chain; -use rustc::ty; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::intravisit::FnKind; use rustc_hir::{Body, FnDecl, HirId, ItemKind, MutTy, Mutability, Node}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty; use rustc_session::config::Config as SessionConfig; use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_span::Span; diff --git a/clippy_lints/src/try_err.rs b/clippy_lints/src/try_err.rs index a6624408c..7018fa680 100644 --- a/clippy_lints/src/try_err.rs +++ b/clippy_lints/src/try_err.rs @@ -1,10 +1,10 @@ use crate::utils::{match_qpath, paths, snippet, snippet_with_macro_callsite, span_lint_and_sugg}; use if_chain::if_chain; -use rustc::lint::in_external_macro; -use rustc::ty::Ty; use rustc_errors::Applicability; use rustc_hir::{Arm, Expr, ExprKind, MatchSource}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::Ty; use rustc_session::{declare_lint_pass, declare_tool_lint}; declare_clippy_lint! { diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index d466924dc..4ff294737 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -5,10 +5,6 @@ use std::cmp::Ordering; use std::collections::BTreeMap; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; -use rustc::ty::layout::LayoutOf; -use rustc::ty::{self, InferTy, Ty, TyCtxt, TypeckTables}; use rustc_ast::ast::{FloatTy, IntTy, LitFloatType, LitIntType, LitKind, UintTy}; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; @@ -19,6 +15,10 @@ use rustc_hir::{ TraitItem, TraitItemKind, TyKind, UnOp, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty::layout::LayoutOf; +use rustc_middle::ty::{self, InferTy, Ty, TyCtxt, TypeckTables}; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/unused_self.rs b/clippy_lints/src/unused_self.rs index a45b4a686..c12553312 100644 --- a/clippy_lints/src/unused_self.rs +++ b/clippy_lints/src/unused_self.rs @@ -1,9 +1,9 @@ use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_hir::def::Res; use rustc_hir::intravisit::{walk_path, NestedVisitorMap, Visitor}; use rustc_hir::{AssocItemKind, HirId, ImplItem, ImplItemKind, ImplItemRef, ItemKind, Path}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint}; use crate::utils::span_lint_and_help; diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index 767b48d4a..a3f71be69 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -1,10 +1,10 @@ use crate::utils::{higher::if_block, match_type, paths, span_lint_and_then, usage::is_potentially_mutated}; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; use rustc_hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor}; use rustc_hir::{BinOpKind, Body, Expr, ExprKind, FnDecl, HirId, Path, QPath, UnOp}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 73a986b79..4fcaf3cdb 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -1,8 +1,4 @@ use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::lint::in_external_macro; -use rustc::ty; -use rustc::ty::{DefIdTree, Ty}; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; @@ -12,6 +8,10 @@ use rustc_hir::{ TyKind, }; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::lint::in_external_macro; +use rustc_middle::ty; +use rustc_middle::ty::{DefIdTree, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::symbol::kw; diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 20f392925..0c8f06da9 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -2,7 +2,6 @@ //! to generate a clippy lint detecting said code automatically. use crate::utils::{get_attr, higher}; -use rustc::hir::map::Map; use rustc_ast::ast::{Attribute, LitFloatType, LitKind}; use rustc_ast::walk_list; use rustc_data_structures::fx::FxHashMap; @@ -10,6 +9,7 @@ use rustc_hir as hir; use rustc_hir::intravisit::{NestedVisitorMap, Visitor}; use rustc_hir::{BindingAnnotation, Block, Expr, ExprKind, Pat, PatKind, QPath, Stmt, StmtKind, TyKind}; use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_middle::hir::map::Map; use rustc_session::Session; use rustc_session::{declare_lint_pass, declare_tool_lint}; diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index f27cc57fb..7dfe666b1 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -5,10 +5,10 @@ use crate::utils::{is_expn_of, match_def_path, match_qpath, paths}; use if_chain::if_chain; -use rustc::ty; use rustc_ast::ast; use rustc_hir as hir; use rustc_lint::LateContext; +use rustc_middle::ty; /// Converts a hir binary operator to the corresponding `ast` type. #[must_use] diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index 8f29b7e13..02b721fd3 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -1,7 +1,5 @@ use crate::consts::{constant_context, constant_simple}; use crate::utils::differing_macro_contexts; -use rustc::ich::StableHashingContextProvider; -use rustc::ty::TypeckTables; use rustc_ast::ast::Name; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::{ @@ -10,6 +8,8 @@ use rustc_hir::{ TyKind, TypeBinding, }; use rustc_lint::LateContext; +use rustc_middle::ich::StableHashingContextProvider; +use rustc_middle::ty::TypeckTables; use std::hash::Hash; /// Type used to check whether two ast are the same. This is different from the diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 7dbb0d5a9..bc2200800 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -3,7 +3,6 @@ use crate::utils::{ walk_ptrs_ty, }; use if_chain::if_chain; -use rustc::hir::map::Map; use rustc_ast::ast::{Crate as AstCrate, ItemKind, LitKind, Name, NodeId}; use rustc_ast::visit::FnKind; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -13,6 +12,7 @@ use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{Crate, Expr, ExprKind, HirId, Item, MutTy, Mutability, Path, Ty, TyKind}; use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass}; +use rustc_middle::hir::map::Map; use rustc_session::{declare_lint_pass, declare_tool_lint, impl_lint_pass}; use rustc_span::source_map::{Span, Spanned}; use rustc_span::symbol::SymbolStr; diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 871f7e6c3..a2c6e0bbd 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -25,14 +25,6 @@ use std::borrow::Cow; use std::mem; use if_chain::if_chain; -use rustc::hir::map::Map; -use rustc::traits; -use rustc::ty::{ - self, - layout::{self, IntegerExt}, - subst::GenericArg, - Binder, Ty, TyCtxt, TypeFoldable, -}; use rustc_ast::ast::{self, Attribute, LitKind}; use rustc_attr as attr; use rustc_errors::Applicability; @@ -47,6 +39,14 @@ use rustc_hir::{ }; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::{LateContext, Level, Lint, LintContext}; +use rustc_middle::hir::map::Map; +use rustc_middle::traits; +use rustc_middle::ty::{ + self, + layout::{self, IntegerExt}, + subst::GenericArg, + Binder, Ty, TyCtxt, TypeFoldable, +}; use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::source_map::original_sp; use rustc_span::symbol::{self, kw, Symbol}; @@ -230,7 +230,7 @@ pub fn match_qpath(path: &QPath<'_>, segments: &[&str]) -> bool { /// } /// /// if match_path(ty_path, &["rustc", "lint", "Lint"]) { -/// // This is a `rustc::lint::Lint`. +/// // This is a `rustc_middle::lint::Lint`. /// } /// ``` pub fn match_path(path: &Path<'_>, segments: &[&str]) -> bool { @@ -832,7 +832,7 @@ pub fn is_integer_literal(expr: &Expr<'_>, value: u128) -> bool { /// Examples of coercions can be found in the Nomicon at /// . /// -/// See `rustc::ty::adjustment::Adjustment` and `rustc_typeck::check::coercion` for more +/// See `rustc_middle::ty::adjustment::Adjustment` and `rustc_typeck::check::coercion` for more /// information on adjustments and coercions. pub fn is_adjusted(cx: &LateContext<'_, '_>, e: &Expr<'_>) -> bool { cx.tables.adjustments().get(e.hir_id).is_some() @@ -1224,7 +1224,7 @@ pub fn match_function_call<'a, 'tcx>( /// to avoid crashes on `layout_of`. pub fn is_normalizable<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> bool { cx.tcx.infer_ctxt().enter(|infcx| { - let cause = rustc::traits::ObligationCause::dummy(); + let cause = rustc_middle::traits::ObligationCause::dummy(); infcx.at(&cause, param_env).normalize(&ty).is_ok() }) } diff --git a/clippy_lints/src/utils/ptr.rs b/clippy_lints/src/utils/ptr.rs index 238c2277a..240bf2449 100644 --- a/clippy_lints/src/utils/ptr.rs +++ b/clippy_lints/src/utils/ptr.rs @@ -1,9 +1,9 @@ use crate::utils::{get_pat_name, match_var, snippet}; -use rustc::hir::map::Map; use rustc_ast::ast::Name; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{Body, BodyId, Expr, ExprKind, Param}; use rustc_lint::LateContext; +use rustc_middle::hir::map::Map; use rustc_span::source_map::Span; use std::borrow::Cow; diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs index a08251c1a..1838fa5f8 100644 --- a/clippy_lints/src/utils/usage.rs +++ b/clippy_lints/src/utils/usage.rs @@ -1,6 +1,4 @@ use crate::utils::match_var; -use rustc::hir::map::Map; -use rustc::ty; use rustc_ast::ast; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def::Res; @@ -8,6 +6,8 @@ use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{Expr, HirId, Path}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::LateContext; +use rustc_middle::hir::map::Map; +use rustc_middle::ty; use rustc_span::symbol::Ident; use rustc_typeck::expr_use_visitor::{ConsumeMode, Delegate, ExprUseVisitor, Place, PlaceBase}; diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index 726a34856..1174f4215 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -1,10 +1,10 @@ use crate::consts::constant; use crate::utils::{higher, is_copy, snippet_with_applicability, span_lint_and_sugg}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; use rustc_errors::Applicability; use rustc_hir::{BorrowKind, Expr, ExprKind}; use rustc_lint::{LateContext, LateLintPass}; +use rustc_middle::ty::{self, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; diff --git a/src/driver.rs b/src/driver.rs index 7865f6bb9..2c699998e 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -5,16 +5,16 @@ // FIXME: switch to something more ergonomic here, once available. // (Currently there is no way to opt into sysroot crates without `extern crate`.) #[allow(unused_extern_crates)] -extern crate rustc; -#[allow(unused_extern_crates)] extern crate rustc_driver; #[allow(unused_extern_crates)] extern crate rustc_errors; #[allow(unused_extern_crates)] extern crate rustc_interface; +#[allow(unused_extern_crates)] +extern crate rustc_middle; -use rustc::ty::TyCtxt; use rustc_interface::interface; +use rustc_middle::ty::TyCtxt; use rustc_tools_util::VersionInfo; use lazy_static::lazy_static; diff --git a/tests/ui/auxiliary/proc_macro_derive.rs b/tests/ui/auxiliary/proc_macro_derive.rs index f6d101a09..21bb5b01e 100644 --- a/tests/ui/auxiliary/proc_macro_derive.rs +++ b/tests/ui/auxiliary/proc_macro_derive.rs @@ -16,7 +16,7 @@ pub fn derive(_: TokenStream) -> TokenStream { let output = quote! { // Should not trigger `useless_attribute` #[allow(dead_code)] - extern crate rustc; + extern crate rustc_middle; }; output } diff --git a/tests/ui/default_lint.rs b/tests/ui/default_lint.rs index 0c6f29a43..053faae02 100644 --- a/tests/ui/default_lint.rs +++ b/tests/ui/default_lint.rs @@ -2,7 +2,7 @@ #![feature(rustc_private)] #[macro_use] -extern crate rustc; +extern crate rustc_middle; #[macro_use] extern crate rustc_session; extern crate rustc_lint; diff --git a/tests/ui/lint_without_lint_pass.rs b/tests/ui/lint_without_lint_pass.rs index 8eb1f7b64..beaef79a3 100644 --- a/tests/ui/lint_without_lint_pass.rs +++ b/tests/ui/lint_without_lint_pass.rs @@ -2,7 +2,7 @@ #![feature(rustc_private)] #[macro_use] -extern crate rustc; +extern crate rustc_middle; #[macro_use] extern crate rustc_session; extern crate rustc_lint; diff --git a/tests/ui/outer_expn_data.fixed b/tests/ui/outer_expn_data.fixed index d1bb01ae8..999a19b28 100644 --- a/tests/ui/outer_expn_data.fixed +++ b/tests/ui/outer_expn_data.fixed @@ -3,9 +3,9 @@ #![deny(clippy::internal)] #![feature(rustc_private)] -extern crate rustc; extern crate rustc_hir; extern crate rustc_lint; +extern crate rustc_middle; #[macro_use] extern crate rustc_session; use rustc_hir::Expr; diff --git a/tests/ui/outer_expn_data.rs b/tests/ui/outer_expn_data.rs index 56a69982f..5405d475d 100644 --- a/tests/ui/outer_expn_data.rs +++ b/tests/ui/outer_expn_data.rs @@ -3,9 +3,9 @@ #![deny(clippy::internal)] #![feature(rustc_private)] -extern crate rustc; extern crate rustc_hir; extern crate rustc_lint; +extern crate rustc_middle; #[macro_use] extern crate rustc_session; use rustc_hir::Expr; diff --git a/tests/ui/useless_attribute.fixed b/tests/ui/useless_attribute.fixed index ff626ab3d..b222e2f79 100644 --- a/tests/ui/useless_attribute.fixed +++ b/tests/ui/useless_attribute.fixed @@ -11,7 +11,7 @@ #[allow(unused_imports)] #[allow(unused_extern_crates)] #[macro_use] -extern crate rustc; +extern crate rustc_middle; #[macro_use] extern crate proc_macro_derive; diff --git a/tests/ui/useless_attribute.rs b/tests/ui/useless_attribute.rs index 822c6b6ea..3422eace4 100644 --- a/tests/ui/useless_attribute.rs +++ b/tests/ui/useless_attribute.rs @@ -11,7 +11,7 @@ #[allow(unused_imports)] #[allow(unused_extern_crates)] #[macro_use] -extern crate rustc; +extern crate rustc_middle; #[macro_use] extern crate proc_macro_derive;