1
Fork 0

Run rustfix

This commit is contained in:
Mateusz Mikuła 2018-05-30 10:15:50 +02:00 committed by Mateusz Mikuła
parent 26f3feb980
commit 424a33720d
112 changed files with 182 additions and 182 deletions

View file

@ -3,7 +3,7 @@ use rustc::lint::*;
use std::f64::consts as f64; use std::f64::consts as f64;
use syntax::ast::{FloatTy, Lit, LitKind}; use syntax::ast::{FloatTy, Lit, LitKind};
use syntax::symbol; use syntax::symbol;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for floating point literals that approximate /// **What it does:** Checks for floating point literals that approximate
/// constants which are defined in /// constants which are defined in

View file

@ -1,7 +1,7 @@
use rustc::hir; use rustc::hir;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for plain integer arithmetic. /// **What it does:** Checks for plain integer arithmetic.
/// ///

View file

@ -1,10 +1,10 @@
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
use rustc::hir; use rustc::hir;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use syntax::ast::RangeLimits; use syntax::ast::RangeLimits;
use utils::higher::Range; use crate::utils::higher::Range;
use utils::{self, higher}; use crate::utils::{self, higher};
/// **What it does:** Checks for out of bounds array indexing with a constant /// **What it does:** Checks for out of bounds array indexing with a constant
/// index. /// index.

View file

@ -2,8 +2,8 @@ use rustc::hir;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::*; use rustc::lint::*;
use syntax::ast; use syntax::ast;
use utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq}; use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq};
use utils::{higher, sugg}; use crate::utils::{higher, sugg};
/// **What it does:** Checks for compound assignment operations (`+=` and /// **What it does:** Checks for compound assignment operations (`+=` and
/// similar). /// similar).
@ -145,7 +145,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
$($trait_name:ident:$full_trait_name:ident),+) => { $($trait_name:ident:$full_trait_name:ident),+) => {
match $op { match $op {
$(hir::$full_trait_name => { $(hir::$full_trait_name => {
let [krate, module] = ::utils::paths::OPS_MODULE; let [krate, module] = crate::utils::paths::OPS_MODULE;
let path = [krate, module, concat!(stringify!($trait_name), "Assign")]; let path = [krate, module, concat!(stringify!($trait_name), "Assign")];
let trait_id = if let Some(trait_id) = get_trait_def_id($cx, &path) { let trait_id = if let Some(trait_id) = get_trait_def_id($cx, &path) {
trait_id trait_id

View file

@ -1,13 +1,13 @@
//! checks for attributes //! checks for attributes
use reexport::*; use crate::reexport::*;
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty::{self, TyCtxt}; use rustc::ty::{self, TyCtxt};
use semver::Version; use semver::Version;
use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind}; use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{ use crate::utils::{
in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then, in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then,
without_block_comments, without_block_comments,
}; };

View file

@ -2,9 +2,9 @@ use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{span_lint, span_lint_and_then}; use crate::utils::{span_lint, span_lint_and_then};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
/// **What it does:** Checks for incompatible bit masks in comparisons. /// **What it does:** Checks for incompatible bit masks in comparisons.
/// ///

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for usage of blacklisted names for variables, such /// **What it does:** Checks for usage of blacklisted names for variables, such
/// as `foo`. /// as `foo`.

View file

@ -1,7 +1,7 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use utils::*; use crate::utils::*;
/// **What it does:** Checks for `if` conditions that use blocks to contain an /// **What it does:** Checks for `if` conditions that use blocks to contain an
/// expression. /// expression.

View file

@ -4,7 +4,7 @@ use rustc::hir::intravisit::*;
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID}; use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
use syntax::codemap::{dummy_spanned, Span, DUMMY_SP}; use syntax::codemap::{dummy_spanned, Span, DUMMY_SP};
use syntax::util::ThinVec; use syntax::util::ThinVec;
use utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq}; use crate::utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq};
/// **What it does:** Checks for boolean expressions that can be written more /// **What it does:** Checks for boolean expressions that can be written more
/// concisely. /// concisely.

View file

@ -2,7 +2,7 @@ use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use syntax::ast::{Name, UintTy}; use syntax::ast::{Name, UintTy};
use utils::{contains_name, get_pat_name, match_type, paths, single_segment_path, snippet, span_lint_and_sugg, use crate::utils::{contains_name, get_pat_name, match_type, paths, single_segment_path, snippet, span_lint_and_sugg,
walk_ptrs_ty}; walk_ptrs_ty};
/// **What it does:** Checks for naive byte counts /// **What it does:** Checks for naive byte counts

View file

@ -15,8 +15,8 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast; use syntax::ast;
use utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then}; use crate::utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
/// **What it does:** Checks for nested `if` statements which can be collapsed /// **What it does:** Checks for nested `if` statements which can be collapsed
/// by `&&`-combining their conditions and for `else { if ... }` expressions /// by `&&`-combining their conditions and for `else { if ... }` expressions

View file

@ -1,6 +1,6 @@
use syntax::ast::*; use syntax::ast::*;
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass}; use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
use utils::{in_macro, snippet, span_lint_and_then}; use crate::utils::{in_macro, snippet, span_lint_and_then};
/// **What it does:** Checks for constants with an explicit `'static` lifetime. /// **What it does:** Checks for constants with an explicit `'static` lifetime.
/// ///

View file

@ -14,7 +14,7 @@ use std::rc::Rc;
use syntax::ast::{FloatTy, LitKind}; use syntax::ast::{FloatTy, LitKind};
use syntax::ptr::P; use syntax::ptr::P;
use rustc::middle::const_val::ConstVal; use rustc::middle::const_val::ConstVal;
use utils::{sext, unsext, clip}; use crate::utils::{sext, unsext, clip};
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub enum FloatWidth { pub enum FloatWidth {

View file

@ -5,8 +5,8 @@ use std::collections::HashMap;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use syntax::symbol::LocalInternedString; use syntax::symbol::LocalInternedString;
use syntax::util::small_vector::SmallVector; use syntax::util::small_vector::SmallVector;
use utils::{SpanlessEq, SpanlessHash}; use crate::utils::{SpanlessEq, SpanlessHash};
use utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint}; use crate::utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
/// **What it does:** Checks for consecutive `if`s with the same condition. /// **What it does:** Checks for consecutive `if`s with the same condition.
/// ///

View file

@ -8,7 +8,7 @@ use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use syntax::ast::{Attribute, NodeId}; use syntax::ast::{Attribute, NodeId};
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack}; use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
/// **What it does:** Checks for methods with high cyclomatic complexity. /// **What it does:** Checks for methods with high cyclomatic complexity.
/// ///

View file

@ -2,8 +2,8 @@ use rustc::lint::*;
use rustc::ty::{self, Ty}; use rustc::ty::{self, Ty};
use rustc::hir::*; use rustc::hir::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::paths; use crate::utils::paths;
use utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then}; use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
/// **What it does:** Checks for deriving `Hash` but implementing `PartialEq` /// **What it does:** Checks for deriving `Hash` but implementing `PartialEq`
/// explicitly or vice versa. /// explicitly or vice versa.

View file

@ -4,7 +4,7 @@ use rustc::lint::*;
use syntax::ast; use syntax::ast;
use syntax::codemap::{BytePos, Span}; use syntax::codemap::{BytePos, Span};
use syntax_pos::Pos; use syntax_pos::Pos;
use utils::span_lint; use crate::utils::span_lint;
use url::Url; use url::Url;
/// **What it does:** Checks for the presence of `_`, `::` or camel-case words /// **What it does:** Checks for the presence of `_`, `::` or camel-case words

View file

@ -4,7 +4,7 @@ use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{snippet, span_lint_and_sugg, SpanlessEq}; use crate::utils::{snippet, span_lint_and_sugg, SpanlessEq};
/// **What it does:** Checks for double comparions that could be simpified to a single expression. /// **What it does:** Checks for double comparions that could be simpified to a single expression.
/// ///

View file

@ -1,7 +1,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use rustc::hir::*; use rustc::hir::*;
use utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint}; use crate::utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint};
/// **What it does:** Checks for calls to `std::mem::drop` with a reference /// **What it does:** Checks for calls to `std::mem::drop` with a reference
/// instead of an owned value. /// instead of an owned value.

View file

@ -3,7 +3,7 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use utils::{in_external_macro, span_lint_and_sugg}; use crate::utils::{in_external_macro, span_lint_and_sugg};
/// **What it does:** Checks for usage of if expressions with an `else if` branch, /// **What it does:** Checks for usage of if expressions with an `else if` branch,
/// but without a final `else` branch. /// but without a final `else` branch.

View file

@ -2,7 +2,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::span_lint_and_then; use crate::utils::span_lint_and_then;
/// **What it does:** Checks for `enum`s with no variants. /// **What it does:** Checks for `enum`s with no variants.
/// ///

View file

@ -2,8 +2,8 @@ use rustc::hir::*;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::SpanlessEq; use crate::utils::SpanlessEq;
use utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty}; use crate::utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty};
/// **What it does:** Checks for uses of `contains_key` + `insert` on `HashMap` /// **What it does:** Checks for uses of `contains_key` + `insert` on `HashMap`
/// or `BTreeMap`. /// or `BTreeMap`.

View file

@ -6,8 +6,8 @@ use rustc::hir::*;
use rustc::ty; use rustc::ty;
use rustc::ty::subst::Substs; use rustc::ty::subst::Substs;
use syntax::ast::{IntTy, UintTy}; use syntax::ast::{IntTy, UintTy};
use utils::span_lint; use crate::utils::span_lint;
use consts::{Constant, miri_to_const}; use crate::consts::{Constant, miri_to_const};
use rustc::ty::util::IntTypeExt; use rustc::ty::util::IntTypeExt;
use rustc::mir::interpret::GlobalId; use rustc::mir::interpret::GlobalId;

View file

@ -5,7 +5,7 @@ use rustc::hir::def::Def;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use syntax::ast::NodeId; use syntax::ast::NodeId;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for `use Enum::*`. /// **What it does:** Checks for `use Enum::*`.
/// ///

View file

@ -4,8 +4,8 @@ use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::symbol::LocalInternedString; use syntax::symbol::LocalInternedString;
use utils::{span_help_and_lint, span_lint}; use crate::utils::{span_help_and_lint, span_lint};
use utils::{camel_case_from, camel_case_until, in_macro}; use crate::utils::{camel_case_from, camel_case_until, in_macro};
/// **What it does:** Detects enumeration variants that are prefixed or suffixed /// **What it does:** Detects enumeration variants that are prefixed or suffixed
/// by the same characters. /// by the same characters.

View file

@ -1,6 +1,6 @@
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq}; use crate::utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};
/// **What it does:** Checks for equal operands to comparison, logical and /// **What it does:** Checks for equal operands to comparison, logical and
/// bitwise, difference and division binary operators (`==`, `>`, etc., `&&`, /// bitwise, difference and division binary operators (`==`, `>`, etc., `&&`,

View file

@ -1,8 +1,8 @@
use consts::{constant_simple, Constant}; use crate::consts::{constant_simple, Constant};
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{in_macro, span_lint}; use crate::utils::{in_macro, span_lint};
/// **What it does:** Checks for erasing operations, e.g. `x * 0`. /// **What it does:** Checks for erasing operations, e.g. `x * 0`.
/// ///

View file

@ -9,7 +9,7 @@ use rustc::ty::layout::LayoutOf;
use rustc::util::nodemap::NodeSet; use rustc::util::nodemap::NodeSet;
use syntax::ast::NodeId; use syntax::ast::NodeId;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::span_lint; use crate::utils::span_lint;
pub struct Pass { pub struct Pass {
pub too_large_for_stack: u64, pub too_large_for_stack: u64,

View file

@ -1,7 +1,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use rustc::hir::*; use rustc::hir::*;
use utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then}; use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then};
#[allow(missing_copy_implementations)] #[allow(missing_copy_implementations)]
pub struct EtaPass; pub struct EtaPass;

View file

@ -3,7 +3,7 @@ use rustc::hir::*;
use rustc::ty; use rustc::ty;
use rustc::lint::*; use rustc::lint::*;
use syntax::ast; use syntax::ast;
use utils::{get_parent_expr, span_lint, span_note_and_lint}; use crate::utils::{get_parent_expr, span_lint, span_note_and_lint};
/// **What it does:** Checks for a read and a write to the same variable where /// **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 /// whether the read occurs before or after the write depends on the evaluation

View file

@ -6,7 +6,7 @@ use std::f64;
use std::fmt; use std::fmt;
use syntax::ast::*; use syntax::ast::*;
use syntax_pos::symbol::Symbol; use syntax_pos::symbol::Symbol;
use utils::span_lint_and_sugg; use crate::utils::span_lint_and_sugg;
/// **What it does:** Checks for float literals with a precision greater /// **What it does:** Checks for float literals with a precision greater
/// than that supported by the underlying type /// than that supported by the underlying type

View file

@ -1,7 +1,7 @@
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use utils::{is_expn_of, match_def_path, resolve_node, span_lint}; use crate::utils::{is_expn_of, match_def_path, resolve_node, span_lint};
use utils::opt_def_id; use crate::utils::opt_def_id;
/// **What it does:** Checks for usage of `write!()` / `writeln()!` which can be /// **What it does:** Checks for usage of `write!()` / `writeln()!` which can be
/// replaced with `(e)print!()` / `(e)println!()` /// replaced with `(e)print!()` / `(e)println!()`

