mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 22:50:56 +00:00
Merge pull request #3189 from eddyb/rextern
Reintroduce `extern crate` for non-Cargo dependencies.
This commit is contained in:
commit
f166b7d2f4
135 changed files with 745 additions and 705 deletions
|
@ -1,3 +1,5 @@
|
|||
cargo-features = ["edition"]
|
||||
|
||||
[package]
|
||||
name = "clippy"
|
||||
version = "0.0.212"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
cargo-features = ["edition"]
|
||||
|
||||
[package]
|
||||
name = "clippy_lints"
|
||||
# begin automatic update
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
@ -180,10 +180,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass {
|
|||
|| is_word(lint, "deprecated") {
|
||||
return
|
||||
},
|
||||
ItemKind::ExternCrate(..) => if is_word(lint, "unused_imports")
|
||||
&& skip_unused_imports {
|
||||
ItemKind::ExternCrate(..) => {
|
||||
if is_word(lint, "unused_imports")
|
||||
&& skip_unused_imports {
|
||||
return
|
||||
}
|
||||
if is_word(lint, "unused_extern_crates") {
|
||||
return
|
||||
},
|
||||
}
|
||||
}
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<Constant> {
|
||||
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)),
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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::*`.
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<hir::ImplItemRef>) {
|
||||
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>,
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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`.
|
||||
///
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<DefId>, 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<X>` where an atomic will do.
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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!`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue