mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Auto merge of #3596 - xfix:remove-crate-from-paths, r=flip1995
Remove crate:: prefixes from crate paths This is somewhat misleading, as those are actually external crates, and don't need a crate:: prefix.
This commit is contained in:
commit
4d60841205
137 changed files with 803 additions and 803 deletions
|
@ -7,13 +7,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::{FloatTy, Lit, LitKind};
|
||||
use crate::syntax::symbol;
|
||||
use crate::utils::span_lint;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use std::f64::consts as f64;
|
||||
use syntax::ast::{FloatTy, Lit, LitKind};
|
||||
use syntax::symbol;
|
||||
|
||||
/// **What it does:** Checks for floating point literals that approximate
|
||||
/// constants which are defined in
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::span_lint;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for plain integer arithmetic.
|
||||
///
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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 crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast;
|
||||
use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq};
|
||||
use crate::utils::{higher, sugg};
|
||||
use if_chain::if_chain;
|
||||
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 rustc_errors::Applicability;
|
||||
use syntax::ast;
|
||||
|
||||
/// **What it does:** Checks for `a = a op b` or `a = b commutative_op a`
|
||||
/// patterns.
|
||||
|
@ -240,7 +240,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
|
|||
}
|
||||
|
||||
fn is_commutative(op: hir::BinOpKind) -> bool {
|
||||
use crate::rustc::hir::BinOpKind::*;
|
||||
use 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,
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
//! checks for attributes
|
||||
|
||||
use crate::reexport::*;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{
|
||||
CheckLintNameResult, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintContext, LintPass,
|
||||
};
|
||||
use crate::rustc::ty::{self, TyCtxt};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::{
|
||||
in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_sugg,
|
||||
span_lint_and_then, without_block_comments,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{
|
||||
CheckLintNameResult, EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintContext, LintPass,
|
||||
};
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use semver::Version;
|
||||
use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for items annotated with `#[inline(always)]`,
|
||||
/// unless the annotated function is empty or simply panics.
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::LitKind;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{span_lint, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for incompatible bit masks in comparisons.
|
||||
///
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::span_lint;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for usage of blacklisted names for variables, such
|
||||
/// as `foo`.
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::*;
|
||||
use matches::matches;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for `if` conditions that use blocks to contain an
|
||||
/// expression.
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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_data_structures::thin_vec::ThinVec;
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
|
||||
use crate::syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
|
||||
use crate::utils::{
|
||||
get_trait_def_id, implements_trait, in_macro, match_type, paths, snippet_opt, span_lint_and_then, SpanlessEq,
|
||||
};
|
||||
use rustc::hir::intravisit::*;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::thin_vec::ThinVec;
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
|
||||
use syntax::source_map::{dummy_spanned, Span, DUMMY_SP};
|
||||
|
||||
/// **What it does:** Checks for boolean expressions that can be written more
|
||||
/// concisely.
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::{Name, UintTy};
|
||||
use crate::utils::{
|
||||
contains_name, get_pat_name, match_type, paths, single_segment_path, snippet_with_applicability,
|
||||
span_lint_and_sugg, walk_ptrs_ty,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::{Name, UintTy};
|
||||
|
||||
/// **What it does:** Checks for naive byte counts
|
||||
///
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
//! lint on missing cargo common metadata
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::{ast::*, source_map::DUMMY_SP};
|
||||
use crate::utils::span_lint;
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::{ast::*, source_map::DUMMY_SP};
|
||||
|
||||
use cargo_metadata;
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
//!
|
||||
//! This lint is **warn** by default
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast;
|
||||
use if_chain::if_chain;
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast;
|
||||
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{in_macro, snippet_block, snippet_block_with_applicability, span_lint_and_sugg, span_lint_and_then};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for nested `if` statements which can be collapsed
|
||||
/// by `&&`-combining their conditions and for `else { if ... }` expressions
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use crate::utils::{in_macro, snippet, span_lint_and_then};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::*;
|
||||
|
||||
/// **What it does:** Checks for constants with an explicit `'static` lifetime.
|
||||
///
|
||||
|
|
|
@ -10,20 +10,20 @@
|
|||
|
||||
#![allow(clippy::float_cmp)]
|
||||
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::LateContext;
|
||||
use crate::rustc::ty::subst::{Subst, Substs};
|
||||
use crate::rustc::ty::{self, Instance, Ty, TyCtxt};
|
||||
use crate::rustc::{bug, span_bug};
|
||||
use crate::syntax::ast::{FloatTy, LitKind};
|
||||
use crate::syntax::ptr::P;
|
||||
use crate::utils::{clip, sext, unsext};
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::LateContext;
|
||||
use rustc::ty::subst::{Subst, Substs};
|
||||
use rustc::ty::{self, Instance, Ty, TyCtxt};
|
||||
use rustc::{bug, span_bug};
|
||||
use std::cmp::Ordering::{self, Equal};
|
||||
use std::cmp::PartialOrd;
|
||||
use std::convert::TryInto;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::rc::Rc;
|
||||
use syntax::ast::{FloatTy, LitKind};
|
||||
use syntax::ptr::P;
|
||||
|
||||
/// A `LitKind`-like enum to fold constant `Expr`s into.
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -151,7 +151,7 @@ impl Constant {
|
|||
|
||||
/// parse a `LitKind` to a `Constant`
|
||||
pub fn lit_to_constant<'tcx>(lit: &LitKind, ty: Ty<'tcx>) -> Constant {
|
||||
use crate::syntax::ast::*;
|
||||
use syntax::ast::*;
|
||||
|
||||
match *lit {
|
||||
LitKind::Str(ref is, _) => Constant::Str(is.to_string()),
|
||||
|
@ -286,7 +286,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
|
|||
|
||||
/// lookup a possibly constant expression from a ExprKind::Path
|
||||
fn fetch_path(&mut self, qpath: &QPath, id: HirId) -> Option<Constant> {
|
||||
use crate::rustc::mir::interpret::GlobalId;
|
||||
use rustc::mir::interpret::GlobalId;
|
||||
|
||||
let def = self.tables.qpath_def(qpath, id);
|
||||
match def {
|
||||
|
@ -430,7 +430,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 crate::rustc::mir::interpret::{ConstValue, Scalar};
|
||||
use rustc::mir::interpret::{ConstValue, Scalar};
|
||||
match result.val {
|
||||
ConstValue::Scalar(Scalar::Bits { bits: b, .. }) => match result.ty.sty {
|
||||
ty::Bool => Some(Constant::Bool(b == 1)),
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty::Ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_data_structures::fx::FxHashMap;
|
||||
use crate::syntax::symbol::LocalInternedString;
|
||||
use crate::utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
|
||||
use crate::utils::{SpanlessEq, SpanlessHash};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::Ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use smallvec::SmallVec;
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
|
||||
/// **What it does:** Checks for consecutive `if`s with the same condition.
|
||||
///
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::{Item, ItemKind};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
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};
|
||||
|
||||
/// **What it does:** Checks for types that implement `Copy` as well as
|
||||
/// `Iterator`.
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
|
||||
//! calculate cyclomatic complexity and warn about overly complex functions
|
||||
|
||||
use crate::rustc::cfg::CFG;
|
||||
use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::{Attribute, NodeId};
|
||||
use crate::syntax::source_map::Span;
|
||||
use rustc::cfg::CFG;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::{Attribute, NodeId};
|
||||
use syntax::source_map::Span;
|
||||
|
||||
use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::rustc_errors::Applicability;
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
use crate::utils::{any_parent_is_automatically_derived, match_def_path, opt_def_id, paths, span_lint_and_sugg};
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for deriving `Hash` but implementing `PartialEq`
|
||||
/// explicitly or vice versa.
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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 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 url::Url;
|
||||
|
||||
/// **What it does:** Checks for the presence of `_`, `::` or camel-case words
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
//! Lint on unnecessary double comparisons. Some examples:
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::source_map::Span;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
use crate::utils::{snippet_with_applicability, span_lint_and_sugg, SpanlessEq};
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
|
||||
/// **What it does:** Checks for unnecessary double parentheses.
|
||||
///
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for calls to `std::mem::drop` with a reference
|
||||
/// instead of an owned value.
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::source_map::Spanned;
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::source_map::Spanned;
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::utils::paths;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
//! lint on if expressions with an else if, but without a final else branch
|
||||
|
||||
use crate::rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::*;
|
||||
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
|
||||
use crate::utils::span_help_and_lint;
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
//! lint when there is an enum with no variants
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::span_lint_and_then;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for `enum`s with no variants.
|
||||
///
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
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};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for uses of `contains_key` + `insert` on `HashMap`
|
||||
/// or `BTreeMap`.
|
||||
|
|
|
@ -11,15 +11,15 @@
|
|||
//! don't fit into an `i32`
|
||||
|
||||
use crate::consts::{miri_to_const, Constant};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::mir::interpret::GlobalId;
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::ty::subst::Substs;
|
||||
use crate::rustc::ty::util::IntTypeExt;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::{IntTy, UintTy};
|
||||
use crate::utils::span_lint;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::mir::interpret::GlobalId;
|
||||
use rustc::ty;
|
||||
use rustc::ty::subst::Substs;
|
||||
use rustc::ty::util::IntTypeExt;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::{IntTy, UintTy};
|
||||
|
||||
/// **What it does:** Checks for C-like enumerations that are
|
||||
/// `repr(isize/usize)` and have values that don't fit into an `i32`.
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
//! lint on `use`ing all variants of an enum
|
||||
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::*;
|
||||
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;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for `use Enum::*`.
|
||||
///
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
//! lint on enum variants that are prefixed or suffixed by the same characters
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, Lint, 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::{camel_case, in_macro};
|
||||
use crate::utils::{span_help_and_lint, span_lint};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, Lint, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
|
||||
/// **What it does:** Detects enumeration variants that are prefixed or suffixed
|
||||
/// by the same characters.
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::{
|
||||
implements_trait, in_macro, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq,
|
||||
};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for equal operands to comparison, logical and
|
||||
/// bitwise, difference and division binary operators (`==`, `>`, etc., `&&`,
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::consts::{constant_simple, Constant};
|
||||
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};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for erasing operations, e.g. `x * 0`.
|
||||
///
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::intravisit as visit;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::middle::expr_use_visitor::*;
|
||||
use crate::rustc::middle::mem_categorization::{cmt_, Categorization};
|
||||
use crate::rustc::ty::layout::LayoutOf;
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc::util::nodemap::NodeSet;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::NodeId;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::span_lint;
|
||||
use rustc::hir::intravisit as visit;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::middle::expr_use_visitor::*;
|
||||
use rustc::middle::mem_categorization::{cmt_, Categorization};
|
||||
use rustc::ty::layout::LayoutOf;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::util::nodemap::NodeSet;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
pub struct Pass {
|
||||
pub too_large_for_stack: u64,
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
pub struct EtaPass;
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::intravisit::{walk_expr, 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::ast;
|
||||
use crate::utils::{get_parent_expr, span_lint, span_note_and_lint};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast;
|
||||
|
||||
/// **What it does:** Checks for a read and a write to the same variable where
|
||||
/// whether the read occurs before or after the write depends on the evaluation
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use crate::syntax_pos::symbol::Symbol;
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::f32;
|
||||
use std::f64;
|
||||
use std::fmt;
|
||||
use syntax::ast::*;
|
||||
use syntax_pos::symbol::Symbol;
|
||||
|
||||
/// **What it does:** Checks for float literals with a precision greater
|
||||
/// than that supported by the underlying type
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::LitKind;
|
||||
use crate::utils::{is_expn_of, match_def_path, opt_def_id, resolve_node, span_lint, span_lint_and_sugg};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::LitKind;
|
||||
|
||||
/// **What it does:** Checks for usage of `write!()` / `writeln()!` which can be
|
||||
/// replaced with `(e)print!()` / `(e)println!()`
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::Span;
|
||||
use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT};
|
||||
use crate::utils::{is_expn_of, match_def_path, method_chain_args, opt_def_id, span_lint_and_then, walk_ptrs_ty};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax_pos::Span;
|
||||
|
||||
/// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()`
|
||||
///
|
||||
|
@ -61,8 +61,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 crate::rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use crate::rustc::hir::*;
|
||||
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
|
||||
use rustc::hir::*;
|
||||
|
||||
struct FindPanicUnwrap<'a, 'tcx: 'a> {
|
||||
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::LitKind;
|
||||
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,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::LitKind;
|
||||
|
||||
/// **What it does:** Checks for the use of `format!("string literal with no
|
||||
/// argument")` and `format!("{}", foo)` where `foo` is a string.
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast;
|
||||
use crate::syntax::ptr::P;
|
||||
use crate::utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast;
|
||||
use syntax::ptr::P;
|
||||
|
||||
/// **What it does:** Checks for use of the non-existent `=*`, `=!` and `=-`
|
||||
/// operators.
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::intravisit;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_data_structures::fx::FxHashSet;
|
||||
use crate::rustc_target::spec::abi::Abi;
|
||||
use crate::syntax::ast;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::{iter_input_pats, span_lint, type_is_unsafe_function};
|
||||
use matches::matches;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for functions with too many parameters.
|
||||
///
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::NodeId;
|
||||
use crate::utils::{
|
||||
in_macro, match_def_path, match_trait_method, same_tys, snippet, snippet_with_macro_callsite, span_lint_and_then,
|
||||
};
|
||||
use crate::utils::{opt_def_id, paths, resolve_node};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::NodeId;
|
||||
|
||||
/// **What it does:** Checks for always-identical `Into`/`From`/`IntoIter` conversions.
|
||||
///
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::consts::{constant_simple, Constant};
|
||||
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::source_map::Span;
|
||||
use crate::utils::{clip, in_macro, snippet, span_lint, unsext};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for identity operations, e.g. `x + 0`.
|
||||
///
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
//! lint on if branches that could be swapped so no `!` operation is necessary
|
||||
//! on the condition
|
||||
|
||||
use crate::rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::*;
|
||||
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
|
||||
use crate::utils::span_help_and_lint;
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::{intravisit::FnKind, Body, ExprKind, FnDecl};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::{ast::NodeId, source_map::Span};
|
||||
use crate::utils::{in_macro, snippet_opt, span_lint_and_then};
|
||||
use rustc::hir::{intravisit::FnKind, Body, ExprKind, FnDecl};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::{ast::NodeId, source_map::Span};
|
||||
|
||||
/// **What it does:** Checks for missing return statements at the end of a block.
|
||||
///
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
//! lint on indexing and slicing operations
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
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::ast::RangeLimits;
|
||||
use crate::utils;
|
||||
use crate::utils::higher;
|
||||
use crate::utils::higher::Range;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::RangeLimits;
|
||||
|
||||
/// **What it does:** Checks for out of bounds array indexing with a constant
|
||||
/// index.
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
use super::utils::{get_arg_name, match_var, remove_blocks, snippet_with_applicability, span_lint_and_sugg};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for matches being used to destructure a single-variant enum
|
||||
/// or tuple struct where a `let` will suffice.
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for iteration that is guaranteed to be infinite.
|
||||
///
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
//! lint on inherent implementations
|
||||
|
||||
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 crate::syntax_pos::Span;
|
||||
use crate::utils::span_lint_and_then;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use std::default::Default;
|
||||
use syntax_pos::Span;
|
||||
|
||||
/// **What it does:** Checks for multiple inherent implementations of a struct
|
||||
///
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
//! checks for `#[inline]` on trait methods without bodies
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::{Attribute, Name};
|
||||
use crate::utils::span_lint_and_then;
|
||||
use crate::utils::sugg::DiagnosticBuilderExt;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::{Attribute, Name};
|
||||
|
||||
/// **What it does:** Checks for `#[inline]` on trait methods without bodies
|
||||
///
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
//! lint on blocks unnecessarily using >= with a + 1 or - 1
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::*;
|
||||
|
||||
use crate::utils::{snippet_opt, span_lint_and_then};
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::utils::{match_def_path, opt_def_id, paths, span_help_and_lint};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for creation of references to zeroed or uninitialized memory.
|
||||
///
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
//! lint when items are used after statements
|
||||
|
||||
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};
|
||||
use matches::matches;
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
|
||||
/// **What it does:** Checks for items declared after some statement in a block.
|
||||
///
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
//! lint when there is a large size difference between variants on an enum
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty::layout::LayoutOf;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::{snippet_opt, span_lint_and_then};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::layout::LayoutOf;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for large size differences between variants on
|
||||
/// `enum`s.
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::def_id::DefId;
|
||||
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::rustc_data_structures::fx::FxHashSet;
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::{Lit, LitKind, Name};
|
||||
use crate::syntax::source_map::{Span, Spanned};
|
||||
use crate::utils::{get_item_name, in_macro, snippet_with_applicability, span_lint, span_lint_and_sugg, walk_ptrs_ty};
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::{Lit, LitKind, Name};
|
||||
use syntax::source_map::{Span, Spanned};
|
||||
|
||||
/// **What it does:** Checks for getting the length of something via `.len()`
|
||||
/// just to compare to zero, and suggests using `.is_empty()` where applicable.
|
||||
|
@ -148,7 +148,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 crate::rustc::traits::supertrait_def_ids(cx.tcx, traitt) {
|
||||
for supertrait in rustc::traits::supertrait_def_ids(cx.tcx, traitt) {
|
||||
fill_trait_set(supertrait, set, cx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::BindingAnnotation;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast;
|
||||
use crate::utils::{snippet, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::BindingAnnotation;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast;
|
||||
|
||||
/// **What it does:** Checks for variable declarations immediately followed by a
|
||||
/// conditional affectation.
|
||||
|
|
|
@ -213,7 +213,7 @@ pub mod zero_div_zero;
|
|||
pub use crate::utils::conf::Conf;
|
||||
|
||||
mod reexport {
|
||||
crate use crate::syntax::ast::{Name, NodeId};
|
||||
crate use syntax::ast::{Name, NodeId};
|
||||
}
|
||||
|
||||
pub fn register_pre_expansion_lints(
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::reexport::*;
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::intravisit::*;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::syntax::symbol::keywords;
|
||||
use crate::utils::{last_path_segment, span_lint};
|
||||
use matches::matches;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::intravisit::*;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::keywords;
|
||||
|
||||
/// **What it does:** Checks for lifetime annotations which can be removed by
|
||||
/// relying on lifetime elision.
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
//! Lints concerned with the grouping of digits with underscores in integral or
|
||||
//! floating-point literal expressions.
|
||||
|
||||
use crate::rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use crate::syntax_pos;
|
||||
use crate::utils::{snippet_opt, span_lint_and_sugg};
|
||||
use if_chain::if_chain;
|
||||
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::*;
|
||||
use syntax_pos;
|
||||
|
||||
/// **What it does:** Warns if a long integral or floating-point constant does
|
||||
/// not contain underscores.
|
||||
|
|
|
@ -8,31 +8,31 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::reexport::*;
|
||||
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::hir::*;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::middle::region;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use itertools::Itertools;
|
||||
// use crate::rustc::middle::region::CodeExtent;
|
||||
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::hir::*;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::middle::region;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
// use rustc::middle::region::CodeExtent;
|
||||
use crate::consts::{constant, Constant};
|
||||
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::subst::Subst;
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::syntax_pos::BytePos;
|
||||
use crate::utils::usage::mutated_variables;
|
||||
use crate::utils::{in_macro, sext, sugg};
|
||||
use rustc::middle::expr_use_visitor::*;
|
||||
use rustc::middle::mem_categorization::cmt_;
|
||||
use rustc::middle::mem_categorization::Categorization;
|
||||
use rustc::ty::subst::Subst;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::Applicability;
|
||||
use std::iter::{once, Iterator};
|
||||
use std::mem;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::BytePos;
|
||||
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::Ident;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{
|
||||
in_macro, match_trait_method, match_type, remove_blocks, snippet_with_applicability, span_lint_and_sugg,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::Ident;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Pass;
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::{in_macro, iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Pass;
|
||||
|
|
|
@ -8,13 +8,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::LitKind;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{
|
||||
|
@ -22,8 +15,15 @@ use crate::utils::{
|
|||
snippet_with_applicability, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::Bound;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for matches with a single arm where an `if let`
|
||||
/// will usually suffice.
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::{Expr, ExprKind};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::{match_def_path, opt_def_id, paths, snippet, span_lint_and_then, walk_ptrs_ty_depth};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::{Expr, ExprKind};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
use std::iter;
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::{Expr, ExprKind};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
|
||||
use rustc::hir::{Expr, ExprKind};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for usage of `std::mem::forget(t)` where `t` is
|
||||
/// `Drop`.
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::{Expr, ExprKind, MutMutable, QPath};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::{match_def_path, match_qpath, opt_def_id, paths, snippet_with_applicability, span_lint_and_sugg};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::{Expr, ExprKind, MutMutable, QPath};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for `mem::replace()` on an `Option` with
|
||||
/// `None`.
|
||||
|
|
|
@ -7,15 +7,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, Lint, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::ty::{self, Predicate, Ty};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast;
|
||||
use crate::syntax::source_map::{BytePos, Span};
|
||||
use crate::syntax::symbol::LocalInternedString;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::sugg;
|
||||
use crate::utils::{
|
||||
|
@ -27,9 +18,18 @@ use crate::utils::{
|
|||
};
|
||||
use if_chain::if_chain;
|
||||
use matches::matches;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, Lint, LintArray, LintContext, LintPass};
|
||||
use rustc::ty::{self, Predicate, Ty};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use std::iter;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::{BytePos, Span};
|
||||
use syntax::symbol::LocalInternedString;
|
||||
|
||||
mod unnecessary_filter_map;
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use crate::rustc::lint::LateContext;
|
||||
use crate::syntax::ast;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::usage::mutated_variables;
|
||||
use crate::utils::{match_qpath, match_trait_method, span_lint};
|
||||
use rustc::hir;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
|
||||
use rustc::lint::LateContext;
|
||||
use syntax::ast;
|
||||
|
||||
use if_chain::if_chain;
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
// except according to those terms.
|
||||
|
||||
use crate::consts::{constant_simple, Constant};
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
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 std::cmp::Ordering;
|
||||
|
||||
/// **What it does:** Checks for expressions where `std::cmp::min` and `max` are
|
||||
|
|
|
@ -9,14 +9,6 @@
|
|||
|
||||
use crate::consts::{constant, Constant};
|
||||
use crate::reexport::*;
|
||||
use crate::rustc::hir::intravisit::FnKind;
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::LitKind;
|
||||
use crate::syntax::source_map::{ExpnFormat, Span};
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{
|
||||
get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal, iter_input_pats,
|
||||
|
@ -25,6 +17,14 @@ use crate::utils::{
|
|||
};
|
||||
use if_chain::if_chain;
|
||||
use matches::matches;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::source_map::{ExpnFormat, Span};
|
||||
|
||||
/// **What it does:** Checks for function arguments and let bindings denoted as
|
||||
/// `ref`.
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_data_structures::fx::FxHashMap;
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::syntax::visit::{walk_expr, FnKind, Visitor};
|
||||
use crate::utils::{constants, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::lint::{in_external_macro, EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::Applicability;
|
||||
use std::char;
|
||||
use syntax::ast::*;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::visit::{walk_expr, FnKind, Visitor};
|
||||
|
||||
/// **What it does:** Checks for structure field patterns bound to wildcards.
|
||||
///
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
// [`missing_doc`]: https://github.com/rust-lang/rust/blob/d6d05904697d89099b55da3331155392f1db9c00/src/librustc_lint/builtin.rs#L246
|
||||
//
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast;
|
||||
use crate::syntax::attr;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::{in_macro, span_lint};
|
||||
use rustc::hir;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Warns if there is missing doc for any documentable item
|
||||
/// (public or private).
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
// except according to those terms.
|
||||
//
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
/// **What it does:** it lints if an exported function, method, trait method with default impl,
|
||||
/// or trait method impl is not `#[inline]`.
|
||||
|
@ -91,7 +91,7 @@ fn check_missing_inline_attrs(cx: &LateContext<'_, '_>, attrs: &[ast::Attribute]
|
|||
}
|
||||
|
||||
fn is_executable<'a, 'tcx>(cx: &LateContext<'a, 'tcx>) -> bool {
|
||||
use crate::rustc::session::config::CrateType;
|
||||
use rustc::session::config::CrateType;
|
||||
|
||||
cx.tcx.sess.crate_types.get().iter().any(|t: &CrateType| match t {
|
||||
CrateType::Executable => true,
|
||||
|
@ -156,7 +156,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 crate::rustc::ty::{ImplContainer, TraitContainer};
|
||||
use rustc::ty::{ImplContainer, TraitContainer};
|
||||
if is_executable(cx) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
//! lint on multiple versions of a crate being used
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::{ast::*, source_map::DUMMY_SP};
|
||||
use crate::utils::span_lint;
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::{ast::*, source_map::DUMMY_SP};
|
||||
|
||||
use cargo_metadata;
|
||||
use itertools::Itertools;
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::intravisit;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::{higher, span_lint};
|
||||
use rustc::hir;
|
||||
use rustc::hir::intravisit;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for instances of `mut mut` references.
|
||||
///
|
||||
|
@ -47,7 +47,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutMut {
|
|||
}
|
||||
|
||||
fn check_ty(&mut self, cx: &LateContext<'a, 'tcx>, ty: &'tcx hir::Ty) {
|
||||
use crate::rustc::hir::intravisit::Visitor;
|
||||
use rustc::hir::intravisit::Visitor;
|
||||
|
||||
MutVisitor { cx }.visit_ty(ty);
|
||||
}
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty::subst::Subst;
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::span_lint;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::subst::Subst;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Detects giving a mutable reference to a function that only
|
||||
/// requires an immutable reference.
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
//!
|
||||
//! This lint is **warn** by default
|
||||
|
||||
use crate::rustc::hir::Expr;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast;
|
||||
use crate::utils::{match_type, paths, span_lint};
|
||||
use rustc::hir::Expr;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast;
|
||||
|
||||
/// **What it does:** Checks for usages of `Mutex<X>` where an atomic will do.
|
||||
///
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
//!
|
||||
//! This lint is **warn** by default
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::LitKind;
|
||||
use crate::syntax::source_map::Spanned;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{in_macro, span_lint, span_lint_and_sugg};
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::source_map::Spanned;
|
||||
|
||||
/// **What it does:** Checks for expressions of the form `if c { true } else {
|
||||
/// false }`
|
||||
|
|
|
@ -11,15 +11,15 @@
|
|||
//!
|
||||
//! This lint is **warn** by default
|
||||
|
||||
use crate::rustc::hir::{BindingAnnotation, Expr, ExprKind, Item, MutImmutable, Pat, PatKind};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::ty::adjustment::{Adjust, Adjustment};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::NodeId;
|
||||
use crate::utils::{in_macro, snippet_opt, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::{BindingAnnotation, Expr, ExprKind, Item, MutImmutable, Pat, PatKind};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::ty::adjustment::{Adjust, Adjustment};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::NodeId;
|
||||
|
||||
/// **What it does:** Checks for address of operations (`&`) that are going to
|
||||
/// be dereferenced immediately by the compiler.
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
//!
|
||||
//! This lint is **warn** by default
|
||||
|
||||
use crate::rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::{in_macro, snippet, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for useless borrowed references.
|
||||
///
|
||||
|
|
|
@ -36,11 +36,11 @@
|
|||
//! ```
|
||||
//!
|
||||
//! This lint is **warn** by default.
|
||||
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 rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use std::borrow::Cow;
|
||||
use syntax::ast;
|
||||
use syntax::source_map::{original_sp, DUMMY_SP};
|
||||
|
||||
use crate::utils::{in_macro, snippet, snippet_block, span_help_and_lint, trim_multiline};
|
||||
|
||||
|
|
|
@ -7,20 +7,6 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::intravisit::FnKind;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::middle::expr_use_visitor as euv;
|
||||
use crate::rustc::middle::mem_categorization as mc;
|
||||
use crate::rustc::traits;
|
||||
use crate::rustc::ty::{self, RegionKind, TypeFoldable};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::rustc_target::spec::abi::Abi;
|
||||
use crate::syntax::ast::NodeId;
|
||||
use crate::syntax::errors::DiagnosticBuilder;
|
||||
use crate::syntax_pos::Span;
|
||||
use crate::utils::ptr::get_spans;
|
||||
use crate::utils::{
|
||||
get_trait_def_id, implements_trait, in_macro, is_copy, is_self, match_type, multispan_sugg, paths, snippet,
|
||||
|
@ -28,7 +14,21 @@ use crate::utils::{
|
|||
};
|
||||
use if_chain::if_chain;
|
||||
use matches::matches;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::middle::expr_use_visitor as euv;
|
||||
use rustc::middle::mem_categorization as mc;
|
||||
use rustc::traits;
|
||||
use rustc::ty::{self, RegionKind, TypeFoldable};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use std::borrow::Cow;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::errors::DiagnosticBuilder;
|
||||
use syntax_pos::Span;
|
||||
|
||||
/// **What it does:** Checks for functions taking arguments by value, but not
|
||||
/// consuming them in its
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::{Expr, ExprKind};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::span_lint;
|
||||
use rustc::hir::{Expr, ExprKind};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for needlessly including a base struct on update
|
||||
/// when all fields are changed anyway.
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
use crate::utils::{self, paths, span_lint};
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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, Spanned};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::source_map::{Span, Spanned};
|
||||
|
||||
use crate::consts::{self, Constant};
|
||||
use crate::utils::span_lint;
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir;
|
||||
use crate::rustc::hir::def_id::DefId;
|
||||
use crate::rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use crate::rustc::ty::{self, Ty};
|
||||
use crate::rustc::util::nodemap::NodeSet;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::utils::paths;
|
||||
use crate::utils::sugg::DiagnosticBuilderExt;
|
||||
use crate::utils::{get_trait_def_id, implements_trait, return_ty, same_tys, span_lint_node_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintContext, LintPass};
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::util::nodemap::NodeSet;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::source_map::Span;
|
||||
|
||||
/// **What it does:** Checks for types with a `fn new() -> Self` method and no
|
||||
/// implementation of
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::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_errors::Applicability;
|
||||
use crate::utils::{has_drop, in_macro, snippet_opt, span_lint, span_lint_and_sugg};
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::{BinOpKind, BlockCheckMode, Expr, ExprKind, Stmt, StmtKind, UnsafeSource};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::ops::Deref;
|
||||
|
||||
/// **What it does:** Checks for statements which have no effect.
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
//!
|
||||
//! This lint is **deny** by default.
|
||||
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass};
|
||||
use crate::rustc::ty::adjustment::Adjust;
|
||||
use crate::rustc::ty::{self, TypeFlags};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::rustc_typeck::hir_ty_to_ty;
|
||||
use crate::syntax_pos::{Span, DUMMY_SP};
|
||||
use crate::utils::{in_constant, in_macro, is_copy, span_lint_and_then};
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, Lint, LintArray, LintPass};
|
||||
use rustc::ty::adjustment::Adjust;
|
||||
use rustc::ty::{self, TypeFlags};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_typeck::hir_ty_to_ty;
|
||||
use std::ptr;
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
|
||||
/// **What it does:** Checks for declaration of `const` items which is interior
|
||||
/// mutable (e.g. contains a `Cell`, `Mutex`, `AtomicXxxx` etc).
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::*;
|
||||
use crate::syntax::attr;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::syntax::symbol::LocalInternedString;
|
||||
use crate::syntax::visit::{walk_block, walk_expr, walk_pat, Visitor};
|
||||
use crate::utils::{span_lint, span_lint_and_then};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::*;
|
||||
use syntax::attr;
|
||||
use syntax::source_map::Span;
|
||||
use syntax::symbol::LocalInternedString;
|
||||
use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor};
|
||||
|
||||
/// **What it does:** Checks for names that are very similar and thus confusing.
|
||||
///
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::{match_type, method_chain_args, paths, snippet, span_help_and_lint};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:*** Checks for unnecessary `ok()` in if let.
|
||||
///
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
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};
|
||||
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};
|
||||
|
||||
/// **What it does:** Checks for duplicate open options as well as combinations
|
||||
/// that make no sense.
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::{span_lint, SpanlessEq};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Detects classic underflow/overflow checks.
|
||||
///
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ast::LitKind;
|
||||
use crate::syntax::ext::quote::rt::Span;
|
||||
use crate::syntax::ptr::P;
|
||||
use crate::utils::{is_direct_expn_of, is_expn_of, match_def_path, opt_def_id, paths, resolve_node, span_lint};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ast::LitKind;
|
||||
use syntax::ext::quote::rt::Span;
|
||||
use syntax::ptr::P;
|
||||
|
||||
/// **What it does:** Checks for missing parameters in `panic!`.
|
||||
///
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::utils::{is_automatically_derived, span_lint_node};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
|
||||
/// **What it does:** Checks for manual re-implementations of `PartialEq::ne`.
|
||||
///
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use crate::syntax::source_map::Spanned;
|
||||
use crate::utils::{in_macro, snippet_with_applicability, span_lint_and_sugg};
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::*;
|
||||
use syntax::source_map::Spanned;
|
||||
|
||||
/// **What it does:** Checks for operations where precedence may be unclear
|
||||
/// and suggests to add parentheses. Currently it catches the following:
|
||||
|
@ -138,7 +138,7 @@ fn is_arith_expr(expr: &Expr) -> bool {
|
|||
}
|
||||
|
||||
fn is_bit_op(op: BinOpKind) -> bool {
|
||||
use crate::syntax::ast::BinOpKind::*;
|
||||
use syntax::ast::BinOpKind::*;
|
||||
match op {
|
||||
BitXor | BitAnd | BitOr | Shl | Shr => true,
|
||||
_ => false,
|
||||
|
@ -146,7 +146,7 @@ fn is_bit_op(op: BinOpKind) -> bool {
|
|||
}
|
||||
|
||||
fn is_arith_op(op: BinOpKind) -> bool {
|
||||
use crate::syntax::ast::BinOpKind::*;
|
||||
use syntax::ast::BinOpKind::*;
|
||||
match op {
|
||||
Add | Sub | Mul | Div | Rem => true,
|
||||
_ => false,
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
|
||||
//! Checks for usage of `&Vec[_]` and `&String`.
|
||||
|
||||
use crate::rustc::hir::QPath;
|
||||
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::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::NodeId;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::syntax_pos::MultiSpan;
|
||||
use crate::utils::ptr::get_spans;
|
||||
use crate::utils::{match_qpath, match_type, paths, snippet_opt, span_lint, span_lint_and_then, walk_ptrs_hir_ty};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::QPath;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::borrow::Cow;
|
||||
use syntax::ast::NodeId;
|
||||
use syntax::source_map::Span;
|
||||
use syntax_pos::MultiSpan;
|
||||
|
||||
/// **What it does:** This lint checks for function arguments of type `&String`
|
||||
/// or `&Vec` unless the references are mutable. It will also suggest you
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::{declare_tool_lint, hir, lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils;
|
||||
use rustc::{declare_tool_lint, hir, lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::fmt;
|
||||
|
||||
/// **What it does:** Checks for usage of the `offset` pointer method with a `usize` casted to an
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::def::Def;
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::syntax::ptr::P;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use syntax::ptr::P;
|
||||
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::utils::paths::*;
|
||||
use crate::utils::{match_def_path, match_type, span_lint_and_then, SpanlessEq};
|
||||
use rustc_errors::Applicability;
|
||||
|
||||
/// **What it does:** Checks for expressions that could be replaced by the question mark operator
|
||||
///
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::*;
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::RangeLimits;
|
||||
use crate::syntax::source_map::Spanned;
|
||||
use crate::utils::sugg::Sugg;
|
||||
use crate::utils::{get_trait_def_id, higher, implements_trait, SpanlessEq};
|
||||
use crate::utils::{is_integer_literal, paths, snippet, snippet_opt, span_lint, span_lint_and_then};
|
||||
use if_chain::if_chain;
|
||||
use rustc::hir::*;
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::RangeLimits;
|
||||
use syntax::source_map::Spanned;
|
||||
|
||||
/// **What it does:** Checks for calling `.step_by(0)` on iterators,
|
||||
/// which never terminates.
|
||||
|
|
|
@ -7,28 +7,28 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::hir::intravisit::FnKind;
|
||||
use crate::rustc::hir::{def_id, Body, FnDecl};
|
||||
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use crate::rustc::mir::{
|
||||
self, traversal,
|
||||
visit::{MutatingUseContext, PlaceContext, Visitor},
|
||||
TerminatorKind,
|
||||
};
|
||||
use crate::rustc::ty;
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::{
|
||||
ast::NodeId,
|
||||
source_map::{BytePos, Span},
|
||||
};
|
||||
use crate::utils::{
|
||||
has_drop, in_macro, is_copy, match_def_path, match_type, paths, snippet_opt, span_lint_node,
|
||||
span_lint_node_and_then, walk_ptrs_ty_depth,
|
||||
};
|
||||
use if_chain::if_chain;
|
||||
use matches::matches;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::hir::{def_id, Body, FnDecl};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::mir::{
|
||||
self, traversal,
|
||||
visit::{MutatingUseContext, PlaceContext, Visitor},
|
||||
TerminatorKind,
|
||||
};
|
||||
use rustc::ty;
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use std::convert::TryFrom;
|
||||
use syntax::{
|
||||
ast::NodeId,
|
||||
source_map::{BytePos, Span},
|
||||
};
|
||||
|
||||
macro_rules! unwrap_or_continue {
|
||||
($x:expr) => {
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use crate::rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use crate::rustc::{declare_tool_lint, lint_array};
|
||||
use crate::rustc_errors::Applicability;
|
||||
use crate::syntax::ast::*;
|
||||
use crate::utils::span_lint_and_sugg;
|
||||
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::ast::*;
|
||||
|
||||
/// **What it does:** Checks for fields in struct literals where shorthands
|
||||
/// could be used.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue