Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 2018 migration #2821

Merged
merged 4 commits into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["edition"]

[package]
name = "clippy"
version = "0.0.205"
Expand All @@ -15,6 +17,7 @@ license = "MPL-2.0"
keywords = ["clippy", "lint", "plugin"]
categories = ["development-tools", "development-tools::cargo-plugins"]
build = "build.rs"
edition = "2018"

[badges]
travis-ci = { repository = "rust-lang-nursery/rust-clippy" }
Expand Down
2 changes: 1 addition & 1 deletion ci/integration-tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -x
cargo install --force
cargo install --force --path .

echo "Running integration test for crate ${INTEGRATION}"

Expand Down
3 changes: 3 additions & 0 deletions clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["edition"]

[package]
name = "clippy_lints"
# begin automatic update
Expand All @@ -14,6 +16,7 @@ repository = "https://github.com/rust-lang-nursery/rust-clippy"
readme = "README.md"
license = "MPL-2.0"
keywords = ["clippy", "lint", "plugin"]
edition = "2018"

[dependencies]
cargo_metadata = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::lint::*;
use std::f64::consts as f64;
use syntax::ast::{FloatTy, Lit, LitKind};
use syntax::symbol;
use utils::span_lint;
use crate::utils::span_lint;

/// **What it does:** Checks for floating point literals that approximate
/// constants which are defined in
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/arithmetic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::hir;
use rustc::lint::*;
use syntax::codemap::Span;
use utils::span_lint;
use crate::utils::span_lint;

/// **What it does:** Checks for plain integer arithmetic.
///
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/array_indexing.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use consts::{constant, Constant};
use crate::consts::{constant, Constant};
use rustc::hir;
use rustc::lint::*;
use rustc::ty;
use syntax::ast::RangeLimits;
use utils::higher::Range;
use utils::{self, higher};
use crate::utils::higher::Range;
use crate::utils::{self, higher};

/// **What it does:** Checks for out of bounds array indexing with a constant
/// index.
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use rustc::hir;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::*;
use syntax::ast;
use utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq};
use utils::{higher, sugg};
use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq};
use crate::utils::{higher, sugg};

/// **What it does:** Checks for compound assignment operations (`+=` and
/// similar).
Expand Down Expand Up @@ -145,7 +145,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
$($trait_name:ident:$full_trait_name:ident),+) => {
match $op {
$(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 trait_id = if let Some(trait_id) = get_trait_def_id($cx, &path) {
trait_id
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//! checks for attributes

use reexport::*;
use crate::reexport::*;
use rustc::hir::*;
use rustc::lint::*;
use rustc::ty::{self, TyCtxt};
use semver::Version;
use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
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,
without_block_comments,
};
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use rustc::hir::*;
use rustc::lint::*;
use syntax::ast::LitKind;
use syntax::codemap::Span;
use utils::{span_lint, span_lint_and_then};
use utils::sugg::Sugg;
use consts::{constant, Constant};
use crate::utils::{span_lint, span_lint_and_then};
use crate::utils::sugg::Sugg;
use crate::consts::{constant, Constant};

/// **What it does:** Checks for incompatible bit masks in comparisons.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/blacklisted_name.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
use rustc::hir::*;
use utils::span_lint;
use crate::utils::span_lint;

/// **What it does:** Checks for usage of blacklisted names for variables, such
/// as `foo`.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::hir::*;
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
/// expression.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::hir::intravisit::*;
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
use syntax::codemap::{dummy_spanned, Span, DUMMY_SP};
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
/// concisely.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/bytecount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rustc::hir::*;
use rustc::lint::*;
use rustc::ty;
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};

/// **What it does:** Checks for naive byte counts
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/collapsible_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use rustc::lint::*;
use syntax::ast;

use utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then};
use utils::sugg::Sugg;
use crate::utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then};
use crate::utils::sugg::Sugg;

/// **What it does:** Checks for nested `if` statements which can be collapsed
/// by `&&`-combining their conditions and for `else { if ... }` expressions
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/const_static_lifetime.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use syntax::ast::*;
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.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::rc::Rc;
use syntax::ast::{FloatTy, LitKind};
use syntax::ptr::P;
use rustc::middle::const_val::ConstVal;
use utils::{sext, unsext, clip};
use crate::utils::{sext, unsext, clip};