View file

@ -2,8 +2,8 @@ use rustc::lint::*;
use rustc::hir; use rustc::hir;
use rustc::ty; use rustc::ty;
use syntax_pos::Span; use syntax_pos::Span;
use utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of}; use crate::utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of};
use utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT}; use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT};
/// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()` /// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()`
/// ///

View file

@ -3,8 +3,8 @@ use rustc::lint::*;
use rustc::ty; use rustc::ty;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use syntax_pos::Span; use syntax_pos::Span;
use utils::paths; use crate::utils::paths;
use 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 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};
/// **What it does:** Checks for the use of `format!("string literal with no /// **What it does:** Checks for the use of `format!("string literal with no
/// argument")` and `format!("{}", foo)` where `foo` is a string. /// argument")` and `format!("{}", foo)` where `foo` is a string.

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast; use syntax::ast;
use utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint}; use crate::utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint};
use syntax::ptr::P; use syntax::ptr::P;
/// **What it does:** Checks for use of the non-existent `=*`, `=!` and `=-` /// **What it does:** Checks for use of the non-existent `=*`, `=!` and `=-`

View file

@ -7,7 +7,7 @@ use std::collections::HashSet;
use syntax::ast; use syntax::ast;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{iter_input_pats, span_lint, type_is_unsafe_function}; use crate::utils::{iter_input_pats, span_lint, type_is_unsafe_function};
/// **What it does:** Checks for functions with too many parameters. /// **What it does:** Checks for functions with too many parameters.
/// ///

View file

@ -1,8 +1,8 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use syntax::ast::NodeId; use syntax::ast::NodeId;
use utils::{in_macro, match_def_path, match_trait_method, same_tys, snippet, span_lint_and_then}; use crate::utils::{in_macro, match_def_path, match_trait_method, same_tys, snippet, span_lint_and_then};
use utils::{opt_def_id, paths, resolve_node}; use crate::utils::{opt_def_id, paths, resolve_node};
/// **What it does:** Checks for always-identical `Into`/`From` conversions. /// **What it does:** Checks for always-identical `Into`/`From` conversions.
/// ///

View file

@ -1,8 +1,8 @@
use consts::{constant_simple, Constant}; use crate::consts::{constant_simple, Constant};
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{in_macro, snippet, span_lint, unsext, clip}; use crate::utils::{in_macro, snippet, span_lint, unsext, clip};
use rustc::ty; use rustc::ty;
/// **What it does:** Checks for identity operations, e.g. `x + 0`. /// **What it does:** Checks for identity operations, e.g. `x + 0`.

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::{match_qpath, paths, snippet, span_lint_and_then}; use crate::utils::{match_qpath, paths, snippet, span_lint_and_then};
/// **What it does:*** Lint for redundant pattern matching over `Result` or /// **What it does:*** Lint for redundant pattern matching over `Result` or
/// `Option` /// `Option`

View file

@ -4,7 +4,7 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use utils::{in_external_macro, span_help_and_lint}; use crate::utils::{in_external_macro, span_help_and_lint};
/// **What it does:** Checks for usage of `!` or `!=` in an if condition with an /// **What it does:** Checks for usage of `!` or `!=` in an if condition with an
/// else branch. /// else branch.

View file

@ -1,6 +1,6 @@
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use utils::{get_trait_def_id, higher, implements_trait, match_qpath, paths, span_lint}; use crate::utils::{get_trait_def_id, higher, implements_trait, match_qpath, paths, span_lint};
/// **What it does:** Checks for iteration that is guaranteed to be infinite. /// **What it does:** Checks for iteration that is guaranteed to be infinite.
/// ///

View file

@ -3,8 +3,8 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use syntax::ast::{Attribute, Name}; use syntax::ast::{Attribute, Name};
use utils::span_lint_and_then; use crate::utils::span_lint_and_then;
use utils::sugg::DiagnosticBuilderExt; use crate::utils::sugg::DiagnosticBuilderExt;
/// **What it does:** Checks for `#[inline]` on trait methods without bodies /// **What it does:** Checks for `#[inline]` on trait methods without bodies
/// ///

View file

@ -3,7 +3,7 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use utils::{snippet_opt, span_lint_and_then}; use crate::utils::{snippet_opt, span_lint_and_then};
/// **What it does:** Checks for usage of `x >= y + 1` or `x - 1 >= y` (and `<=`) in a block /// **What it does:** Checks for usage of `x >= y + 1` or `x - 1 >= y` (and `<=`) in a block
/// ///

View file

@ -1,7 +1,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use rustc::hir::*; use rustc::hir::*;
use utils::{match_def_path, opt_def_id, paths, span_help_and_lint}; use crate::utils::{match_def_path, opt_def_id, paths, span_help_and_lint};
/// **What it does:** Checks for creation of references to zeroed or uninitialized memory. /// **What it does:** Checks for creation of references to zeroed or uninitialized memory.
/// ///

View file

@ -2,7 +2,7 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use utils::{in_macro, span_lint}; use crate::utils::{in_macro, span_lint};
/// **What it does:** Checks for items declared after some statement in a block. /// **What it does:** Checks for items declared after some statement in a block.
/// ///

View file

@ -2,7 +2,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::{snippet_opt, span_lint_and_then}; use crate::utils::{snippet_opt, span_lint_and_then};
use rustc::ty::layout::LayoutOf; use rustc::ty::layout::LayoutOf;
/// **What it does:** Checks for large size differences between variants on /// **What it does:** Checks for large size differences between variants on

View file

@ -5,7 +5,7 @@ use rustc::ty;
use std::collections::HashSet; use std::collections::HashSet;
use syntax::ast::{Lit, LitKind, Name}; use syntax::ast::{Lit, LitKind, Name};
use syntax::codemap::{Span, Spanned}; use syntax::codemap::{Span, Spanned};
use utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, walk_ptrs_ty}; use crate::utils::{get_item_name, in_macro, snippet, span_lint, span_lint_and_sugg, walk_ptrs_ty};
/// **What it does:** Checks for getting the length of something via `.len()` /// **What it does:** Checks for getting the length of something via `.len()`
/// just to compare to zero, and suggests using `.is_empty()` where applicable. /// just to compare to zero, and suggests using `.is_empty()` where applicable.

View file

@ -3,7 +3,7 @@ use rustc::hir;
use rustc::hir::BindingAnnotation; use rustc::hir::BindingAnnotation;
use rustc::hir::def::Def; use rustc::hir::def::Def;
use syntax::ast; use syntax::ast;
use utils::{snippet, span_lint_and_then}; use crate::utils::{snippet, span_lint_and_then};
/// **What it does:** Checks for variable declarations immediately followed by a /// **What it does:** Checks for variable declarations immediately followed by a
/// conditional affectation. /// conditional affectation.

