Skip to content

Commit bb2f6a5

Browse files
authored
Merge pull request #2821 from mati865/rust-2018-migration
Rust 2018 migration
2 parents b799c1e + cc8c52c commit bb2f6a5

File tree

117 files changed

+192
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+192
-184
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
cargo-features = ["edition"]
2+
13
[package]
24
name = "clippy"
35
version = "0.0.206"
@@ -15,6 +17,7 @@ license = "MPL-2.0"
1517
keywords = ["clippy", "lint", "plugin"]
1618
categories = ["development-tools", "development-tools::cargo-plugins"]
1719
build = "build.rs"
20+
edition = "2018"
1821

1922
[badges]
2023
travis-ci = { repository = "rust-lang-nursery/rust-clippy" }

ci/integration-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
set -x
2-
cargo install --force
2+
cargo install --force --path .
33

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

clippy_lints/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
cargo-features = ["edition"]
2+
13
[package]
24
name = "clippy_lints"
35
# begin automatic update
@@ -14,6 +16,7 @@ repository = "https://github.com/rust-lang-nursery/rust-clippy"
1416
readme = "README.md"
1517
license = "MPL-2.0"
1618
keywords = ["clippy", "lint", "plugin"]
19+
edition = "2018"
1720

1821
[dependencies]
1922
cargo_metadata = "0.5"

clippy_lints/src/approx_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc::lint::*;
33
use std::f64::consts as f64;
44
use syntax::ast::{FloatTy, Lit, LitKind};
55
use syntax::symbol;
6-
use utils::span_lint;
6+
use crate::utils::span_lint;
77

88
/// **What it does:** Checks for floating point literals that approximate
99
/// constants which are defined in

clippy_lints/src/arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::hir;
22
use rustc::lint::*;
33
use syntax::codemap::Span;
4-
use utils::span_lint;
4+
use crate::utils::span_lint;
55

66
/// **What it does:** Checks for plain integer arithmetic.
77
///

clippy_lints/src/array_indexing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use consts::{constant, Constant};
1+
use crate::consts::{constant, Constant};
22
use rustc::hir;
33
use rustc::lint::*;
44
use rustc::ty;
55
use syntax::ast::RangeLimits;
6-
use utils::higher::Range;
7-
use utils::{self, higher};
6+
use crate::utils::higher::Range;
7+
use crate::utils::{self, higher};
88

99
/// **What it does:** Checks for out of bounds array indexing with a constant
1010
/// index.

clippy_lints/src/assign_ops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use rustc::hir;
22
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
33
use rustc::lint::*;
44
use syntax::ast;
5-
use utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq};
6-
use utils::{higher, sugg};
5+
use crate::utils::{get_trait_def_id, implements_trait, snippet_opt, span_lint_and_then, SpanlessEq};
6+
use crate::utils::{higher, sugg};
77