#[derive(Debug, Copy, Clone)]
pub enum FloatWidth {
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use std::collections::HashMap;
use std::collections::hash_map::Entry;
use syntax::symbol::LocalInternedString;
use syntax::util::small_vector::SmallVector;
use utils::{SpanlessEq, SpanlessHash};
use utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
use crate::utils::{SpanlessEq, SpanlessHash};
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.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/cyclomatic_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use syntax::ast::{Attribute, NodeId};
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.
///
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use rustc::lint::*;
use rustc::ty::{self, Ty};
use rustc::hir::*;
use syntax::codemap::Span;
use utils::paths;
use utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
use crate::utils::paths;
use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};

/// **What it does:** Checks for deriving `Hash` but implementing `PartialEq`
/// explicitly or vice versa.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::lint::*;
use syntax::ast;
use syntax::codemap::{BytePos, Span};
use syntax_pos::Pos;
use utils::span_lint;
use crate::utils::span_lint;
use url::Url;

/// **What it does:** Checks for the presence of `_`, `::` or camel-case words
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/double_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustc::hir::*;
use rustc::lint::*;
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.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/drop_forget_ref.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::lint::*;
use rustc::ty;
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
/// instead of an owned value.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/else_if_without_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use rustc::lint::*;
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,
/// but without a final `else` branch.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/empty_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use rustc::lint::*;
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.
///
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use rustc::hir::*;
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
use rustc::lint::*;
use syntax::codemap::Span;
use utils::SpanlessEq;
use utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty};
use crate::utils::SpanlessEq;
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`
/// or `BTreeMap`.
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/enum_clike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use rustc::hir::*;
use rustc::ty;
use rustc::ty::subst::Substs;
use syntax::ast::{IntTy, UintTy};
use utils::span_lint;
use consts::{Constant, miri_to_const};
use crate::utils::span_lint;
use crate::consts::{Constant, miri_to_const};
use rustc::ty::util::IntTypeExt;
use rustc::mir::interpret::GlobalId;

Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/enum_glob_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc::hir::def::Def;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use syntax::ast::NodeId;
use syntax::codemap::Span;
use utils::span_lint;
use crate::utils::span_lint;

/// **What it does:** Checks for `use Enum::*`.
///
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use rustc::lint::*;
use syntax::ast::*;
use syntax::codemap::Span;
use syntax::symbol::LocalInternedString;
use utils::{span_help_and_lint, span_lint};
use utils::{camel_case_from, camel_case_until, in_macro};
use crate::utils::{span_help_and_lint, span_lint};
use crate::utils::{camel_case_from, camel_case_until, in_macro};

/// **What it does:** Detects enumeration variants that are prefixed or suffixed
/// by the same characters.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/eq_op.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::hir::*;
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
/// bitwise, difference and division binary operators (`==`, `>`, etc., `&&`,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/erasing_op.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use consts::{constant_simple, Constant};
use crate::consts::{constant_simple, Constant};
use rustc::hir::*;
use rustc::lint::*;
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`.
///
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc::ty::layout::LayoutOf;
use rustc::util::nodemap::NodeSet;
use syntax::ast::NodeId;
use syntax::codemap::Span;
use utils::span_lint;
use crate::utils::span_lint;

pub struct Pass {
pub too_large_for_stack: u64,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/eta_reduction.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::lint::*;
use rustc::ty;
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)]
pub struct EtaPass;
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::hir::*;
use rustc::ty;
use rustc::lint::*;
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
/// whether the read occurs before or after the write depends on the evaluation
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/excessive_precision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::f64;
use std::fmt;
use syntax::ast::*;
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
/// than that supported by the underlying type
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/explicit_write.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc::hir::*;
use rustc::lint::*;
use utils::{is_expn_of, match_def_path, resolve_node, span_lint};
use utils::opt_def_id;
use crate::utils::{is_expn_of, match_def_path, resolve_node, span_lint};
use crate::utils::opt_def_id;

/// **What it does:** Checks for usage of `write!()` / `writeln()!` which can be
/// replaced with `(e)print!()` / `(e)println!()`
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/fallible_impl_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use rustc::lint::*;
use rustc::hir;
use rustc::ty;
use syntax_pos::Span;
use 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::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of};
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()`
///
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use rustc::lint::*;
use rustc::ty;
use syntax::ast::LitKind;
use syntax_pos::Span;
use 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::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};

/// **What it does:** Checks for the use of `format!("string literal with no
/// argument")` and `format!("{}", foo)` where `foo` is a string.
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/formatting.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc::lint::*;
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;

/// **What it does:** Checks for use of the non-existent `=*`, `=!` and `=-`
Expand Down
Loading