View file

@ -1,11 +1,11 @@
use reexport::*; use crate::reexport::*;
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::def::Def; use rustc::hir::def::Def;
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::intravisit::*; use rustc::hir::intravisit::*;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{in_external_macro, last_path_segment, span_lint}; use crate::utils::{in_external_macro, last_path_segment, span_lint};
use syntax::symbol::keywords; use syntax::symbol::keywords;
/// **What it does:** Checks for lifetime annotations which can be removed by /// **What it does:** Checks for lifetime annotations which can be removed by

View file

@ -4,7 +4,7 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use syntax_pos; use syntax_pos;
use utils::{in_external_macro, snippet_opt, span_lint_and_sugg}; use crate::utils::{in_external_macro, snippet_opt, span_lint_and_sugg};
/// **What it does:** Warns if a long integral or floating-point constant does /// **What it does:** Warns if a long integral or floating-point constant does
/// not contain underscores. /// not contain underscores.

View file

@ -1,5 +1,5 @@
use itertools::Itertools; use itertools::Itertools;
use reexport::*; use crate::reexport::*;
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::def::Def; use rustc::hir::def::Def;
use rustc::hir::def_id; use rustc::hir::def_id;
@ -17,13 +17,13 @@ use std::collections::{HashMap, HashSet};
use std::iter::{once, Iterator}; use std::iter::{once, Iterator};
use syntax::ast; use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{sugg, sext}; use crate::utils::{sugg, sext};
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
use utils::{get_enclosing_block, get_parent_expr, higher, in_external_macro, is_integer_literal, is_refutable, use crate::utils::{get_enclosing_block, get_parent_expr, higher, in_external_macro, is_integer_literal, is_refutable,
last_path_segment, match_trait_method, match_type, match_var, multispan_sugg, snippet, snippet_opt, last_path_segment, match_trait_method, match_type, match_var, multispan_sugg, snippet, snippet_opt,
span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then}; span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then};
use utils::paths; use crate::utils::paths;
/// **What it does:** Checks for for-loops that manually copy items between /// **What it does:** Checks for for-loops that manually copy items between
/// slices that could be optimized by having a memcpy. /// slices that could be optimized by having a memcpy.

View file

@ -2,7 +2,7 @@ use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use rustc::ty; use rustc::ty;
use syntax::ast; use syntax::ast;
use utils::{get_arg_name, is_adjusted, iter_input_pats, match_qpath, match_trait_method, match_type, use crate::utils::{get_arg_name, is_adjusted, iter_input_pats, match_qpath, match_trait_method, match_type,
paths, remove_blocks, snippet, span_help_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth}; paths, remove_blocks, snippet, span_help_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth};
/// **What it does:** Checks for mapping `clone()` over an iterator. /// **What it does:** Checks for mapping `clone()` over an iterator.

View file

@ -3,8 +3,8 @@ use rustc::lint::*;
use rustc::ty; use rustc::ty;
use rustc_errors::{Applicability}; use rustc_errors::{Applicability};
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{in_macro, iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then}; use crate::utils::{in_macro, iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then};
use utils::paths; use crate::utils::paths;
#[derive(Clone)] #[derive(Clone)]
pub struct Pass; pub struct Pass;

View file