88
/// **What it does:** Checks for compound assignment operations (`+=` and
99
/// similar).
@@ -145,7 +145,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps {
145145
$($trait_name:ident:$full_trait_name:ident),+) => {
146146
match $op {
147147
$(hir::$full_trait_name => {
148-
let [krate, module] = ::utils::paths::OPS_MODULE;
148+
let [krate, module] = crate::utils::paths::OPS_MODULE;
149149
let path = [krate, module, concat!(stringify!($trait_name), "Assign")];
150150
let trait_id = if let Some(trait_id) = get_trait_def_id($cx, &path) {
151151
trait_id

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! checks for attributes
22
3-
use reexport::*;
3+
use crate::reexport::*;
44
use rustc::hir::*;
55
use rustc::lint::*;
66
use rustc::ty::{self, TyCtxt};
77
use semver::Version;
88
use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
99
use syntax::codemap::Span;
10-
use utils::{
10+
use crate::utils::{
1111
in_macro, last_line_of_span, match_def_path, opt_def_id, paths, snippet_opt, span_lint, span_lint_and_then,
1212
without_block_comments,
1313
};

clippy_lints/src/bit_mask.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use rustc::hir::*;
22
use rustc::lint::*;
33
use syntax::ast::LitKind;
44
use syntax::codemap::Span;
5-
use utils::{span_lint, span_lint_and_then};
6-
use utils::sugg::Sugg;
7-
use consts::{constant, Constant};
5+
use crate::utils::{span_lint, span_lint_and_then};
6+
use crate::utils::sugg::Sugg;
7+
use crate::consts::{constant, Constant};
88

99
/// **What it does:** Checks for incompatible bit masks in comparisons.
1010
///

clippy_lints/src/blacklisted_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::lint::*;
22
use rustc::hir::*;
3-
use utils::span_lint;
3+
use crate::utils::span_lint;
44

55
/// **What it does:** Checks for usage of blacklisted names for variables, such
66
/// as `foo`.

clippy_lints/src/block_in_if_condition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
22
use rustc::hir::*;
33
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
4-
use utils::*;
4+
use crate::utils::*;
55

66
/// **What it does:** Checks for `if` conditions that use blocks to contain an
77
/// expression.

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc::hir::intravisit::*;
44
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};
55
use syntax::codemap::{dummy_spanned, Span, DUMMY_SP};
66
use syntax::util::ThinVec;
7-
use utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq};
7+
use crate::utils::{in_macro, paths, match_type, snippet_opt, span_lint_and_then, SpanlessEq};
88

99
/// **What it does:** Checks for boolean expressions that can be written more
1010
/// concisely.

clippy_lints/src/bytecount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc::hir::*;
22
use rustc::lint::*;
33
use rustc::ty;
44
use syntax::ast::{Name, UintTy};
5-
use utils::{contains_name, get_pat_name, match_type, paths, single_segment_path, snippet, span_lint_and_sugg,
5+
use crate::utils::{contains_name, get_pat_name, match_type, paths, single_segment_path, snippet, span_lint_and_sugg,
66
walk_ptrs_ty};
77

88
/// **What it does:** Checks for naive byte counts

clippy_lints/src/collapsible_if.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use rustc::lint::*;
1616
use syntax::ast;
1717

18-
use utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then};
19-
use utils::sugg::Sugg;
18+
use crate::utils::{in_macro, snippet_block, span_lint_and_sugg, span_lint_and_then};
19+
use crate::utils::sugg::Sugg;
2020

2121
/// **What it does:** Checks for nested `if` statements which can be collapsed
2222
/// by `&&`-combining their conditions and for `else { if ... }` expressions

clippy_lints/src/const_static_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use syntax::ast::*;
22
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
3-
use utils::{in_macro, snippet, span_lint_and_then};
3+
use crate::utils::{in_macro, snippet, span_lint_and_then};
44

55
/// **What it does:** Checks for constants with an explicit `'static` lifetime.
66
///

clippy_lints/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::rc::Rc;
1414
use syntax::ast::{FloatTy, LitKind};
1515
use syntax::ptr::P;
1616
use rustc::middle::const_val::ConstVal;
17-
use utils::{sext, unsext, clip};
17+
use crate::utils::{sext, unsext, clip};
1818

1919
#[derive(Debug, Copy, Clone)]
2020
pub enum FloatWidth {

clippy_lints/src/copies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::collections::HashMap;
55
use std::collections::hash_map::Entry;
66
use syntax::symbol::LocalInternedString;
77
use syntax::util::small_vector::SmallVector;
8-
use utils::{SpanlessEq, SpanlessHash};
9-
use utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
8+
use crate::utils::{SpanlessEq, SpanlessHash};
9+
use crate::utils::{get_parent_expr, in_macro, snippet, span_lint_and_then, span_note_and_lint};
1010

1111
/// **What it does:** Checks for consecutive `if`s with the same condition.
1212
///

clippy_lints/src/cyclomatic_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
88
use syntax::ast::{Attribute, NodeId};
99
use syntax::codemap::Span;
1010

11-
use utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
11+
use crate::utils::{in_macro, is_allowed, match_type, paths, span_help_and_lint, LimitStack};
1212

1313
/// **What it does:** Checks for methods with high cyclomatic complexity.
1414
///

clippy_lints/src/derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use rustc::lint::*;
22
use rustc::ty::{self, Ty};
33
use rustc::hir::*;
44
use syntax::codemap::Span;
5-
use utils::paths;
6-
use utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
5+
use crate::utils::paths;
6+
use crate::utils::{is_automatically_derived, is_copy, match_path, span_lint_and_then};
77

88
/// **What it does:** Checks for deriving `Hash` but implementing `PartialEq`
99
/// explicitly or vice versa.

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc::lint::*;
44
use syntax::ast;
55
use syntax::codemap::{BytePos, Span};
66
use syntax_pos::Pos;
7-
use utils::span_lint;
7+
use crate::utils::span_lint;
88
use url::Url;
99

1010
/// **What it does:** Checks for the presence of `_`, `::` or camel-case words

clippy_lints/src/double_comparison.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc::hir::*;
44
use rustc::lint::*;
55
use syntax::codemap::Span;
66

7-
use utils::{snippet, span_lint_and_sugg, SpanlessEq};
7+
use crate::utils::{snippet, span_lint_and_sugg, SpanlessEq};
88

99
/// **What it does:** Checks for double comparions that could be simpified to a single expression.
1010
///

clippy_lints/src/drop_forget_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::lint::*;
22
use rustc::ty;
33
use rustc::hir::*;
4-
use utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint};
4+
use crate::utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint};
55

66
/// **What it does:** Checks for calls to `std::mem::drop` with a reference
77
/// instead of an owned value.

clippy_lints/src/else_if_without_else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use rustc::lint::*;
44
use syntax::ast::*;
55

6-
use utils::{in_external_macro, span_lint_and_sugg};
6+
use crate::utils::{in_external_macro, span_lint_and_sugg};
77

88
/// **What it does:** Checks for usage of if expressions with an `else if` branch,
99
/// but without a final `else` branch.

clippy_lints/src/empty_enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use rustc::lint::*;
44
use rustc::hir::*;
5-
use utils::span_lint_and_then;
5+
use crate::utils::span_lint_and_then;
66

77
/// **What it does:** Checks for `enum`s with no variants.
88
///

clippy_lints/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use rustc::hir::*;
22
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
33
use rustc::lint::*;
44
use syntax::codemap::Span;
5-
use utils::SpanlessEq;
6-
use utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty};
5+
use crate::utils::SpanlessEq;
6+
use crate::utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty};
77

88
/// **What it does:** Checks for uses of `contains_key` + `insert` on `HashMap`
99
/// or `BTreeMap`.

clippy_lints/src/enum_clike.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use rustc::hir::*;
66
use rustc::ty;
77
use rustc::ty::subst::Substs;
88
use syntax::ast::{IntTy, UintTy};
9-
use utils::span_lint;
10-
use consts::{Constant, miri_to_const};
9+
use crate::utils::span_lint;
10+
use crate::consts::{Constant, miri_to_const};
1111
use rustc::ty::util::IntTypeExt;
1212
use rustc::mir::interpret::GlobalId;
1313

clippy_lints/src/enum_glob_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc::hir::def::Def;
55
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
66
use syntax::ast::NodeId;
77
use syntax::codemap::Span;
8-
use utils::span_lint;
8+
use crate::utils::span_lint;
99

1010
/// **What it does:** Checks for `use Enum::*`.
1111
///

clippy_lints/src/enum_variants.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use rustc::lint::*;
44
use syntax::ast::*;
55
use syntax::codemap::Span;
66
use syntax::symbol::LocalInternedString;
7-
use utils::{span_help_and_lint, span_lint};
8-
use utils::{camel_case_from, camel_case_until, in_macro};
7+
use crate::utils::{span_help_and_lint, span_lint};
8+
use crate::utils::{camel_case_from, camel_case_until, in_macro};
99

1010
/// **What it does:** Detects enumeration variants that are prefixed or suffixed
1111
/// by the same characters.

clippy_lints/src/eq_op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3-
use utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};
3+
use crate::utils::{in_macro, implements_trait, is_copy, multispan_sugg, snippet, span_lint, span_lint_and_then, SpanlessEq};
44

