diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 99b9e79463a..4d921daea8a 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -1,10 +1,10 @@ use crate::utils::span_lint; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use std::f64::consts as f64; -use syntax::ast::{FloatTy, Lit, LitKind}; -use syntax::symbol; +use crate::syntax::ast::{FloatTy, Lit, LitKind}; +use crate::syntax::symbol; /// **What it does:** Checks for floating point literals that approximate /// constants which are defined in diff --git a/clippy_lints/src/arithmetic.rs b/clippy_lints/src/arithmetic.rs index fa48b2b5506..bdf8d237c70 100644 --- a/clippy_lints/src/arithmetic.rs +++ b/clippy_lints/src/arithmetic.rs @@ -1,8 +1,8 @@ use crate::utils::span_lint; -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::source_map::Span; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::source_map::Span; /// **What it does:** Checks for plain integer arithmetic. /// diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index 9a1808345a5..d50b72b19ac 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -1,11 +1,11 @@ use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq}; use crate::utils::{higher, sugg}; -use rustc::hir; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast; +use crate::syntax::ast; /// **What it does:** Checks for `a = a op b` or `a = b commutative_op a` /// patterns. @@ -220,7 +220,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps { } fn is_commutative(op: hir::BinOpKind) -> bool { - use rustc::hir::BinOpKind::*; + use crate::rustc::hir::BinOpKind::*; match op { Add | Mul | And | Or | BitXor | BitAnd | BitOr | Eq | Ne => true, Sub | Div | Rem | Shl | Shr | Lt | Le | Ge | Gt => false, diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 034c2cc241a..3a8514818f6 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -5,14 +5,14 @@ use crate::utils::{ in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then, without_block_comments, }; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, TyCtxt}; +use crate::rustc::ty::{self, TyCtxt}; use semver::Version; -use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind}; -use syntax::source_map::Span; +use crate::syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind}; +use crate::syntax::source_map::Span; /// **What it does:** Checks for items annotated with `#[inline(always)]`, /// unless the annotated function is empty or simply panics. diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index ecac7f8250b..93c6bee03bf 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -1,9 +1,9 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast::LitKind; -use syntax::source_map::Span; +use crate::syntax::ast::LitKind; +use crate::syntax::source_map::Span; use crate::utils::{span_lint, span_lint_and_then}; use crate::utils::sugg::Sugg; use crate::consts::{constant, Constant}; diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index 97749e6f997..9d6005cd612 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -1,6 +1,6 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; use crate::utils::span_lint; /// **What it does:** Checks for usage of blacklisted names for variables, such diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 752d640fa9e..c1b4b4575ab 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -1,8 +1,8 @@ use matches::matches; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use crate::utils::*; /// **What it does:** Checks for `if` conditions that use blocks to contain an diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index 3d3fa7b5e73..b2639330071 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -1,10 +1,10 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::hir::intravisit::*; -use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID}; -use syntax::source_map::{dummy_spanned, Span, DUMMY_SP}; -use rustc_data_structures::thin_vec::ThinVec; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::*; +use crate::syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID}; +use crate::syntax::source_map::{dummy_spanned, Span, DUMMY_SP}; +use crate::rustc_data_structures::thin_vec::ThinVec; use crate::utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq, get_trait_def_id, implements_trait}; /// **What it does:** Checks for boolean expressions that can be written more diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index ddc017c27df..7ec556b5d78 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -1,9 +1,9 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use syntax::ast::{Name, UintTy}; +use crate::rustc::ty; +use crate::syntax::ast::{Name, UintTy}; use crate::utils::{contains_name, get_pat_name, match_type, paths, single_segment_path, snippet, span_lint_and_sugg, walk_ptrs_ty}; diff --git a/clippy_lints/src/collapsible_if.rs b/clippy_lints/src/collapsible_if.rs index 55cc94f399f..a24436991e5 100644 --- a/clippy_lints/src/collapsible_if.rs +++ b/clippy_lints/src/collapsible_if.rs @@ -12,10 +12,10 @@ //! //! This lint is **warn** by default -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast; +use crate::syntax::ast; use crate::utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then}; use crate::utils::sugg::Sugg; diff --git a/clippy_lints/src/const_static_lifetime.rs b/clippy_lints/src/const_static_lifetime.rs index 83dd4c0509e..6daddb5fe13 100644 --- a/clippy_lints/src/const_static_lifetime.rs +++ b/clippy_lints/src/const_static_lifetime.rs @@ -1,6 +1,6 @@ -use syntax::ast::*; -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use crate::utils::{in_macro, snippet, span_lint_and_then}; /// **What it does:** Checks for constants with an explicit `'static` lifetime. diff --git a/clippy_lints/src/consts.rs b/clippy_lints/src/consts.rs index bcc85c31376..43796004d0e 100644 --- a/clippy_lints/src/consts.rs +++ b/clippy_lints/src/consts.rs @@ -1,18 +1,18 @@ #![allow(clippy::float_cmp)] -use rustc::lint::LateContext; -use rustc::{span_bug, bug}; -use rustc::hir::def::Def; -use rustc::hir::*; -use rustc::ty::{self, Ty, TyCtxt, Instance}; -use rustc::ty::subst::{Subst, Substs}; +use crate::rustc::lint::LateContext; +use crate::rustc::{span_bug, bug}; +use crate::rustc::hir::def::Def; +use crate::rustc::hir::*; +use crate::rustc::ty::{self, Ty, TyCtxt, Instance}; +use crate::rustc::ty::subst::{Subst, Substs}; use std::cmp::Ordering::{self, Equal}; use std::cmp::PartialOrd; use std::hash::{Hash, Hasher}; use std::mem; use std::rc::Rc; -use syntax::ast::{FloatTy, LitKind}; -use syntax::ptr::P; +use crate::syntax::ast::{FloatTy, LitKind}; +use crate::syntax::ptr::P; use crate::utils::{sext, unsext, clip}; /// A `LitKind`-like enum to fold constant `Expr`s into. @@ -139,7 +139,7 @@ impl Constant { /// parse a `LitKind` to a `Constant` pub fn lit_to_constant<'tcx>(lit: &LitKind, ty: Ty<'tcx>) -> Constant { - use syntax::ast::*; + use crate::syntax::ast::*; match *lit { LitKind::Str(ref is, _) => Constant::Str(is.to_string()), @@ -279,7 +279,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { instance, promoted: None, }; - use rustc::mir::interpret::GlobalId; + use crate::rustc::mir::interpret::GlobalId; let result = self.tcx.const_eval(self.param_env.and(gid)).ok()?; let ret = miri_to_const(self.tcx, result); if ret.is_some() { @@ -409,7 +409,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> { } pub fn miri_to_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result: &ty::Const<'tcx>) -> Option { - use rustc::mir::interpret::{Scalar, ScalarMaybeUndef, ConstValue}; + use crate::rustc::mir::interpret::{Scalar, ScalarMaybeUndef, ConstValue}; match result.val { ConstValue::Scalar(Scalar::Bits{ bits: b, ..}) => match result.ty.sty { ty::Bool => Some(Constant::Bool(b == 1)), diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 01063d41ee8..76c8360be62 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -1,12 +1,12 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty::Ty; -use rustc::hir::*; -use rustc_data_structures::fx::FxHashMap; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty::Ty; +use crate::rustc::hir::*; +use crate::rustc_data_structures::fx::FxHashMap; use std::collections::hash_map::Entry; use std::hash::BuildHasherDefault; -use syntax::symbol::LocalInternedString; -use rustc_data_structures::small_vec::OneVector; +use crate::syntax::symbol::LocalInternedString; +use crate::rustc_data_structures::small_vec::OneVector; use crate::utils::{SpanlessEq, SpanlessHash}; use crate::utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint}; diff --git a/clippy_lints/src/copy_iterator.rs b/clippy_lints/src/copy_iterator.rs index 596e83bc539..17f32c7bb45 100644 --- a/clippy_lints/src/copy_iterator.rs +++ b/clippy_lints/src/copy_iterator.rs @@ -1,7 +1,7 @@ use crate::utils::{is_copy, match_path, paths, span_note_and_lint}; -use rustc::hir::{Item, ItemKind}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::{Item, ItemKind}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; /// **What it does:** Checks for types that implement `Copy` as well as /// `Iterator`. diff --git a/clippy_lints/src/cyclomatic_complexity.rs b/clippy_lints/src/cyclomatic_complexity.rs index c975e31cec9..db85a3f3fda 100644 --- a/clippy_lints/src/cyclomatic_complexity.rs +++ b/clippy_lints/src/cyclomatic_complexity.rs @@ -1,13 +1,13 @@ //! calculate cyclomatic complexity and warn about overly complex functions -use rustc::cfg::CFG; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::ty; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use syntax::ast::{Attribute, NodeId}; -use syntax::source_map::Span; +use crate::rustc::cfg::CFG; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::ty; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::syntax::ast::{Attribute, NodeId}; +use crate::syntax::source_map::Span; use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack}; diff --git a/clippy_lints/src/default_trait_access.rs b/clippy_lints/src/default_trait_access.rs index e7c90f04188..5f2b1a29dc7 100644 --- a/clippy_lints/src/default_trait_access.rs +++ b/clippy_lints/src/default_trait_access.rs @@ -1,8 +1,8 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::TyKind; +use crate::rustc::ty::TyKind; use crate::utils::{any_parent_is_automatically_derived, match_def_path, opt_def_id, paths, span_lint_and_sugg}; diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index 2a26cca21ac..21365f60586 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -1,9 +1,9 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; -use rustc::hir::*; -use syntax::source_map::Span; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::hir::*; +use crate::syntax::source_map::Span; use crate::utils::paths; use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then}; diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index 4d603570ebe..19f2916cc5e 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -1,10 +1,10 @@ use itertools::Itertools; use pulldown_cmark; -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast; -use syntax::source_map::{BytePos, Span}; -use syntax_pos::Pos; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast; +use crate::syntax::source_map::{BytePos, Span}; +use crate::syntax_pos::Pos; use crate::utils::span_lint; use url::Url; diff --git a/clippy_lints/src/double_comparison.rs b/clippy_lints/src/double_comparison.rs index 1f38be4d7b7..c692bffaff6 100644 --- a/clippy_lints/src/double_comparison.rs +++ b/clippy_lints/src/double_comparison.rs @@ -1,9 +1,9 @@ //! Lint on unnecessary double comparisons. Some examples: -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::source_map::Span; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::source_map::Span; use crate::utils::{snippet, span_lint_and_sugg, SpanlessEq}; diff --git a/clippy_lints/src/double_parens.rs b/clippy_lints/src/double_parens.rs index 42d6720d96c..90aaea90d96 100644 --- a/clippy_lints/src/double_parens.rs +++ b/clippy_lints/src/double_parens.rs @@ -1,6 +1,6 @@ -use syntax::ast::*; -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; /// **What it does:** Checks for unnecessary double parentheses. /// diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index be804780ff5..1dbca5ed9ba 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -1,8 +1,8 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use rustc::hir::*; +use crate::rustc::ty; +use crate::rustc::hir::*; use crate::utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint}; /// **What it does:** Checks for calls to `std::mem::drop` with a reference diff --git a/clippy_lints/src/duration_subsec.rs b/clippy_lints/src/duration_subsec.rs index 5853983dcf0..8ac34d9daa3 100644 --- a/clippy_lints/src/duration_subsec.rs +++ b/clippy_lints/src/duration_subsec.rs @@ -1,8 +1,8 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::source_map::Spanned; +use crate::syntax::source_map::Spanned; use crate::consts::{constant, Constant}; use crate::utils::paths; diff --git a/clippy_lints/src/else_if_without_else.rs b/clippy_lints/src/else_if_without_else.rs index 1c026713a5d..21a77e2263f 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::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; use crate::utils::span_lint_and_sugg; diff --git a/clippy_lints/src/empty_enum.rs b/clippy_lints/src/empty_enum.rs index 195a78a89e5..48c96a0ffad 100644 --- a/clippy_lints/src/empty_enum.rs +++ b/clippy_lints/src/empty_enum.rs @@ -1,8 +1,8 @@ //! lint when there is an enum with no variants -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; use crate::utils::span_lint_and_then; /// **What it does:** Checks for `enum`s with no variants. diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 8a2fcbaea46..167f5633b2e 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -1,9 +1,9 @@ -use rustc::hir::*; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::source_map::Span; +use crate::syntax::source_map::Span; use crate::utils::SpanlessEq; use crate::utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty}; diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index 0271fee8a3c..b49322dcaf9 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -1,16 +1,16 @@ //! lint on C-like enums that are `repr(isize/usize)` and have values that //! don't fit into an `i32` -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::ty; -use rustc::ty::subst::Substs; -use syntax::ast::{IntTy, UintTy}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::ty; +use crate::rustc::ty::subst::Substs; +use crate::syntax::ast::{IntTy, UintTy}; use crate::utils::span_lint; use crate::consts::{Constant, miri_to_const}; -use rustc::ty::util::IntTypeExt; -use rustc::mir::interpret::GlobalId; +use crate::rustc::ty::util::IntTypeExt; +use crate::rustc::mir::interpret::GlobalId; /// **What it does:** Checks for C-like enumerations that are /// `repr(isize/usize)` and have values that don't fit into an `i32`. diff --git a/clippy_lints/src/enum_glob_use.rs b/clippy_lints/src/enum_glob_use.rs index 042a4765e2b..d594406decf 100644 --- a/clippy_lints/src/enum_glob_use.rs +++ b/clippy_lints/src/enum_glob_use.rs @@ -1,11 +1,11 @@ //! lint on `use`ing all variants of an enum -use rustc::hir::*; -use rustc::hir::def::Def; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::NodeId; -use syntax::source_map::Span; +use crate::rustc::hir::*; +use crate::rustc::hir::def::Def; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::NodeId; +use crate::syntax::source_map::Span; use crate::utils::span_lint; /// **What it does:** Checks for `use Enum::*`. diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index 56b99aa9449..c68439d161b 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -1,10 +1,10 @@ //! lint on enum variants that are prefixed or suffixed by the same characters -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, Lint}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; -use syntax::source_map::Span; -use syntax::symbol::LocalInternedString; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, Lint}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; +use crate::syntax::source_map::Span; +use crate::syntax::symbol::LocalInternedString; use crate::utils::{span_help_and_lint, span_lint}; use crate::utils::{camel_case_from, camel_case_until, in_macro}; diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs index b6b34204480..d182faa1e5c 100644 --- a/clippy_lints/src/eq_op.rs +++ b/clippy_lints/src/eq_op.rs @@ -1,6 +1,6 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use crate::utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq}; /// **What it does:** Checks for equal operands to comparison, logical and diff --git a/clippy_lints/src/erasing_op.rs b/clippy_lints/src/erasing_op.rs index 5b61a9fd883..7e313daffa4 100644 --- a/clippy_lints/src/erasing_op.rs +++ b/clippy_lints/src/erasing_op.rs @@ -1,8 +1,8 @@ use crate::consts::{constant_simple, Constant}; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::source_map::Span; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::source_map::Span; use crate::utils::{in_macro, span_lint}; /// **What it does:** Checks for erasing operations, e.g. `x * 0`. diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index 282149f81f9..8af232420b1 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -1,14 +1,14 @@ -use rustc::hir::*; -use rustc::hir::intravisit as visit; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::middle::expr_use_visitor::*; -use rustc::middle::mem_categorization::{cmt_, Categorization}; -use rustc::ty::{self, Ty}; -use rustc::ty::layout::LayoutOf; -use rustc::util::nodemap::NodeSet; -use syntax::ast::NodeId; -use syntax::source_map::Span; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit as visit; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::middle::expr_use_visitor::*; +use crate::rustc::middle::mem_categorization::{cmt_, Categorization}; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::ty::layout::LayoutOf; +use crate::rustc::util::nodemap::NodeSet; +use crate::syntax::ast::NodeId; +use crate::syntax::source_map::Span; use crate::utils::span_lint; pub struct Pass { diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index c4ffc70dbfd..e331f6adf3a 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; +use crate::rustc::hir::*; use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then}; #[allow(missing_copy_implementations)] diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index e3ae5607645..068d6fb135f 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -1,10 +1,10 @@ -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc::hir::*; -use rustc::ty; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::rustc::hir::*; +use crate::rustc::ty; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast; +use crate::syntax::ast; use crate::utils::{get_parent_expr, span_lint, span_note_and_lint}; /// **What it does:** Checks for a read and a write to the same variable where diff --git a/clippy_lints/src/excessive_precision.rs b/clippy_lints/src/excessive_precision.rs index e5809371e83..6df88cdc6c3 100644 --- a/clippy_lints/src/excessive_precision.rs +++ b/clippy_lints/src/excessive_precision.rs @@ -1,13 +1,13 @@ -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::TyKind; +use crate::rustc::ty::TyKind; use std::f32; use std::f64; use std::fmt; -use syntax::ast::*; -use syntax_pos::symbol::Symbol; +use crate::syntax::ast::*; +use crate::syntax_pos::symbol::Symbol; use crate::utils::span_lint_and_sugg; /// **What it does:** Checks for float literals with a precision greater diff --git a/clippy_lints/src/explicit_write.rs b/clippy_lints/src/explicit_write.rs index 77c6c1a4ad7..888dca97928 100644 --- a/clippy_lints/src/explicit_write.rs +++ b/clippy_lints/src/explicit_write.rs @@ -1,6 +1,6 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; use crate::utils::{is_expn_of, match_def_path, resolve_node, span_lint}; use crate::utils::opt_def_id; diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs index 88eb880311e..146e2366552 100644 --- a/clippy_lints/src/fallible_impl_from.rs +++ b/clippy_lints/src/fallible_impl_from.rs @@ -1,9 +1,9 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir; -use rustc::ty; -use syntax_pos::Span; +use crate::rustc::hir; +use crate::rustc::ty; +use crate::syntax_pos::Span; use crate::utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of, opt_def_id}; use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT}; @@ -52,8 +52,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom { } fn lint_impl_body<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, impl_span: Span, impl_items: &hir::HirVec) { - use rustc::hir::*; - use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; + use crate::rustc::hir::*; + use crate::rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; struct FindPanicUnwrap<'a, 'tcx: 'a> { tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index c10d554660a..fbc3c750cde 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -1,10 +1,10 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use syntax::ast::LitKind; -use syntax_pos::Span; +use crate::rustc::ty; +use crate::syntax::ast::LitKind; +use crate::syntax_pos::Span; use crate::utils::paths; use crate::utils::{in_macro, is_expn_of, last_path_segment, match_def_path, match_type, opt_def_id, resolve_node, snippet, span_lint_and_then, walk_ptrs_ty}; diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index 8b20aeed108..92950706d88 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -1,8 +1,8 @@ -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast; use crate::utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint}; -use syntax::ptr::P; +use crate::syntax::ptr::P; /// **What it does:** Checks for use of the non-existent `=*`, `=!` and `=-` /// operators. diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index ec9aa7a4fd3..d73c0710ba1 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -1,14 +1,14 @@ use matches::matches; -use rustc::hir::intravisit; -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; -use rustc::hir::def::Def; -use rustc_data_structures::fx::FxHashSet; -use syntax::ast; -use rustc_target::spec::abi::Abi; -use syntax::source_map::Span; +use crate::rustc::hir::intravisit; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; +use crate::rustc::hir::def::Def; +use crate::rustc_data_structures::fx::FxHashSet; +use crate::syntax::ast; +use crate::rustc_target::spec::abi::Abi; +use crate::syntax::source_map::Span; use crate::utils::{iter_input_pats, span_lint, type_is_unsafe_function}; /// **What it does:** Checks for functions with too many parameters. diff --git a/clippy_lints/src/identity_conversion.rs b/clippy_lints/src/identity_conversion.rs index 6adf2cd6814..24b0d57d098 100644 --- a/clippy_lints/src/identity_conversion.rs +++ b/clippy_lints/src/identity_conversion.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use syntax::ast::NodeId; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::syntax::ast::NodeId; use crate::utils::{in_macro, match_def_path, match_trait_method, same_tys, snippet, span_lint_and_then}; use crate::utils::{opt_def_id, paths, resolve_node}; diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index 052275d7a45..836e4fafba4 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -1,10 +1,10 @@ use crate::consts::{constant_simple, Constant}; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::source_map::Span; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::source_map::Span; use crate::utils::{in_macro, snippet, span_lint, unsext, clip}; -use rustc::ty; +use crate::rustc::ty; /// **What it does:** Checks for identity operations, e.g. `x + 0`. /// diff --git a/clippy_lints/src/if_let_redundant_pattern_matching.rs b/clippy_lints/src/if_let_redundant_pattern_matching.rs index 253d295567c..c996c91b48b 100644 --- a/clippy_lints/src/if_let_redundant_pattern_matching.rs +++ b/clippy_lints/src/if_let_redundant_pattern_matching.rs @@ -1,6 +1,6 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; use crate::utils::{match_qpath, paths, snippet, span_lint_and_then}; /// **What it does:** Lint for redundant pattern matching over `Result` or diff --git a/clippy_lints/src/if_not_else.rs b/clippy_lints/src/if_not_else.rs index 3bfde1fd20d..954f8543a87 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::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; use crate::utils::span_help_and_lint; diff --git a/clippy_lints/src/indexing_slicing.rs b/clippy_lints/src/indexing_slicing.rs index bca4844aae7..1010b53e09a 100644 --- a/clippy_lints/src/indexing_slicing.rs +++ b/clippy_lints/src/indexing_slicing.rs @@ -4,11 +4,11 @@ use crate::consts::{constant, Constant}; use crate::utils; use crate::utils::higher; use crate::utils::higher::Range; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; -use syntax::ast::RangeLimits; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; +use crate::syntax::ast::RangeLimits; /// **What it does:** Checks for out of bounds array indexing with a constant /// index. diff --git a/clippy_lints/src/infallible_destructuring_match.rs b/clippy_lints/src/infallible_destructuring_match.rs index 208f2ec5379..dabc167f37d 100644 --- a/clippy_lints/src/infallible_destructuring_match.rs +++ b/clippy_lints/src/infallible_destructuring_match.rs @@ -1,7 +1,7 @@ use super::utils::{get_arg_name, match_var, remove_blocks, snippet, span_lint_and_sugg}; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; /// **What it does:** Checks for matches being used to destructure a single-variant enum diff --git a/clippy_lints/src/infinite_iter.rs b/clippy_lints/src/infinite_iter.rs index bb33c48fc3f..a15ec8c14bd 100644 --- a/clippy_lints/src/infinite_iter.rs +++ b/clippy_lints/src/infinite_iter.rs @@ -1,6 +1,6 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use crate::utils::{get_trait_def_id, higher, implements_trait, match_qpath, paths, span_lint}; /// **What it does:** Checks for iteration that is guaranteed to be infinite. diff --git a/clippy_lints/src/inherent_impl.rs b/clippy_lints/src/inherent_impl.rs index 9c4a6bfcb8e..36336b86398 100644 --- a/clippy_lints/src/inherent_impl.rs +++ b/clippy_lints/src/inherent_impl.rs @@ -1,11 +1,11 @@ //! lint on inherent implementations -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc_data_structures::fx::FxHashMap; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc_data_structures::fx::FxHashMap; use std::default::Default; -use syntax_pos::Span; +use crate::syntax_pos::Span; use crate::utils::span_lint_and_then; /// **What it does:** Checks for multiple inherent implementations of a struct diff --git a/clippy_lints/src/inline_fn_without_body.rs b/clippy_lints/src/inline_fn_without_body.rs index 4dcc4ed473d..29492cf8c43 100644 --- a/clippy_lints/src/inline_fn_without_body.rs +++ b/clippy_lints/src/inline_fn_without_body.rs @@ -1,9 +1,9 @@ //! checks for `#[inline]` on trait methods without bodies -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use syntax::ast::{Attribute, Name}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::syntax::ast::{Attribute, Name}; use crate::utils::span_lint_and_then; use crate::utils::sugg::DiagnosticBuilderExt; diff --git a/clippy_lints/src/int_plus_one.rs b/clippy_lints/src/int_plus_one.rs index f94461b75a5..023a88e1ffa 100644 --- a/clippy_lints/src/int_plus_one.rs +++ b/clippy_lints/src/int_plus_one.rs @@ -1,8 +1,8 @@ //! lint on blocks unnecessarily using >= with a + 1 or - 1 -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; use crate::utils::{snippet_opt, span_lint_and_then}; diff --git a/clippy_lints/src/invalid_ref.rs b/clippy_lints/src/invalid_ref.rs index 34a8939e104..55de8998378 100644 --- a/clippy_lints/src/invalid_ref.rs +++ b/clippy_lints/src/invalid_ref.rs @@ -1,8 +1,8 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use rustc::hir::*; +use crate::rustc::ty; +use crate::rustc::hir::*; use crate::utils::{match_def_path, opt_def_id, paths, span_help_and_lint}; /// **What it does:** Checks for creation of references to zeroed or uninitialized memory. diff --git a/clippy_lints/src/items_after_statements.rs b/clippy_lints/src/items_after_statements.rs index 9fe70882c86..a12c9c400ba 100644 --- a/clippy_lints/src/items_after_statements.rs +++ b/clippy_lints/src/items_after_statements.rs @@ -1,9 +1,9 @@ //! lint when items are used after statements use matches::matches; -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; use crate::utils::{in_macro, span_lint}; /// **What it does:** Checks for items declared after some statement in a block. diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 63201bb2e45..87f9804c1ae 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 rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; use crate::utils::{snippet_opt, span_lint_and_then}; -use rustc::ty::layout::LayoutOf; +use crate::rustc::ty::layout::LayoutOf; /// **What it does:** Checks for large size differences between variants on /// `enum`s. diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index a31add18a94..b126b8dbb93 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -1,11 +1,11 @@ -use rustc::hir::def_id::DefId; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; -use rustc_data_structures::fx::FxHashSet; -use syntax::ast::{Lit, LitKind, Name}; -use syntax::source_map::{Span, Spanned}; +use crate::rustc::hir::def_id::DefId; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; +use crate::rustc_data_structures::fx::FxHashSet; +use crate::syntax::ast::{Lit, LitKind, Name}; +use crate::syntax::source_map::{Span, Spanned}; use crate::utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, walk_ptrs_ty}; /// **What it does:** Checks for getting the length of something via `.len()` @@ -127,7 +127,7 @@ fn check_trait_items(cx: &LateContext<'_, '_>, visited_trait: &Item, trait_items // fill the set with current and super traits fn fill_trait_set(traitt: DefId, set: &mut FxHashSet, cx: &LateContext<'_, '_>) { if set.insert(traitt) { - for supertrait in ::rustc::traits::supertrait_def_ids(cx.tcx, traitt) { + for supertrait in crate::rustc::traits::supertrait_def_ids(cx.tcx, traitt) { fill_trait_set(supertrait, set, cx); } } diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index 8b4e2b0dec8..10dc3cae8af 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -1,10 +1,10 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir; -use rustc::hir::BindingAnnotation; -use rustc::hir::def::Def; -use syntax::ast; +use crate::rustc::hir; +use crate::rustc::hir::BindingAnnotation; +use crate::rustc::hir::def::Def; +use crate::syntax::ast; use crate::utils::{snippet, span_lint_and_then}; /// **What it does:** Checks for variable declarations immediately followed by a diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 5f001901481..3937e5cb9e9 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -12,10 +12,28 @@ #![warn(rust_2018_idioms, trivial_casts, trivial_numeric_casts)] #![feature(crate_visibility_modifier)] -use toml; -use rustc_plugin; -use rustc; +// FIXME: switch to something more ergonomic here, once available. +// (currently there is no way to opt into sysroot crates w/o `extern crate`) +#[allow(unused_extern_crates)] +extern crate fmt_macros; +#[allow(unused_extern_crates)] +extern crate rustc; +#[allow(unused_extern_crates)] +extern crate rustc_data_structures; +#[allow(unused_extern_crates)] +extern crate rustc_errors; +#[allow(unused_extern_crates)] +extern crate rustc_plugin; +#[allow(unused_extern_crates)] +extern crate rustc_target; +#[allow(unused_extern_crates)] +extern crate rustc_typeck; +#[allow(unused_extern_crates)] +extern crate syntax; +#[allow(unused_extern_crates)] +extern crate syntax_pos; +use toml; macro_rules! declare_clippy_lint { { pub $name:tt, style, $description:tt } => { @@ -175,7 +193,7 @@ pub mod zero_div_zero; pub use crate::utils::conf::Conf; mod reexport { - crate use syntax::ast::{Name, NodeId}; + crate use crate::syntax::ast::{Name, NodeId}; } pub fn register_pre_expansion_lints(session: &rustc::session::Session, store: &mut rustc::lint::LintStore, conf: &Conf) { diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 5b04b829453..ee8517b76d7 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -1,14 +1,14 @@ use crate::reexport::*; use matches::matches; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::def::Def; -use rustc::hir::*; -use rustc::hir::intravisit::*; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use syntax::source_map::Span; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::def::Def; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::*; +use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use crate::syntax::source_map::Span; use crate::utils::{last_path_segment, span_lint}; -use syntax::symbol::keywords; +use crate::syntax::symbol::keywords; /// **What it does:** Checks for lifetime annotations which can be removed by /// relying on lifetime elision. diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index 304721886cc..188ca157423 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -1,11 +1,11 @@ //! Lints concerned with the grouping of digits with underscores in integral or //! floating-point literal expressions. -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast::*; -use syntax_pos; +use crate::syntax::ast::*; +use crate::syntax_pos; use crate::utils::{snippet_opt, span_lint_and_sugg}; /// **What it does:** Warns if a long integral or floating-point constant does diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 7240819646f..7472700ddbc 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1,25 +1,25 @@ use itertools::Itertools; use crate::reexport::*; -use rustc::hir::*; -use rustc::hir::def::Def; -use rustc::hir::def_id; -use rustc::hir::intravisit::{walk_block, walk_decl, walk_expr, walk_pat, walk_stmt, NestedVisitorMap, Visitor}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::def::Def; +use crate::rustc::hir::def_id; +use crate::rustc::hir::intravisit::{walk_block, walk_decl, walk_expr, walk_pat, walk_stmt, NestedVisitorMap, Visitor}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::middle::region; -// use rustc::middle::region::CodeExtent; -use rustc::middle::expr_use_visitor::*; -use rustc::middle::mem_categorization::Categorization; -use rustc::middle::mem_categorization::cmt_; -use rustc::ty::{self, Ty}; -use rustc::ty::subst::Subst; -use rustc_errors::Applicability; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use crate::rustc::middle::region; +// use crate::rustc::middle::region::CodeExtent; +use crate::rustc::middle::expr_use_visitor::*; +use crate::rustc::middle::mem_categorization::Categorization; +use crate::rustc::middle::mem_categorization::cmt_; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::ty::subst::Subst; +use crate::rustc_errors::Applicability; +use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet}; use std::iter::{once, Iterator}; -use syntax::ast; -use syntax::source_map::Span; -use syntax_pos::BytePos; +use crate::syntax::ast; +use crate::syntax::source_map::Span; +use crate::syntax_pos::BytePos; use crate::utils::{sugg, sext}; use crate::utils::usage::mutated_variables; use crate::consts::{constant, Constant}; diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index 1a501b39eb5..239602c6db5 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -1,9 +1,9 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; -use rustc::ty; -use syntax::ast; +use crate::rustc::hir::*; +use crate::rustc::ty; +use crate::syntax::ast; use crate::utils::{get_arg_ident, is_adjusted, iter_input_pats, match_qpath, match_trait_method, match_type, paths, remove_blocks, snippet, span_help_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq}; diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index 90f149a1c01..096ef46555d 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -1,10 +1,10 @@ -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use rustc_errors::Applicability; -use syntax::source_map::Span; +use crate::rustc::ty; +use crate::rustc_errors::Applicability; +use crate::syntax::source_map::Span; use crate::utils::{in_macro, iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then}; use crate::utils::paths; diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 3ecf5d3b5b8..a4c2681e359 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -1,12 +1,12 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; +use crate::rustc::ty::{self, Ty}; use std::cmp::Ordering; use std::collections::Bound; -use syntax::ast::LitKind; -use syntax::source_map::Span; +use crate::syntax::ast::LitKind; +use crate::syntax::source_map::Span; use crate::utils::paths; use crate::utils::{expr_block, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg, remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty}; diff --git a/clippy_lints/src/mem_forget.rs b/clippy_lints/src/mem_forget.rs index 8a56dccad2d..7a07ecbf02c 100644 --- a/clippy_lints/src/mem_forget.rs +++ b/clippy_lints/src/mem_forget.rs @@ -1,6 +1,6 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::{Expr, ExprKind}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::{Expr, ExprKind}; use crate::utils::{match_def_path, opt_def_id, paths, span_lint}; /// **What it does:** Checks for usage of `std::mem::forget(t)` where `t` is diff --git a/clippy_lints/src/methods.rs b/clippy_lints/src/methods.rs index 3d458343a50..1e03503d313 100644 --- a/clippy_lints/src/methods.rs +++ b/clippy_lints/src/methods.rs @@ -1,15 +1,15 @@ use matches::matches; -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, Lint, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, Lint, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; -use rustc::hir::def::Def; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::hir::def::Def; use std::borrow::Cow; use std::fmt; use std::iter; -use syntax::ast; -use syntax::source_map::{Span, BytePos}; +use crate::syntax::ast; +use crate::syntax::source_map::{Span, BytePos}; use crate::utils::{get_arg_name, get_trait_def_id, implements_trait, in_macro, is_copy, is_expn_of, is_self, is_self_ty, iter_input_pats, last_path_segment, match_def_path, match_path, match_qpath, match_trait_method, match_type, method_chain_args, match_var, return_ty, remove_blocks, same_tys, single_segment_path, snippet, diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs index bbbc022f08d..293d301ebb4 100644 --- a/clippy_lints/src/minmax.rs +++ b/clippy_lints/src/minmax.rs @@ -1,8 +1,8 @@ use crate::consts::{constant_simple, Constant}; use crate::utils::{match_def_path, opt_def_id, paths, span_lint}; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use std::cmp::Ordering; /// **What it does:** Checks for expressions where `std::cmp::min` and `max` are diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 302af13630b..f52d3ccf5a4 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -1,17 +1,17 @@ use crate::reexport::*; use matches::matches; -use rustc::hir::*; -use rustc::hir::intravisit::FnKind; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::FnKind; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use syntax::source_map::{ExpnFormat, Span}; +use crate::rustc::ty; +use crate::syntax::source_map::{ExpnFormat, Span}; use crate::utils::{get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal, iter_input_pats, last_path_segment, match_qpath, match_trait_method, paths, snippet, span_lint, span_lint_and_then, walk_ptrs_ty, SpanlessEq}; use crate::utils::sugg::Sugg; -use syntax::ast::{LitKind, CRATE_NODE_ID}; +use crate::syntax::ast::{LitKind, CRATE_NODE_ID}; use crate::consts::{constant, Constant}; /// **What it does:** Checks for function arguments and let bindings denoted as diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index 35a232f7f32..5a509802b61 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -1,11 +1,11 @@ -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, LintContext, in_external_macro}; -use rustc::{declare_tool_lint, lint_array}; -use rustc_data_structures::fx::FxHashMap; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, LintContext, in_external_macro}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc_data_structures::fx::FxHashMap; use if_chain::if_chain; use std::char; -use syntax::ast::*; -use syntax::source_map::Span; -use syntax::visit::FnKind; +use crate::syntax::ast::*; +use crate::syntax::source_map::Span; +use crate::syntax::visit::FnKind; use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then}; /// **What it does:** Checks for structure field patterns bound to wildcards. diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index f56a8fcd8b5..685f701ef8b 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -18,13 +18,13 @@ // [`missing_doc`]: https://github.com/rust-lang/rust/blob/d6d05904697d89099b55da3331155392f1db9c00/src/librustc_lint/builtin.rs#L246 // -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; -use syntax::ast; -use syntax::attr; -use syntax::source_map::Span; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; +use crate::syntax::ast; +use crate::syntax::attr; +use crate::syntax::source_map::Span; use crate::utils::{span_lint, in_macro}; /// **What it does:** Warns if there is missing doc for any documentable item diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index bf88caa6ab9..dea3a81e50d 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -9,11 +9,11 @@ // except according to those terms. // -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast; -use syntax::source_map::Span; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast; +use crate::syntax::source_map::Span; use crate::utils::span_lint; /// **What it does:** it lints if an exported function, method, trait method with default impl, @@ -85,7 +85,7 @@ fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, } fn is_executable<'a, 'tcx>(cx: &LateContext<'a, 'tcx>) -> bool { - use rustc::session::config::CrateType; + use crate::rustc::session::config::CrateType; cx.tcx.sess.crate_types.get().iter().any(|t: &CrateType| { match t { @@ -155,7 +155,7 @@ 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::{TraitContainer, ImplContainer}; + use crate::rustc::ty::{TraitContainer, ImplContainer}; if is_executable(cx) { return; } diff --git a/clippy_lints/src/multiple_crate_versions.rs b/clippy_lints/src/multiple_crate_versions.rs index a2ed6a1dea1..2f6b08c5151 100644 --- a/clippy_lints/src/multiple_crate_versions.rs +++ b/clippy_lints/src/multiple_crate_versions.rs @@ -1,8 +1,8 @@ //! lint on multiple versions of a crate being used -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; use crate::utils::span_lint; use cargo_metadata; diff --git a/clippy_lints/src/mut_mut.rs b/clippy_lints/src/mut_mut.rs index ea3d68dfc83..b3607d623b3 100644 --- a/clippy_lints/src/mut_mut.rs +++ b/clippy_lints/src/mut_mut.rs @@ -1,8 +1,8 @@ -use rustc::hir; -use rustc::hir::intravisit; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; +use crate::rustc::hir; +use crate::rustc::hir::intravisit; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; use crate::utils::{higher, span_lint}; /// **What it does:** Checks for instances of `mut mut` references. @@ -38,7 +38,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutMut { } fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ty: &'tcx hir::Ty) { - use rustc::hir::intravisit::Visitor; + use crate::rustc::hir::intravisit::Visitor; MutVisitor { cx }.visit_ty(ty); } diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index 97287aa833f..1bf06b9e20a 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -1,8 +1,8 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty::{self, Ty}; -use rustc::ty::subst::Subst; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::ty::subst::Subst; +use crate::rustc::hir::*; use crate::utils::span_lint; /// **What it does:** Detects giving a mutable reference to a function that only diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs index cb400ee4ee3..f6caddab485 100644 --- a/clippy_lints/src/mutex_atomic.rs +++ b/clippy_lints/src/mutex_atomic.rs @@ -2,11 +2,11 @@ //! //! This lint is **warn** by default -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty::{self, Ty}; -use rustc::hir::Expr; -use syntax::ast; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::hir::Expr; +use crate::syntax::ast; use crate::utils::{match_type, paths, span_lint}; /// **What it does:** Checks for usages of `Mutex` where an atomic will do. diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index 5b9a479c1fc..74b6647551a 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -2,11 +2,11 @@ //! //! This lint is **warn** by default -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use syntax::ast::LitKind; -use syntax::source_map::Spanned; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::syntax::ast::LitKind; +use crate::syntax::source_map::Spanned; use crate::utils::{snippet, span_lint, span_lint_and_sugg}; use crate::utils::sugg::Sugg; diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index a194cb2c61b..ec53f76095f 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -2,12 +2,12 @@ //! //! This lint is **warn** by default -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::{BindingAnnotation, Expr, ExprKind, MutImmutable, Pat, PatKind}; -use rustc::ty; -use rustc::ty::adjustment::{Adjust, Adjustment}; +use crate::rustc::hir::{BindingAnnotation, Expr, ExprKind, MutImmutable, Pat, PatKind}; +use crate::rustc::ty; +use crate::rustc::ty::adjustment::{Adjust, Adjustment}; use crate::utils::{in_macro, snippet_opt, span_lint_and_then}; /// **What it does:** Checks for address of operations (`&`) that are going to diff --git a/clippy_lints/src/needless_borrowed_ref.rs b/clippy_lints/src/needless_borrowed_ref.rs index 4905dbc8e6b..2db9b9d165b 100644 --- a/clippy_lints/src/needless_borrowed_ref.rs +++ b/clippy_lints/src/needless_borrowed_ref.rs @@ -2,10 +2,10 @@ //! //! This lint is **warn** by default -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind}; +use crate::rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind}; use crate::utils::{in_macro, snippet, span_lint_and_then}; /// **What it does:** Checks for useless borrowed references. diff --git a/clippy_lints/src/needless_continue.rs b/clippy_lints/src/needless_continue.rs index e14cd0fea89..0f7ea34f18a 100644 --- a/clippy_lints/src/needless_continue.rs +++ b/clippy_lints/src/needless_continue.rs @@ -27,10 +27,10 @@ //! ``` //! //! This lint is **warn** by default. -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast; -use syntax::source_map::{original_sp, DUMMY_SP}; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast; +use crate::syntax::source_map::{original_sp, DUMMY_SP}; use std::borrow::Cow; use crate::utils::{in_macro, snippet, snippet_block, span_help_and_lint, trim_multiline}; diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 76eaf0dba24..eb4cbe22f30 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -1,18 +1,18 @@ use matches::matches; -use rustc::hir::*; -use rustc::hir::intravisit::FnKind; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::FnKind; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, RegionKind, TypeFoldable}; -use rustc::traits; -use rustc::middle::expr_use_visitor as euv; -use rustc::middle::mem_categorization as mc; -use rustc_target::spec::abi::Abi; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use syntax::ast::NodeId; -use syntax_pos::Span; -use syntax::errors::DiagnosticBuilder; +use crate::rustc::ty::{self, RegionKind, TypeFoldable}; +use crate::rustc::traits; +use crate::rustc::middle::expr_use_visitor as euv; +use crate::rustc::middle::mem_categorization as mc; +use crate::rustc_target::spec::abi::Abi; +use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use crate::syntax::ast::NodeId; +use crate::syntax_pos::Span; +use crate::syntax::errors::DiagnosticBuilder; use crate::utils::{get_trait_def_id, implements_trait, in_macro, is_copy, is_self, match_type, multispan_sugg, paths, snippet, snippet_opt, span_lint_and_then}; use crate::utils::ptr::get_spans; diff --git a/clippy_lints/src/needless_update.rs b/clippy_lints/src/needless_update.rs index dccb7f2e037..7c452bed0a3 100644 --- a/clippy_lints/src/needless_update.rs +++ b/clippy_lints/src/needless_update.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::ty; -use rustc::hir::{Expr, ExprKind}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::ty; +use crate::rustc::hir::{Expr, ExprKind}; use crate::utils::span_lint; /// **What it does:** Checks for needlessly including a base struct on update 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 db61ea375c3..08ad4dd43c9 100644 --- a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs +++ b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs @@ -1,6 +1,6 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; use crate::utils::{self, paths, span_lint}; diff --git a/clippy_lints/src/neg_multiply.rs b/clippy_lints/src/neg_multiply.rs index 93a83fe97ba..f39cfc8d122 100644 --- a/clippy_lints/src/neg_multiply.rs +++ b/clippy_lints/src/neg_multiply.rs @@ -1,8 +1,8 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::source_map::{Span, Spanned}; +use crate::syntax::source_map::{Span, Spanned}; use crate::consts::{self, Constant}; use crate::utils::span_lint; diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index 493e8d0f4ce..131f73b7c61 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -1,10 +1,10 @@ -use rustc::hir::def_id::DefId; -use rustc::hir; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::def_id::DefId; +use crate::rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; -use syntax::source_map::Span; +use crate::rustc::ty::{self, Ty}; +use crate::syntax::source_map::Span; use crate::utils::paths; use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_and_then}; use crate::utils::sugg::DiagnosticBuilderExt; diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 09a27330750..5ff0979670d 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::def::Def; -use rustc::hir::{BinOpKind, BlockCheckMode, Expr, ExprKind, Stmt, StmtKind, UnsafeSource}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::def::Def; +use crate::rustc::hir::{BinOpKind, BlockCheckMode, Expr, ExprKind, Stmt, StmtKind, UnsafeSource}; use crate::utils::{has_drop, in_macro, snippet_opt, span_lint, span_lint_and_sugg}; use std::ops::Deref; diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index deb088d3ea4..3b97e9d4a17 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -2,15 +2,15 @@ //! //! This lint is **deny** by default. -use rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::hir::def::Def; -use rustc::ty::{self, TypeFlags}; -use rustc::ty::adjustment::Adjust; -use rustc_errors::Applicability; -use rustc_typeck::hir_ty_to_ty; -use syntax_pos::{DUMMY_SP, Span}; +use crate::rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::def::Def; +use crate::rustc::ty::{self, TypeFlags}; +use crate::rustc::ty::adjustment::Adjust; +use crate::rustc_errors::Applicability; +use crate::rustc_typeck::hir_ty_to_ty; +use crate::syntax_pos::{DUMMY_SP, Span}; use std::ptr; use crate::utils::{in_constant, in_macro, is_copy, span_lint_and_then}; diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 5e106cac967..77642b4727c 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -1,10 +1,10 @@ -use rustc::lint::{LintArray, LintPass, EarlyContext, EarlyLintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::source_map::Span; -use syntax::symbol::LocalInternedString; -use syntax::ast::*; -use syntax::attr; -use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor}; +use crate::rustc::lint::{LintArray, LintPass, EarlyContext, EarlyLintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::source_map::Span; +use crate::syntax::symbol::LocalInternedString; +use crate::syntax::ast::*; +use crate::syntax::attr; +use crate::syntax::visit::{walk_block, walk_expr, walk_pat, Visitor}; use crate::utils::{span_lint, span_lint_and_then}; /// **What it does:** Checks for names that are very similar and thus confusing. diff --git a/clippy_lints/src/ok_if_let.rs b/clippy_lints/src/ok_if_let.rs index 651ed44110f..cd97e485342 100644 --- a/clippy_lints/src/ok_if_let.rs +++ b/clippy_lints/src/ok_if_let.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; +use crate::rustc::hir::*; use crate::utils::{match_type, method_chain_args, paths, snippet, span_help_and_lint}; /// **What it does:*** Checks for unnecessary `ok()` in if let. diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index b5459059e90..9133192549f 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -1,8 +1,8 @@ -use rustc::hir::{Expr, ExprKind}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::LitKind; -use syntax::source_map::{Span, Spanned}; +use crate::rustc::hir::{Expr, ExprKind}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::LitKind; +use crate::syntax::source_map::{Span, Spanned}; use crate::utils::{match_type, paths, span_lint, walk_ptrs_ty}; /// **What it does:** Checks for duplicate open options as well as combinations diff --git a/clippy_lints/src/overflow_check_conditional.rs b/clippy_lints/src/overflow_check_conditional.rs index d33ef5e05d6..bdd87ad3a25 100644 --- a/clippy_lints/src/overflow_check_conditional.rs +++ b/clippy_lints/src/overflow_check_conditional.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; +use crate::rustc::hir::*; use crate::utils::{span_lint, SpanlessEq}; /// **What it does:** Detects classic underflow/overflow checks. diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs index 7a7fa3c456d..404f43312e5 100644 --- a/clippy_lints/src/panic_unimplemented.rs +++ b/clippy_lints/src/panic_unimplemented.rs @@ -1,10 +1,10 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast::LitKind; -use syntax::ptr::P; -use syntax::ext::quote::rt::Span; +use crate::syntax::ast::LitKind; +use crate::syntax::ptr::P; +use crate::syntax::ext::quote::rt::Span; use crate::utils::{is_direct_expn_of, is_expn_of, match_def_path, opt_def_id, paths, resolve_node, span_lint}; /// **What it does:** Checks for missing parameters in `panic!`. diff --git a/clippy_lints/src/partialeq_ne_impl.rs b/clippy_lints/src/partialeq_ne_impl.rs index 8b2e5f9c356..7eb0c089726 100644 --- a/clippy_lints/src/partialeq_ne_impl.rs +++ b/clippy_lints/src/partialeq_ne_impl.rs @@ -1,7 +1,7 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; +use crate::rustc::hir::*; use crate::utils::{is_automatically_derived, span_lint}; /// **What it does:** Checks for manual re-implementations of `PartialEq::ne`. diff --git a/clippy_lints/src/precedence.rs b/clippy_lints/src/precedence.rs index 0978a6b7d94..e77a49266ba 100644 --- a/clippy_lints/src/precedence.rs +++ b/clippy_lints/src/precedence.rs @@ -1,7 +1,7 @@ -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; -use syntax::source_map::Spanned; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; +use crate::syntax::source_map::Spanned; use crate::utils::{in_macro, snippet, span_lint_and_sugg}; /// **What it does:** Checks for operations where precedence may be unclear @@ -121,7 +121,7 @@ fn is_arith_expr(expr: &Expr) -> bool { } fn is_bit_op(op: BinOpKind) -> bool { - use syntax::ast::BinOpKind::*; + use crate::syntax::ast::BinOpKind::*; match op { BitXor | BitAnd | BitOr | Shl | Shr => true, _ => false, @@ -129,7 +129,7 @@ fn is_bit_op(op: BinOpKind) -> bool { } fn is_arith_op(op: BinOpKind) -> bool { - use syntax::ast::BinOpKind::*; + use crate::syntax::ast::BinOpKind::*; match op { Add | Sub | Mul | Div | Rem => true, _ => false, diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 94bbfb0e5b9..1aefc84cb49 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -1,15 +1,15 @@ //! Checks for usage of `&Vec[_]` and `&String`. use std::borrow::Cow; -use rustc::hir::*; -use rustc::hir::QPath; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::QPath; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; -use syntax::ast::NodeId; -use syntax::source_map::Span; -use syntax_pos::MultiSpan; +use crate::rustc::ty; +use crate::syntax::ast::NodeId; +use crate::syntax::source_map::Span; +use crate::syntax_pos::MultiSpan; use crate::utils::{match_qpath, match_type, paths, snippet_opt, span_lint, span_lint_and_then, walk_ptrs_hir_ty}; use crate::utils::ptr::get_spans; diff --git a/clippy_lints/src/ptr_offset_with_cast.rs b/clippy_lints/src/ptr_offset_with_cast.rs index 250a11dab88..261e5cccbdd 100644 --- a/clippy_lints/src/ptr_offset_with_cast.rs +++ b/clippy_lints/src/ptr_offset_with_cast.rs @@ -1,4 +1,4 @@ -use rustc::{declare_tool_lint, hir, lint, lint_array}; +use crate::rustc::{declare_tool_lint, hir, lint, lint_array}; use crate::utils; use std::fmt; diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index 3134f14b194..93ea00cec77 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -1,10 +1,10 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; -use rustc::hir::def::Def; +use crate::rustc::hir::*; +use crate::rustc::hir::def::Def; use crate::utils::sugg::Sugg; -use syntax::ptr::P; +use crate::syntax::ptr::P; use crate::utils::{match_def_path, match_type, span_lint_and_then}; use crate::utils::paths::*; diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index f9cdffea79c..6616099eb9e 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -1,9 +1,9 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; -use syntax::ast::RangeLimits; -use syntax::source_map::Spanned; +use crate::rustc::hir::*; +use crate::syntax::ast::RangeLimits; +use crate::syntax::source_map::Spanned; use crate::utils::{is_integer_literal, paths, snippet, span_lint, span_lint_and_then, snippet_opt}; use crate::utils::{get_trait_def_id, higher, implements_trait, SpanlessEq}; use crate::utils::sugg::Sugg; diff --git a/clippy_lints/src/redundant_field_names.rs b/clippy_lints/src/redundant_field_names.rs index 579d2ad1423..38cb4578d9e 100644 --- a/clippy_lints/src/redundant_field_names.rs +++ b/clippy_lints/src/redundant_field_names.rs @@ -1,6 +1,6 @@ -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; use crate::utils::{span_lint_and_sugg}; /// **What it does:** Checks for fields in struct literals where shorthands diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs index 98de8989597..1faacc79df0 100644 --- a/clippy_lints/src/reference.rs +++ b/clippy_lints/src/reference.rs @@ -1,6 +1,6 @@ -use syntax::ast::{Expr, ExprKind, UnOp}; -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::{Expr, ExprKind, UnOp}; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; use crate::utils::{snippet, span_lint_and_sugg}; diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index b7409bfbc9f..41ff8a4bc0c 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -1,11 +1,11 @@ use regex_syntax; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc_data_structures::fx::FxHashSet; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc_data_structures::fx::FxHashSet; use if_chain::if_chain; -use syntax::ast::{LitKind, NodeId, StrStyle}; -use syntax::source_map::{BytePos, Span}; +use crate::syntax::ast::{LitKind, NodeId, StrStyle}; +use crate::syntax::source_map::{BytePos, Span}; use crate::utils::{is_expn_of, match_def_path, match_type, opt_def_id, paths, span_help_and_lint, span_lint}; use crate::consts::{constant, Constant}; diff --git a/clippy_lints/src/replace_consts.rs b/clippy_lints/src/replace_consts.rs index aaea8b6dd0e..05cca2ac338 100644 --- a/clippy_lints/src/replace_consts.rs +++ b/clippy_lints/src/replace_consts.rs @@ -1,8 +1,8 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir; -use rustc::hir::def::Def; +use crate::rustc::hir; +use crate::rustc::hir::def::Def; use crate::utils::{match_def_path, span_lint_and_sugg}; /// **What it does:** Checks for usage of `ATOMIC_X_INIT`, `ONCE_INIT`, and diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index ddc0a9719a8..4aed77f43e1 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -1,9 +1,9 @@ -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use syntax::ast; -use syntax::source_map::Span; -use syntax::visit::FnKind; +use crate::syntax::ast; +use crate::syntax::source_map::Span; +use crate::syntax::visit::FnKind; use crate::utils::{in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint}; diff --git a/clippy_lints/src/serde_api.rs b/clippy_lints/src/serde_api.rs index 0f09988c250..f2cfdf82d5b 100644 --- a/clippy_lints/src/serde_api.rs +++ b/clippy_lints/src/serde_api.rs @@ -1,6 +1,6 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; use crate::utils::{get_trait_def_id, paths, span_lint}; /// **What it does:** Checks for mis-uses of the serde API. diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index 1191723ba62..4a989353600 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -1,10 +1,10 @@ use crate::reexport::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::hir::intravisit::FnKind; -use rustc::ty; -use syntax::source_map::Span; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::FnKind; +use crate::rustc::ty; +use crate::syntax::source_map::Span; use crate::utils::{contains_name, higher, iter_input_pats, snippet, span_lint_and_then}; /// **What it does:** Checks for bindings that shadow other bindings already in diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index 70d90a8fb76..54fced12425 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -1,7 +1,7 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::source_map::Spanned; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::source_map::Spanned; use crate::utils::SpanlessEq; use crate::utils::{get_parent_expr, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty}; @@ -145,7 +145,7 @@ impl LintPass for StringLitAsBytes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { - use syntax::ast::LitKind; + use crate::syntax::ast::LitKind; use crate::utils::{in_macro, snippet}; if let ExprKind::MethodCall(ref path, _, ref args) = e.node { diff --git a/clippy_lints/src/suspicious_trait_impl.rs b/clippy_lints/src/suspicious_trait_impl.rs index 9f9b279a6c5..78a2c2adeb3 100644 --- a/clippy_lints/src/suspicious_trait_impl.rs +++ b/clippy_lints/src/suspicious_trait_impl.rs @@ -1,9 +1,9 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use syntax::ast; +use crate::rustc::hir; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::syntax::ast; use crate::utils::{get_trait_def_id, span_lint}; /// **What it does:** Lints for suspicious operations in impls of arithmetic operators, e.g. diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index 9ae6ec48383..1c409263499 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -1,9 +1,9 @@ use matches::matches; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty; +use crate::rustc::ty; use crate::utils::{differing_macro_contexts, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty, SpanlessEq}; use crate::utils::sugg::Sugg; diff --git a/clippy_lints/src/temporary_assignment.rs b/clippy_lints/src/temporary_assignment.rs index cb922302964..7cde4eb48f3 100644 --- a/clippy_lints/src/temporary_assignment.rs +++ b/clippy_lints/src/temporary_assignment.rs @@ -1,6 +1,6 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::{Expr, ExprKind}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::{Expr, ExprKind}; use crate::utils::is_adjusted; use crate::utils::span_lint; diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 6e82bee277f..84726e5ded3 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -1,10 +1,10 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; -use rustc::hir::*; +use crate::rustc::ty::{self, Ty}; +use crate::rustc::hir::*; use std::borrow::Cow; -use syntax::ast; +use crate::syntax::ast; use crate::utils::{last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then}; use crate::utils::{opt_def_id, sugg}; diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index 70a93e7f78a..baa9a8c3903 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -1,18 +1,18 @@ use std::cmp; use matches::matches; -use rustc::hir; -use rustc::hir::*; -use rustc::hir::intravisit::FnKind; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::FnKind; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::TyKind; -use rustc::session::config::Config as SessionConfig; -use rustc_target::spec::abi::Abi; -use rustc_target::abi::LayoutOf; -use syntax::ast::NodeId; -use syntax_pos::Span; +use crate::rustc::ty::TyKind; +use crate::rustc::session::config::Config as SessionConfig; +use crate::rustc_target::spec::abi::Abi; +use crate::rustc_target::abi::LayoutOf; +use crate::syntax::ast::NodeId; +use crate::syntax_pos::Span; use crate::utils::{in_macro, is_copy, is_self, span_lint_and_sugg, snippet}; /// **What it does:** Checks for functions taking arguments by reference, where diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index a6cc174f0ad..2766ea58d2d 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -1,21 +1,21 @@ #![allow(clippy::default_hash_types)] use crate::reexport::*; -use rustc::hir; -use rustc::hir::*; -use rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, in_external_macro, LintContext}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty, TyCtxt, TypeckTables}; -use rustc::ty::layout::LayoutOf; -use rustc_typeck::hir_ty_to_ty; +use crate::rustc::ty::{self, Ty, TyCtxt, TypeckTables}; +use crate::rustc::ty::layout::LayoutOf; +use crate::rustc_typeck::hir_ty_to_ty; use std::cmp::Ordering; use std::collections::BTreeMap; use std::borrow::Cow; -use syntax::ast::{FloatTy, IntTy, UintTy}; -use syntax::source_map::Span; -use syntax::errors::DiagnosticBuilder; +use crate::syntax::ast::{FloatTy, IntTy, UintTy}; +use crate::syntax::source_map::Span; +use crate::syntax::errors::DiagnosticBuilder; use crate::utils::{comparisons, differing_macro_contexts, higher, in_constant, in_macro, last_path_segment, match_def_path, match_path, match_type, multispan_sugg, opt_def_id, same_tys, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, clip, unsext, sext, int_bits}; @@ -542,7 +542,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitArg { } fn is_questionmark_desugar_marked_call(expr: &Expr) -> bool { - use syntax_pos::hygiene::CompilerDesugaringKind; + use crate::syntax_pos::hygiene::CompilerDesugaringKind; if let ExprKind::Call(ref callee, _) = expr.node { callee.span.is_compiler_desugaring(CompilerDesugaringKind::QuestionMark) } else { @@ -958,7 +958,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass { if let ExprKind::Cast(ref ex, _) = expr.node { let (cast_from, cast_to) = (cx.tables.expr_ty(ex), cx.tables.expr_ty(expr)); if let ExprKind::Lit(ref lit) = ex.node { - use syntax::ast::{LitIntType, LitKind}; + use crate::syntax::ast::{LitIntType, LitKind}; match lit.node { LitKind::Int(_, LitIntType::Unsuffixed) | LitKind::FloatUnsuffixed(_) => {}, _ => if cast_from.sty == cast_to.sty && !in_external_macro(cx.sess(), expr.span) { @@ -1291,7 +1291,7 @@ impl LintPass for CharLitAsU8 { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CharLitAsU8 { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { - use syntax::ast::{LitKind, UintTy}; + use crate::syntax::ast::{LitKind, UintTy}; if let ExprKind::Cast(ref e, _) = expr.node { if let ExprKind::Lit(ref l) = e.node { @@ -1565,7 +1565,7 @@ impl Ord for FullInt { fn numeric_cast_precast_bounds<'a>(cx: &LateContext<'_, '_>, expr: &'a Expr) -> Option<(FullInt, FullInt)> { - use syntax::ast::{IntTy, UintTy}; + use crate::syntax::ast::{IntTy, UintTy}; use std::*; if let ExprKind::Cast(ref cast_exp, _) = expr.node { @@ -1748,7 +1748,7 @@ impl LintPass for ImplicitHasher { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher { #[allow(clippy::cast_possible_truncation)] fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx Item) { - use syntax_pos::BytePos; + use crate::syntax_pos::BytePos; fn suggestion<'a, 'tcx>( cx: &LateContext<'a, 'tcx>, diff --git a/clippy_lints/src/unicode.rs b/clippy_lints/src/unicode.rs index 01c4cd83ce0..83f9713b59e 100644 --- a/clippy_lints/src/unicode.rs +++ b/clippy_lints/src/unicode.rs @@ -1,8 +1,8 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use syntax::ast::{LitKind, NodeId}; -use syntax::source_map::Span; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::syntax::ast::{LitKind, NodeId}; +use crate::syntax::source_map::Span; use unicode_normalization::UnicodeNormalization; use crate::utils::{is_allowed, snippet, span_help_and_lint}; diff --git a/clippy_lints/src/unsafe_removed_from_name.rs b/clippy_lints/src/unsafe_removed_from_name.rs index 7ef235e9297..e6472eb50bf 100644 --- a/clippy_lints/src/unsafe_removed_from_name.rs +++ b/clippy_lints/src/unsafe_removed_from_name.rs @@ -1,8 +1,8 @@ -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use syntax::ast::*; -use syntax::source_map::Span; -use syntax::symbol::LocalInternedString; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax::ast::*; +use crate::syntax::source_map::Span; +use crate::syntax::symbol::LocalInternedString; use crate::utils::span_lint; /// **What it does:** Checks for imports that remove "unsafe" from an item's diff --git a/clippy_lints/src/unused_io_amount.rs b/clippy_lints/src/unused_io_amount.rs index c5507fcaca4..82430a794b1 100644 --- a/clippy_lints/src/unused_io_amount.rs +++ b/clippy_lints/src/unused_io_amount.rs @@ -1,6 +1,6 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; use crate::utils::{is_try, match_qpath, match_trait_method, paths, span_lint}; /// **What it does:** Checks for unused written/read amount. diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index ababaad294d..a67164becfb 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -1,11 +1,11 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir; -use rustc::hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor}; -use rustc_data_structures::fx::FxHashMap; -use syntax::ast; -use syntax::source_map::Span; -use syntax::symbol::LocalInternedString; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::hir::intravisit::{walk_expr, walk_fn, FnKind, NestedVisitorMap, Visitor}; +use crate::rustc_data_structures::fx::FxHashMap; +use crate::syntax::ast; +use crate::syntax::source_map::Span; +use crate::syntax::symbol::LocalInternedString; use crate::utils::{in_macro, span_lint}; /// **What it does:** Checks for unused labels. diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index a1d24f64300..f8fe1b3bdfa 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -1,12 +1,12 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; use crate::utils::{in_macro, match_type, paths, span_lint_and_then, usage::is_potentially_mutated}; -use rustc::hir::intravisit::*; -use rustc::hir::*; -use syntax::ast::NodeId; -use syntax::source_map::Span; +use crate::rustc::hir::intravisit::*; +use crate::rustc::hir::*; +use crate::syntax::ast::NodeId; +use crate::syntax::source_map::Span; /// **What it does:** Checks for calls of `unwrap[_err]()` that cannot fail. /// diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 550f88c895e..3b2659a6176 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -1,11 +1,11 @@ use crate::utils::{in_macro, span_lint_and_sugg}; use if_chain::if_chain; -use rustc::hir::intravisit::{walk_path, walk_ty, NestedVisitorMap, Visitor}; -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::ty; -use rustc::{declare_tool_lint, lint_array}; -use syntax_pos::symbol::keywords::SelfType; +use crate::rustc::hir::intravisit::{walk_path, walk_ty, NestedVisitorMap, Visitor}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::ty; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::syntax_pos::symbol::keywords::SelfType; /// **What it does:** Checks for unnecessary repetition of structure name when a /// replacement with `Self` is applicable. diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 541d5353daf..8e8d40e28a9 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -3,13 +3,13 @@ #![allow(clippy::print_stdout, clippy::use_debug)] -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir; -use rustc::hir::{Expr, ExprKind, QPath, TyKind, Pat, PatKind, BindingAnnotation, StmtKind, DeclKind, Stmt}; -use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; -use rustc_data_structures::fx::FxHashMap; -use syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::hir::{Expr, ExprKind, QPath, TyKind, Pat, PatKind, BindingAnnotation, StmtKind, DeclKind, Stmt}; +use crate::rustc::hir::intravisit::{NestedVisitorMap, Visitor}; +use crate::rustc_data_structures::fx::FxHashMap; +use crate::syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID}; use crate::utils::get_attr; /// **What it does:** Generates clippy code that detects the offending pattern diff --git a/clippy_lints/src/utils/comparisons.rs b/clippy_lints/src/utils/comparisons.rs index 31e20f37e20..bd90fe1bc0a 100644 --- a/clippy_lints/src/utils/comparisons.rs +++ b/clippy_lints/src/utils/comparisons.rs @@ -2,7 +2,7 @@ #![deny(clippy::missing_docs_in_private_items)] -use rustc::hir::{BinOpKind, Expr}; +use crate::rustc::hir::{BinOpKind, Expr}; #[derive(PartialEq, Eq, Debug, Copy, Clone)] /// Represent a normalized comparison operator. diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index 16e39ff13ea..4a58ac2f760 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -6,7 +6,7 @@ use lazy_static::lazy_static; use std::default::Default; use std::{env, fmt, fs, io, path}; use std::io::Read; -use syntax::{ast, source_map}; +use crate::syntax::{ast, source_map}; use toml; use std::sync::Mutex; diff --git a/clippy_lints/src/utils/higher.rs b/clippy_lints/src/utils/higher.rs index 42b37568a99..cfedad49f31 100644 --- a/clippy_lints/src/utils/higher.rs +++ b/clippy_lints/src/utils/higher.rs @@ -4,9 +4,9 @@ #![deny(clippy::missing_docs_in_private_items)] use if_chain::if_chain; -use rustc::{hir, ty}; -use rustc::lint::LateContext; -use syntax::ast; +use crate::rustc::{hir, ty}; +use crate::rustc::lint::LateContext; +use crate::syntax::ast; use crate::utils::{is_expn_of, match_def_path, match_qpath, opt_def_id, paths, resolve_node}; /// Convert a hir binary operator to the corresponding `ast` type. diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index f8e99480ea0..2257fbf7743 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -1,11 +1,11 @@ use crate::consts::{constant_simple, constant_context}; -use rustc::lint::LateContext; -use rustc::hir::*; -use rustc::ty::{TypeckTables}; +use crate::rustc::lint::LateContext; +use crate::rustc::hir::*; +use crate::rustc::ty::{TypeckTables}; use std::hash::{Hash, Hasher}; use std::collections::hash_map::DefaultHasher; -use syntax::ast::Name; -use syntax::ptr::P; +use crate::syntax::ast::Name; +use crate::syntax::ptr::P; use crate::utils::differing_macro_contexts; /// Type used to check whether two ast are the same. This is different from the diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 56b76fdc7b0..413c71ab27b 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -2,11 +2,11 @@ //! checks for attributes -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir; -use rustc::hir::print; -use syntax::ast::Attribute; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir; +use crate::rustc::hir::print; +use crate::syntax::ast::Attribute; use crate::utils::get_attr; /// **What it does:** Dumps every ast/hir node which has the `#[clippy_dump]` diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index f3b915c7ce1..97a6922d35d 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -1,13 +1,13 @@ -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, EarlyContext, EarlyLintPass}; -use rustc::{declare_tool_lint, lint_array}; -use rustc::hir::*; -use rustc::hir; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass, EarlyContext, EarlyLintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::hir; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet}; use crate::utils::{match_qpath, paths, span_lint, span_lint_and_sugg}; -use syntax::symbol::LocalInternedString; -use syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name}; -use syntax::source_map::Span; +use crate::syntax::symbol::LocalInternedString; +use crate::syntax::ast::{Crate as AstCrate, Ident, ItemKind, Name}; +use crate::syntax::source_map::Span; /// **What it does:** Checks for various things we like to keep tidy in clippy. diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 4171e583e59..c113dd7e5a3 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -1,27 +1,27 @@ use crate::reexport::*; use matches::matches; use if_chain::if_chain; -use rustc::hir; -use rustc::hir::*; -use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; -use rustc::hir::def::Def; -use rustc::hir::intravisit::{NestedVisitorMap, Visitor}; -use rustc::hir::Node; -use rustc::lint::{LateContext, Level, Lint, LintContext}; -use rustc::session::Session; -use rustc::traits; -use rustc::ty::{self, Binder, Ty, TyCtxt, layout::{self, IntegerExt}, subst::Kind}; -use rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart}; +use crate::rustc::hir; +use crate::rustc::hir::*; +use crate::rustc::hir::def_id::{DefId, CRATE_DEF_INDEX}; +use crate::rustc::hir::def::Def; +use crate::rustc::hir::intravisit::{NestedVisitorMap, Visitor}; +use crate::rustc::hir::Node; +use crate::rustc::lint::{LateContext, Level, Lint, LintContext}; +use crate::rustc::session::Session; +use crate::rustc::traits; +use crate::rustc::ty::{self, Binder, Ty, TyCtxt, layout::{self, IntegerExt}, subst::Kind}; +use crate::rustc_errors::{Applicability, CodeSuggestion, Substitution, SubstitutionPart}; use std::borrow::Cow; use std::env; use std::mem; use std::str::FromStr; use std::rc::Rc; -use syntax::ast::{self, LitKind}; -use syntax::attr; -use syntax::source_map::{Span, DUMMY_SP}; -use syntax::errors::DiagnosticBuilder; -use syntax::symbol::keywords; +use crate::syntax::ast::{self, LitKind}; +use crate::syntax::attr; +use crate::syntax::source_map::{Span, DUMMY_SP}; +use crate::syntax::errors::DiagnosticBuilder; +use crate::syntax::symbol::keywords; mod camel_case; pub use self::camel_case::{camel_case_from, camel_case_until}; @@ -70,7 +70,7 @@ pub fn in_macro(span: Span) -> bool { /// /// See also the `paths` module. pub fn match_def_path(tcx: TyCtxt<'_, '_, '_>, def_id: DefId, path: &[&str]) -> bool { - use syntax::symbol; + use crate::syntax::symbol; struct AbsolutePathBuffer { names: Vec, diff --git a/clippy_lints/src/utils/ptr.rs b/clippy_lints/src/utils/ptr.rs index 16a03f8f99c..a28e1c7fe9d 100644 --- a/clippy_lints/src/utils/ptr.rs +++ b/clippy_lints/src/utils/ptr.rs @@ -1,9 +1,9 @@ use std::borrow::Cow; -use rustc::hir::*; -use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; -use rustc::lint::LateContext; -use syntax::ast::Name; -use syntax::source_map::Span; +use crate::rustc::hir::*; +use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; +use crate::rustc::lint::LateContext; +use crate::syntax::ast::Name; +use crate::syntax::source_map::Span; use crate::utils::{get_pat_name, match_var, snippet}; pub fn get_spans( diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index 8efee6cd964..f849cef093a 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -2,19 +2,19 @@ #![deny(clippy::missing_docs_in_private_items)] use matches::matches; -use rustc::hir; -use rustc::lint::{EarlyContext, LateContext, LintContext}; -use rustc_errors; +use crate::rustc::hir; +use crate::rustc::lint::{EarlyContext, LateContext, LintContext}; +use crate::rustc_errors; use std::borrow::Cow; use std::fmt::Display; use std; -use syntax::source_map::{CharPos, Span}; -use syntax::parse::token; -use syntax::print::pprust::token_to_string; -use syntax::util::parser::AssocOp; -use syntax::ast; +use crate::syntax::source_map::{CharPos, Span}; +use crate::syntax::parse::token; +use crate::syntax::print::pprust::token_to_string; +use crate::syntax::util::parser::AssocOp; +use crate::syntax::ast; use crate::utils::{higher, snippet, snippet_opt}; -use syntax_pos::{BytePos, Pos}; +use crate::syntax_pos::{BytePos, Pos}; /// A helper type to build suggestion correctly handling parenthesis. pub enum Sugg<'a> { @@ -86,7 +86,7 @@ impl<'a> Sugg<'a> { /// Prepare a suggestion from an expression. pub fn ast(cx: &EarlyContext<'_>, expr: &ast::Expr, default: &'a str) -> Self { - use syntax::ast::RangeLimits; + use crate::syntax::ast::RangeLimits; let snippet = snippet(cx, expr.span, default); @@ -360,7 +360,7 @@ enum Associativity { /// they are considered /// associative. fn associativity(op: &AssocOp) -> Associativity { - use syntax::util::parser::AssocOp::*; + use crate::syntax::util::parser::AssocOp::*; match *op { ObsoleteInPlace | Assign | AssignOp(_) => Associativity::Right, @@ -382,7 +382,7 @@ fn associativity(op: &AssocOp) -> Associativity { /// Convert a `hir::BinOp` to the corresponding assigning binary operator. fn hirbinop2assignop(op: hir::BinOp) -> AssocOp { - use syntax::parse::token::BinOpToken::*; + use crate::syntax::parse::token::BinOpToken::*; AssocOp::AssignOp(match op.node { hir::BinOpKind::Add => Plus, @@ -410,8 +410,8 @@ fn hirbinop2assignop(op: hir::BinOp) -> AssocOp { /// Convert an `ast::BinOp` to the corresponding assigning binary operator. fn astbinop2assignop(op: ast::BinOp) -> AssocOp { - use syntax::ast::BinOpKind::*; - use syntax::parse::token::BinOpToken; + use crate::syntax::ast::BinOpKind::*; + use crate::syntax::parse::token::BinOpToken; AssocOp::AssignOp(match op.node { Add => BinOpToken::Plus, diff --git a/clippy_lints/src/utils/usage.rs b/clippy_lints/src/utils/usage.rs index ac18d04e454..826ca78e64b 100644 --- a/clippy_lints/src/utils/usage.rs +++ b/clippy_lints/src/utils/usage.rs @@ -1,14 +1,14 @@ -use rustc::lint::LateContext; +use crate::rustc::lint::LateContext; -use rustc::hir::def::Def; -use rustc::hir::*; -use rustc::middle::expr_use_visitor::*; -use rustc::middle::mem_categorization::cmt_; -use rustc::middle::mem_categorization::Categorization; -use rustc::ty; -use rustc_data_structures::fx::FxHashSet; -use syntax::ast::NodeId; -use syntax::source_map::Span; +use crate::rustc::hir::def::Def; +use crate::rustc::hir::*; +use crate::rustc::middle::expr_use_visitor::*; +use crate::rustc::middle::mem_categorization::cmt_; +use crate::rustc::middle::mem_categorization::Categorization; +use crate::rustc::ty; +use crate::rustc_data_structures::fx::FxHashSet; +use crate::syntax::ast::NodeId; +use crate::syntax::source_map::Span; /// Returns a set of mutated local variable ids or None if mutations could not be determined. pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option> { diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index 4cbefc29b9c..4c6060192cf 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -1,9 +1,9 @@ -use rustc::hir::*; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::hir::*; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::ty::{self, Ty}; -use syntax::source_map::Span; +use crate::rustc::ty::{self, Ty}; +use crate::syntax::source_map::Span; use crate::utils::{higher, is_copy, snippet, span_lint_and_sugg}; use crate::consts::constant; diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index 69d99cc60f4..a367a04b2ba 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -1,10 +1,10 @@ use crate::utils::{snippet, span_lint, span_lint_and_sugg}; -use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use std::borrow::Cow; -use syntax::ast::*; -use syntax::parse::{parser, token}; -use syntax::tokenstream::{ThinTokenStream, TokenStream}; +use crate::syntax::ast::*; +use crate::syntax::parse::{parser, token}; +use crate::syntax::tokenstream::{ThinTokenStream, TokenStream}; /// **What it does:** This lint warns when you use `println!("")` to /// print a newline. @@ -264,7 +264,7 @@ fn check_tts<'a>(cx: &EarlyContext<'a>, tts: &ThinTokenStream, is_write: bool) - Ok(token) => token.0.to_string(), Err(_) => return (None, expr), }; - use fmt_macros::*; + use crate::fmt_macros::*; let tmp = fmtstr.clone(); let mut args = vec![]; let mut fmt_parser = Parser::new(&tmp, None); diff --git a/clippy_lints/src/zero_div_zero.rs b/clippy_lints/src/zero_div_zero.rs index 73c9e64d2cb..5ceff6d4aa0 100644 --- a/clippy_lints/src/zero_div_zero.rs +++ b/clippy_lints/src/zero_div_zero.rs @@ -1,8 +1,8 @@ use crate::consts::{constant_simple, Constant}; -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; -use rustc::{declare_tool_lint, lint_array}; +use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; +use crate::rustc::{declare_tool_lint, lint_array}; use if_chain::if_chain; -use rustc::hir::*; +use crate::rustc::hir::*; use crate::utils::span_help_and_lint; /// **What it does:** Checks for `0.0 / 0.0`. diff --git a/src/driver.rs b/src/driver.rs index e85f61e343f..99f8bc610ff 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -4,8 +4,14 @@ #![feature(tool_lints)] #![allow(unknown_lints, clippy::missing_docs_in_private_items)] -use rustc_driver::{self, driver::CompileController, Compilation}; -use rustc_plugin; +// FIXME: switch to something more ergonomic here, once available. +// (currently there is no way to opt into sysroot crates w/o `extern crate`) +#[allow(unused_extern_crates)] +extern crate rustc_driver; +#[allow(unused_extern_crates)] +extern crate rustc_plugin; +use self::rustc_driver::{driver::CompileController, Compilation}; + use std::path::Path; use std::process::{exit, Command}; diff --git a/src/lib.rs b/src/lib.rs index a7167ac10de..bfa44d08703 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,11 @@ #![allow(clippy::missing_docs_in_private_items)] #![warn(rust_2018_idioms)] -use rustc_plugin::Registry; +// FIXME: switch to something more ergonomic here, once available. +// (currently there is no way to opt into sysroot crates w/o `extern crate`) +#[allow(unused_extern_crates)] +extern crate rustc_plugin; +use self::rustc_plugin::Registry; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry<'_>) {