@ -5,11 +5,11 @@ use std::cmp::Ordering;
use std::collections::Bound; use std::collections::Bound;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::paths; use crate::utils::paths;
use utils::{expr_block, in_external_macro, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg, use crate::utils::{expr_block, in_external_macro, is_allowed, is_expn_of, match_qpath, match_type, multispan_sugg,
remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty}; remove_blocks, snippet, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
/// **What it does:** Checks for matches with a single arm where an `if let` /// **What it does:** Checks for matches with a single arm where an `if let`
/// will usually suffice. /// will usually suffice.

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::{Expr, ExprCall, ExprPath}; use rustc::hir::{Expr, ExprCall, ExprPath};
use utils::{match_def_path, opt_def_id, paths, span_lint}; use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
/// **What it does:** Checks for usage of `std::mem::forget(t)` where `t` is /// **What it does:** Checks for usage of `std::mem::forget(t)` where `t` is
/// `Drop`. /// `Drop`.

View file

@ -7,13 +7,13 @@ use std::fmt;
use std::iter; use std::iter;
use syntax::ast; use syntax::ast;
use syntax::codemap::{Span, BytePos}; use syntax::codemap::{Span, BytePos};
use utils::{get_arg_name, get_trait_def_id, implements_trait, in_external_macro, in_macro, is_copy, is_self, is_self_ty, use crate::utils::{get_arg_name, get_trait_def_id, implements_trait, in_external_macro, in_macro, is_copy, is_self, is_self_ty,
iter_input_pats, last_path_segment, match_def_path, match_path, match_qpath, match_trait_method, iter_input_pats, last_path_segment, match_def_path, match_path, match_qpath, match_trait_method,
match_type, method_chain_args, match_var, return_ty, remove_blocks, same_tys, single_segment_path, snippet, match_type, method_chain_args, match_var, return_ty, remove_blocks, same_tys, single_segment_path, snippet,
span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth}; span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, walk_ptrs_ty, walk_ptrs_ty_depth};
use utils::paths; use crate::utils::paths;
use utils::sugg; use crate::utils::sugg;
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
#[derive(Clone)] #[derive(Clone)]
pub struct Pass; pub struct Pass;

View file

@ -1,8 +1,8 @@
use consts::{constant_simple, Constant}; use crate::consts::{constant_simple, Constant};
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use std::cmp::{Ordering, PartialOrd}; use std::cmp::{Ordering, PartialOrd};
use utils::{match_def_path, opt_def_id, paths, span_lint}; use crate::utils::{match_def_path, opt_def_id, paths, span_lint};
/// **What it does:** Checks for expressions where `std::cmp::min` and `max` are /// **What it does:** Checks for expressions where `std::cmp::min` and `max` are
/// used to clamp values, but switched so that the result is constant. /// used to clamp values, but switched so that the result is constant.

View file

@ -1,15 +1,15 @@
use reexport::*; use crate::reexport::*;
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::intravisit::FnKind; use rustc::hir::intravisit::FnKind;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use syntax::codemap::{ExpnFormat, Span}; use syntax::codemap::{ExpnFormat, Span};
use utils::{get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal, use crate::utils::{get_item_name, get_parent_expr, implements_trait, in_constant, in_macro, is_integer_literal,
iter_input_pats, last_path_segment, match_qpath, match_trait_method, paths, snippet, span_lint, iter_input_pats, last_path_segment, match_qpath, match_trait_method, paths, snippet, span_lint,
span_lint_and_then, walk_ptrs_ty}; span_lint_and_then, walk_ptrs_ty};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
use syntax::ast::{LitKind, CRATE_NODE_ID}; use syntax::ast::{LitKind, CRATE_NODE_ID};
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
/// **What it does:** Checks for function arguments and let bindings denoted as /// **What it does:** Checks for function arguments and let bindings denoted as
/// `ref`. /// `ref`.

View file

@ -4,7 +4,7 @@ use std::char;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::visit::FnKind; use syntax::visit::FnKind;
use utils::{constants, in_external_macro, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then}; use crate::utils::{constants, in_external_macro, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then};
/// **What it does:** Checks for structure field patterns bound to wildcards. /// **What it does:** Checks for structure field patterns bound to wildcards.
/// ///

View file

@ -24,7 +24,7 @@ use rustc::ty;
use syntax::ast; use syntax::ast;
use syntax::attr; use syntax::attr;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::in_macro; use crate::utils::in_macro;
/// **What it does:** Warns if there is missing doc for any documentable item /// **What it does:** Warns if there is missing doc for any documentable item
/// (public or private). /// (public or private).

View file

@ -2,7 +2,7 @@ use rustc::hir;
use rustc::hir::intravisit; use rustc::hir::intravisit;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use utils::{higher, in_external_macro, span_lint}; use crate::utils::{higher, in_external_macro, span_lint};
/// **What it does:** Checks for instances of `mut mut` references. /// **What it does:** Checks for instances of `mut mut` references.
/// ///

View file

@ -2,7 +2,7 @@ use rustc::lint::*;
use rustc::ty::{self, Ty}; use rustc::ty::{self, Ty};
use rustc::ty::subst::Subst; use rustc::ty::subst::Subst;
use rustc::hir::*; use rustc::hir::*;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Detects giving a mutable reference to a function that only /// **What it does:** Detects giving a mutable reference to a function that only
/// requires an immutable reference. /// requires an immutable reference.

View file

@ -6,7 +6,7 @@ use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty::{self, Ty}; use rustc::ty::{self, Ty};
use rustc::hir::Expr; use rustc::hir::Expr;
use syntax::ast; use syntax::ast;
use utils::{match_type, paths, span_lint}; use crate::utils::{match_type, paths, span_lint};
/// **What it does:** Checks for usages of `Mutex<X>` where an atomic will do. /// **What it does:** Checks for usages of `Mutex<X>` where an atomic will do.
/// ///

View file

@ -6,8 +6,8 @@ use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use syntax::codemap::Spanned; use syntax::codemap::Spanned;
use utils::{snippet, span_lint, span_lint_and_sugg}; use crate::utils::{snippet, span_lint, span_lint_and_sugg};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
/// **What it does:** Checks for expressions of the form `if c { true } else { /// **What it does:** Checks for expressions of the form `if c { true } else {
/// false }` /// false }`

View file

@ -6,7 +6,7 @@ use rustc::lint::*;
use rustc::hir::{BindingAnnotation, Expr, ExprAddrOf, MutImmutable, Pat, PatKind}; use rustc::hir::{BindingAnnotation, Expr, ExprAddrOf, MutImmutable, Pat, PatKind};
use rustc::ty; use rustc::ty;
use rustc::ty::adjustment::{Adjust, Adjustment}; use rustc::ty::adjustment::{Adjust, Adjustment};
use utils::{in_macro, snippet_opt, span_lint_and_then}; use crate::utils::{in_macro, snippet_opt, span_lint_and_then};
/// **What it does:** Checks for address of operations (`&`) that are going to /// **What it does:** Checks for address of operations (`&`) that are going to
/// be dereferenced immediately by the compiler. /// be dereferenced immediately by the compiler.

View file

@ -4,7 +4,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind}; use rustc::hir::{BindingAnnotation, MutImmutable, Pat, PatKind};
use utils::{in_macro, snippet, span_lint_and_then}; use crate::utils::{in_macro, snippet, span_lint_and_then};
/// **What it does:** Checks for useless borrowed references. /// **What it does:** Checks for useless borrowed references.
/// ///

View file

@ -32,7 +32,7 @@ use syntax::ast;
use syntax::codemap::{original_sp, DUMMY_SP}; use syntax::codemap::{original_sp, DUMMY_SP};
use std::borrow::Cow; use std::borrow::Cow;
use utils::{in_macro, snippet, snippet_block, span_help_and_lint, trim_multiline}; use crate::utils::{in_macro, snippet, snippet_block, span_help_and_lint, trim_multiline};
/// **What it does:** The lint checks for `if`-statements appearing in loops /// **What it does:** The lint checks for `if`-statements appearing in loops
/// that contain a `continue` statement in either their main blocks or their /// that contain a `continue` statement in either their main blocks or their

View file

@ -10,9 +10,9 @@ use rustc_target::spec::abi::Abi;
use syntax::ast::NodeId; use syntax::ast::NodeId;
use syntax_pos::Span; use syntax_pos::Span;
use syntax::errors::DiagnosticBuilder; use syntax::errors::DiagnosticBuilder;
use utils::{get_trait_def_id, implements_trait, in_macro, is_copy, is_self, match_type, multispan_sugg, paths, use crate::utils::{get_trait_def_id, implements_trait, in_macro, is_copy, is_self, match_type, multispan_sugg, paths,
snippet, snippet_opt, span_lint_and_then}; snippet, snippet_opt, span_lint_and_then};
use utils::ptr::get_spans; use crate::utils::ptr::get_spans;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::borrow::Cow; use std::borrow::Cow;

View file

@ -1,7 +1,7 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::ty; use rustc::ty;
use rustc::hir::{Expr, ExprStruct}; use rustc::hir::{Expr, ExprStruct};
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for needlessly including a base struct on update /// **What it does:** Checks for needlessly including a base struct on update
/// when all fields are changed anyway. /// when all fields are changed anyway.

View file

@ -2,8 +2,8 @@ use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::{Span, Spanned}; use syntax::codemap::{Span, Spanned};
use consts::{self, Constant}; use crate::consts::{self, Constant};
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for multiplication by -1 as a form of negation. /// **What it does:** Checks for multiplication by -1 as a form of negation.
/// ///

View file

@ -3,9 +3,9 @@ use rustc::hir;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty::{self, Ty}; use rustc::ty::{self, Ty};
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::paths; use crate::utils::paths;
use utils::{get_trait_def_id, implements_trait, in_external_macro, return_ty, same_tys, span_lint_and_then}; use crate::utils::{get_trait_def_id, implements_trait, in_external_macro, return_ty, same_tys, span_lint_and_then};
use utils::sugg::DiagnosticBuilderExt; use crate::utils::sugg::DiagnosticBuilderExt;
/// **What it does:** Checks for types with a `fn new() -> Self` method and no /// **What it does:** Checks for types with a `fn new() -> Self` method and no
/// implementation of /// implementation of