55
/// **What it does:** Checks for equal operands to comparison, logical and
66
/// bitwise, difference and division binary operators (`==`, `>`, etc., `&&`,

clippy_lints/src/erasing_op.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use consts::{constant_simple, Constant};
1+
use crate::consts::{constant_simple, Constant};
22
use rustc::hir::*;
33
use rustc::lint::*;
44
use syntax::codemap::Span;
5-
use utils::{in_macro, span_lint};
5+
use crate::utils::{in_macro, span_lint};
66

77
/// **What it does:** Checks for erasing operations, e.g. `x * 0`.
88
///

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc::ty::layout::LayoutOf;
99
use rustc::util::nodemap::NodeSet;
1010
use syntax::ast::NodeId;
1111
use syntax::codemap::Span;
12-
use utils::span_lint;
12+
use crate::utils::span_lint;
1313

1414
pub struct Pass {
1515
pub too_large_for_stack: u64,

clippy_lints/src/eta_reduction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::lint::*;
22
use rustc::ty;
33
use rustc::hir::*;
4-
use utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then};
4+
use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then};
55

66
#[allow(missing_copy_implementations)]
77
pub struct EtaPass;

clippy_lints/src/eval_order_dependence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc::hir::*;
33
use rustc::ty;
44
use rustc::lint::*;
55
use syntax::ast;
6-
use utils::{get_parent_expr, span_lint, span_note_and_lint};
6+
use crate::utils::{get_parent_expr, span_lint, span_note_and_lint};
77