View file

@ -1,7 +1,7 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::hir::def::Def; use rustc::hir::def::Def;
use rustc::hir::{BiAnd, BiOr, BlockCheckMode, Expr, Expr_, Stmt, StmtSemi, UnsafeSource}; use rustc::hir::{BiAnd, BiOr, BlockCheckMode, Expr, Expr_, Stmt, StmtSemi, UnsafeSource};
use utils::{has_drop, in_macro, snippet_opt, span_lint, span_lint_and_sugg}; use crate::utils::{has_drop, in_macro, snippet_opt, span_lint, span_lint_and_sugg};
use std::ops::Deref; use std::ops::Deref;
/// **What it does:** Checks for statements which have no effect. /// **What it does:** Checks for statements which have no effect.

View file

@ -4,7 +4,7 @@ use syntax::symbol::LocalInternedString;
use syntax::ast::*; use syntax::ast::*;
use syntax::attr; use syntax::attr;
use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor}; use syntax::visit::{walk_block, walk_expr, walk_pat, Visitor};
use utils::{in_macro, span_lint, span_lint_and_then}; use crate::utils::{in_macro, span_lint, span_lint_and_then};
/// **What it does:** Checks for names that are very similar and thus confusing. /// **What it does:** Checks for names that are very similar and thus confusing.
/// ///

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::{match_type, method_chain_args, paths, snippet, span_help_and_lint}; use crate::utils::{match_type, method_chain_args, paths, snippet, span_help_and_lint};
/// **What it does:*** Checks for unnecessary `ok()` in if let. /// **What it does:*** Checks for unnecessary `ok()` in if let.
/// ///

View file

@ -2,7 +2,7 @@ use rustc::hir::{Expr, ExprLit, ExprMethodCall};
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use syntax::codemap::{Span, Spanned}; use syntax::codemap::{Span, Spanned};
use utils::{match_type, paths, span_lint, walk_ptrs_ty}; use crate::utils::{match_type, paths, span_lint, walk_ptrs_ty};
/// **What it does:** Checks for duplicate open options as well as combinations /// **What it does:** Checks for duplicate open options as well as combinations
/// that make no sense. /// that make no sense.

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Detects classic underflow/overflow checks. /// **What it does:** Detects classic underflow/overflow checks.
/// ///

View file

@ -3,7 +3,7 @@ use rustc::lint::*;
use syntax::ast::LitKind; use syntax::ast::LitKind;
use syntax::ptr::P; use syntax::ptr::P;
use syntax::ext::quote::rt::Span; use syntax::ext::quote::rt::Span;
use utils::{is_direct_expn_of, is_expn_of, match_def_path, opt_def_id, paths, resolve_node, span_lint}; use crate::utils::{is_direct_expn_of, is_expn_of, match_def_path, opt_def_id, paths, resolve_node, span_lint};
/// **What it does:** Checks for missing parameters in `panic!`. /// **What it does:** Checks for missing parameters in `panic!`.
/// ///

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::{is_automatically_derived, span_lint}; use crate::utils::{is_automatically_derived, span_lint};
/// **What it does:** Checks for manual re-implementations of `PartialEq::ne`. /// **What it does:** Checks for manual re-implementations of `PartialEq::ne`.
/// ///

View file

@ -1,7 +1,7 @@
use rustc::lint::*; use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::Spanned; use syntax::codemap::Spanned;
use utils::{in_macro, snippet, span_lint_and_sugg}; use crate::utils::{in_macro, snippet, span_lint_and_sugg};
/// **What it does:** Checks for operations where precedence may be unclear /// **What it does:** Checks for operations where precedence may be unclear
/// and suggests to add parentheses. Currently it catches the following: /// and suggests to add parentheses. Currently it catches the following:

View file

@ -9,8 +9,8 @@ use rustc::ty;
use syntax::ast::NodeId; use syntax::ast::NodeId;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax_pos::MultiSpan; use syntax_pos::MultiSpan;
use utils::{match_qpath, match_type, paths, snippet_opt, span_lint, span_lint_and_then, walk_ptrs_hir_ty}; use crate::utils::{match_qpath, match_type, paths, snippet_opt, span_lint, span_lint_and_then, walk_ptrs_hir_ty};
use utils::ptr::get_spans; use crate::utils::ptr::get_spans;
/// **What it does:** This lint checks for function arguments of type `&String` /// **What it does:** This lint checks for function arguments of type `&String`
/// or `&Vec` unless the references are mutable. It will also suggest you /// or `&Vec` unless the references are mutable. It will also suggest you

View file

@ -1,11 +1,11 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::def::Def; use rustc::hir::def::Def;
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
use syntax::ptr::P; use syntax::ptr::P;
use utils::{match_def_path, match_type, span_lint_and_then}; use crate::utils::{match_def_path, match_type, span_lint_and_then};
use utils::paths::*; use crate::utils::paths::*;
/// **What it does:** Checks for expressions that could be replaced by the question mark operator /// **What it does:** Checks for expressions that could be replaced by the question mark operator
/// ///

View file

@ -2,9 +2,9 @@ use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use syntax::ast::RangeLimits; use syntax::ast::RangeLimits;
use syntax::codemap::Spanned; use syntax::codemap::Spanned;
use utils::{is_integer_literal, paths, snippet, span_lint, span_lint_and_then}; use crate::utils::{is_integer_literal, paths, snippet, span_lint, span_lint_and_then};
use utils::{get_trait_def_id, higher, implements_trait}; use crate::utils::{get_trait_def_id, higher, implements_trait};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
/// **What it does:** Checks for calling `.step_by(0)` on iterators, /// **What it does:** Checks for calling `.step_by(0)` on iterators,
/// which never terminates. /// which never terminates.
@ -93,7 +93,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
// Range with step_by(0). // Range with step_by(0).
if name == "step_by" && args.len() == 2 && has_step_by(cx, &args[0]) { if name == "step_by" && args.len() == 2 && has_step_by(cx, &args[0]) {
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
if let Some((Constant::Int(0), _)) = constant(cx, cx.tables, &args[1]) { if let Some((Constant::Int(0), _)) = constant(cx, cx.tables, &args[1]) {
span_lint( span_lint(
cx, cx,

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::{in_macro, is_range_expression, match_var, span_lint_and_sugg}; use crate::utils::{in_macro, is_range_expression, match_var, span_lint_and_sugg};
/// **What it does:** Checks for fields in struct literals where shorthands /// **What it does:** Checks for fields in struct literals where shorthands
/// could be used. /// could be used.

View file

@ -1,6 +1,6 @@
use syntax::ast::{Expr, ExprKind, UnOp}; use syntax::ast::{Expr, ExprKind, UnOp};
use rustc::lint::*; use rustc::lint::*;
use utils::{snippet, span_lint_and_sugg}; use crate::utils::{snippet, span_lint_and_sugg};
/// **What it does:** Checks for usage of `*&` and `*&mut` in expressions. /// **What it does:** Checks for usage of `*&` and `*&mut` in expressions.
/// ///

View file

@ -4,8 +4,8 @@ use rustc::lint::*;
use std::collections::HashSet; use std::collections::HashSet;
use syntax::ast::{LitKind, NodeId, StrStyle}; use syntax::ast::{LitKind, NodeId, StrStyle};
use syntax::codemap::{BytePos, Span}; use syntax::codemap::{BytePos, Span};
use utils::{is_expn_of, match_def_path, match_type, opt_def_id, paths, span_help_and_lint, span_lint}; use crate::utils::{is_expn_of, match_def_path, match_type, opt_def_id, paths, span_help_and_lint, span_lint};
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
/// **What it does:** Checks [regex](https://crates.io/crates/regex) creation /// **What it does:** Checks [regex](https://crates.io/crates/regex) creation
/// (with `Regex::new`,`RegexBuilder::new` or `RegexSet::new`) for correct /// (with `Regex::new`,`RegexBuilder::new` or `RegexSet::new`) for correct

View file

@ -1,7 +1,7 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir; use rustc::hir;
use rustc::hir::def::Def; use rustc::hir::def::Def;
use utils::{match_def_path, span_lint_and_sugg}; use crate::utils::{match_def_path, span_lint_and_sugg};
/// **What it does:** Checks for usage of `ATOMIC_X_INIT`, `ONCE_INIT`, and /// **What it does:** Checks for usage of `ATOMIC_X_INIT`, `ONCE_INIT`, and
/// `uX/iX::MIN/MAX`. /// `uX/iX::MIN/MAX`.

View file

@ -3,7 +3,7 @@ use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::visit::FnKind; use syntax::visit::FnKind;
use utils::{in_external_macro, in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint}; use crate::utils::{in_external_macro, in_macro, match_path_ast, snippet_opt, span_lint_and_then, span_note_and_lint};
/// **What it does:** Checks for return statements at the end of a block. /// **What it does:** Checks for return statements at the end of a block.
/// ///

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use utils::{get_trait_def_id, paths, span_lint}; use crate::utils::{get_trait_def_id, paths, span_lint};
/// **What it does:** Checks for mis-uses of the serde API. /// **What it does:** Checks for mis-uses of the serde API.
/// ///

View file

@ -1,10 +1,10 @@
use reexport::*; use crate::reexport::*;
use rustc::lint::*; use rustc::lint::*;
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::intravisit::FnKind; use rustc::hir::intravisit::FnKind;
use rustc::ty; use rustc::ty;
use syntax::codemap::Span; use syntax::codemap::Span;
use utils::{contains_name, higher, in_external_macro, iter_input_pats, snippet, span_lint_and_then}; use crate::utils::{contains_name, higher, in_external_macro, iter_input_pats, snippet, span_lint_and_then};
/// **What it does:** Checks for bindings that shadow other bindings already in /// **What it does:** Checks for bindings that shadow other bindings already in
/// scope, while just changing reference level or mutability. /// scope, while just changing reference level or mutability.

View file

@ -1,8 +1,8 @@
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use syntax::codemap::Spanned; use syntax::codemap::Spanned;
use utils::SpanlessEq; use crate::utils::SpanlessEq;
use utils::{get_parent_expr, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty}; use crate::utils::{get_parent_expr, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty};
/// **What it does:** Checks for string appends of the form `x = x + y` (without /// **What it does:** Checks for string appends of the form `x = x + y` (without
/// `let`!). /// `let`!).
@ -146,7 +146,7 @@ impl LintPass for StringLitAsBytes {
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
use syntax::ast::LitKind; use syntax::ast::LitKind;
use utils::{in_macro, snippet}; use crate::utils::{in_macro, snippet};
if let ExprMethodCall(ref path, _, ref args) = e.node { if let ExprMethodCall(ref path, _, ref args) = e.node {
if path.name == "as_bytes" { if path.name == "as_bytes" {

View file

@ -2,7 +2,7 @@ use rustc::lint::*;
use rustc::hir; use rustc::hir;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use syntax::ast; use syntax::ast;
use utils::{get_trait_def_id, span_lint}; use crate::utils::{get_trait_def_id, span_lint};
/// **What it does:** Lints for suspicious operations in impls of arithmetic operators, e.g. /// **What it does:** Lints for suspicious operations in impls of arithmetic operators, e.g.
/// subtracting elements in an Add impl. /// subtracting elements in an Add impl.
@ -149,7 +149,7 @@ fn check_binop<'a>(
expected_ops: &[hir::BinOp_], expected_ops: &[hir::BinOp_],
) -> Option<&'a str> { ) -> Option<&'a str> {
let mut trait_ids = vec![]; let mut trait_ids = vec![];
let [krate, module] = ::utils::paths::OPS_MODULE; let [krate, module] = crate::utils::paths::OPS_MODULE;
for t in traits { for t in traits {
let path = [krate, module, t]; let path = [krate, module, t];

View file

@ -1,8 +1,8 @@
use rustc::hir::*; use rustc::hir::*;
use rustc::lint::*; use rustc::lint::*;
use rustc::ty; use rustc::ty;
use utils::{differing_macro_contexts, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty, SpanlessEq}; use crate::utils::{differing_macro_contexts, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty, SpanlessEq};
use utils::sugg::Sugg; use crate::utils::sugg::Sugg;
/// **What it does:** Checks for manual swapping. /// **What it does:** Checks for manual swapping.
/// ///

View file

@ -1,7 +1,7 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::hir::{Expr, ExprAssign, ExprField, ExprStruct, ExprTup}; use rustc::hir::{Expr, ExprAssign, ExprField, ExprStruct, ExprTup};
use utils::is_adjusted; use crate::utils::is_adjusted;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for construction of a structure or tuple just to /// **What it does:** Checks for construction of a structure or tuple just to
/// assign a value in it. /// assign a value in it.

View file

@ -3,8 +3,8 @@ use rustc::ty::{self, Ty};
use rustc::hir::*; use rustc::hir::*;
use std::borrow::Cow; use std::borrow::Cow;
use syntax::ast; use syntax::ast;
use utils::{last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then}; use crate::utils::{last_path_segment, match_def_path, paths, snippet, span_lint, span_lint_and_then};
use utils::{opt_def_id, sugg}; use crate::utils::{opt_def_id, sugg};
/// **What it does:** Checks for transmutes that can't ever be correct on any /// **What it does:** Checks for transmutes that can't ever be correct on any
/// architecture. /// architecture.

View file

@ -1,4 +1,4 @@
use reexport::*; use crate::reexport::*;
use rustc::hir; use rustc::hir;
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor}; use rustc::hir::intravisit::{walk_body, walk_expr, walk_ty, FnKind, NestedVisitorMap, Visitor};
@ -12,11 +12,11 @@ use std::borrow::Cow;
use syntax::ast::{FloatTy, IntTy, UintTy}; use syntax::ast::{FloatTy, IntTy, UintTy};
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::errors::DiagnosticBuilder; use syntax::errors::DiagnosticBuilder;
use utils::{comparisons, differing_macro_contexts, higher, in_constant, in_external_macro, in_macro, last_path_segment, match_def_path, match_path, use crate::utils::{comparisons, differing_macro_contexts, higher, in_constant, in_external_macro, in_macro, last_path_segment, match_def_path, match_path,
match_type, multispan_sugg, opt_def_id, same_tys, snippet, snippet_opt, span_help_and_lint, span_lint, match_type, multispan_sugg, opt_def_id, same_tys, snippet, snippet_opt, span_help_and_lint, span_lint,
span_lint_and_sugg, span_lint_and_then, clip, unsext, sext, int_bits}; span_lint_and_sugg, span_lint_and_then, clip, unsext, sext, int_bits};
use utils::paths; use crate::utils::paths;
use consts::{constant, Constant}; use crate::consts::{constant, Constant};
/// Handles all the linting of funky types /// Handles all the linting of funky types
#[allow(missing_copy_implementations)] #[allow(missing_copy_implementations)]
@ -1290,9 +1290,9 @@ fn detect_absurd_comparison<'a, 'tcx>(
lhs: &'tcx Expr, lhs: &'tcx Expr,
rhs: &'tcx Expr, rhs: &'tcx Expr,
) -> Option<(ExtremeExpr<'tcx>, AbsurdComparisonResult)> { ) -> Option<(ExtremeExpr<'tcx>, AbsurdComparisonResult)> {
use types::ExtremeType::*; use crate::types::ExtremeType::*;
use types::AbsurdComparisonResult::*; use crate::types::AbsurdComparisonResult::*;
use utils::comparisons::*; use crate::utils::comparisons::*;
// absurd comparison only makes sense on primitive types // absurd comparison only makes sense on primitive types
// primitive types don't implement comparison operators with each other // primitive types don't implement comparison operators with each other
@ -1337,7 +1337,7 @@ fn detect_absurd_comparison<'a, 'tcx>(
} }
fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> Option<ExtremeExpr<'tcx>> { fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -> Option<ExtremeExpr<'tcx>> {
use types::ExtremeType::*; use crate::types::ExtremeType::*;
let ty = cx.tables.expr_ty(expr); let ty = cx.tables.expr_ty(expr);
@ -1362,8 +1362,8 @@ fn detect_extreme_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) -
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AbsurdExtremeComparisons {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
use types::ExtremeType::*; use crate::types::ExtremeType::*;
use types::AbsurdComparisonResult::*; use crate::types::AbsurdComparisonResult::*;
if let ExprBinary(ref cmp, ref lhs, ref rhs) = expr.node { if let ExprBinary(ref cmp, ref lhs, ref rhs) = expr.node {
if let Some((culprit, result)) = detect_absurd_comparison(cx, cmp.node, lhs, rhs) { if let Some((culprit, result)) = detect_absurd_comparison(cx, cmp.node, lhs, rhs) {
@ -1562,7 +1562,7 @@ fn upcast_comparison_bounds_err<'a, 'tcx>(
rhs: &'tcx Expr, rhs: &'tcx Expr,
invert: bool, invert: bool,
) { ) {
use utils::comparisons::*; use crate::utils::comparisons::*;
if let Some((lb, ub)) = lhs_bounds { if let Some((lb, ub)) = lhs_bounds {
if let Some(norm_rhs_val) = node_as_const_fullint(cx, rhs) { if let Some(norm_rhs_val) = node_as_const_fullint(cx, rhs) {

View file

@ -3,7 +3,7 @@ use rustc::hir::*;
use syntax::ast::{LitKind, NodeId}; use syntax::ast::{LitKind, NodeId};
use syntax::codemap::Span; use syntax::codemap::Span;
use unicode_normalization::UnicodeNormalization; use unicode_normalization::UnicodeNormalization;
use utils::{is_allowed, snippet, span_help_and_lint}; use crate::utils::{is_allowed, snippet, span_help_and_lint};
/// **What it does:** Checks for the Unicode zero-width space in the code. /// **What it does:** Checks for the Unicode zero-width space in the code.
/// ///

View file

@ -2,7 +2,7 @@ use rustc::lint::*;
use syntax::ast::*; use syntax::ast::*;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::symbol::LocalInternedString; use syntax::symbol::LocalInternedString;
use utils::span_lint; use crate::utils::span_lint;
/// **What it does:** Checks for imports that remove "unsafe" from an item's /// **What it does:** Checks for imports that remove "unsafe" from an item's
/// name. /// name.

View file

@ -1,6 +1,6 @@
use rustc::lint::*; use rustc::lint::*;
use rustc::hir; use rustc::hir;
use utils::{is_try, match_qpath, match_trait_method, paths, span_lint}; use crate::utils::{is_try, match_qpath, match_trait_method, paths, span_lint};
/// **What it does:** Checks for unused written/read amount. /// **What it does:** Checks for unused written/read amount.
/// ///

View file

@ -5,7 +5,7 @@ use std::collections::HashMap;
use syntax::ast; use syntax::ast;
use syntax::codemap::Span; use syntax::codemap::Span;
use syntax::symbol::LocalInternedString; use syntax::symbol::LocalInternedString;
use utils::{in_macro, span_lint}; use crate::utils::{in_macro, span_lint};
/// **What it does:** Checks for unused labels. /// **What it does:** Checks for unused labels.
/// ///

View file

@ -1,7 +1,7 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::hir::*; use rustc::hir::*;
use rustc::hir::intravisit::{walk_path, NestedVisitorMap, Visitor}; use rustc::hir::intravisit::{walk_path, NestedVisitorMap, Visitor};
use utils::{in_macro, span_lint_and_then}; use crate::utils::{in_macro, span_lint_and_then};
use syntax::ast::NodeId; use syntax::ast::NodeId;
use syntax_pos::symbol::keywords::SelfType; use syntax_pos::symbol::keywords::SelfType;

Some files were not shown because too many files have changed in this diff Show more