88
/// **What it does:** Checks for a read and a write to the same variable where
99
/// whether the read occurs before or after the write depends on the evaluation

clippy_lints/src/excessive_precision.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::f64;
66
use std::fmt;
77
use syntax::ast::*;
88
use syntax_pos::symbol::Symbol;
9-
use utils::span_lint_and_sugg;
9+
use crate::utils::span_lint_and_sugg;
1010

1111
/// **What it does:** Checks for float literals with a precision greater
1212
/// than that supported by the underlying type

clippy_lints/src/explicit_write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3-
use utils::{is_expn_of, match_def_path, resolve_node, span_lint};
4-
use utils::opt_def_id;
3+
use crate::utils::{is_expn_of, match_def_path, resolve_node, span_lint};
4+
use crate::utils::opt_def_id;
55

66
/// **What it does:** Checks for usage of `write!()` / `writeln()!` which can be
77
/// replaced with `(e)print!()` / `(e)println!()`

clippy_lints/src/fallible_impl_from.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use rustc::lint::*;
22
use rustc::hir;
33
use rustc::ty;
44
use syntax_pos::Span;
5-
use utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of};
6-
use utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT};
5+
use crate::utils::{match_def_path, method_chain_args, span_lint_and_then, walk_ptrs_ty, is_expn_of};
6+
use crate::utils::paths::{BEGIN_PANIC, BEGIN_PANIC_FMT, FROM_TRAIT, OPTION, RESULT};
77

88
/// **What it does:** Checks for impls of `From<..>` that contain `panic!()` or `unwrap()`
99
///

clippy_lints/src/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use rustc::lint::*;
33
use rustc::ty;
44
use syntax::ast::LitKind;
55
use syntax_pos::Span;
6-
use utils::paths;
7-
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};
6+
use crate::utils::paths;
7+
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};
88

99
/// **What it does:** Checks for the use of `format!("string literal with no
1010
/// argument")` and `format!("{}", foo)` where `foo` is a string.

clippy_lints/src/formatting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::lint::*;
22
use syntax::ast;
3-
use utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint};
3+
use crate::utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint};
44
use syntax::ptr::P;
55

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

0 commit comments

Comments
 (0)