Skip to content

Commit 1f65617

Browse files
committed
Merge branch 'macro-use' into HEAD
2 parents 77b0300 + 2a37a62 commit 1f65617

File tree

123 files changed

+189
-20
lines changed

Some content is hidden

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

123 files changed

+189
-20
lines changed

clippy_lints/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ edition = "2018"
2121
[dependencies]
2222
cargo_metadata = "0.5"
2323
itertools = "0.7"
24-
lazy_static = "1.0"
25-
matches = "0.1.2"
24+
lazy_static = "1.0.2"
25+
matches = "0.1.7"
2626
quine-mc_cluskey = "0.2.2"
2727
regex-syntax = "0.6"
2828
semver = "0.9.0"
@@ -32,7 +32,7 @@ toml = "0.4"
3232
unicode-normalization = "0.1"
3333
pulldown-cmark = "0.1"
3434
url = "1.7.0"
35-
if_chain = "0.1"
35+
if_chain = "0.1.3"
3636

3737
[features]
3838
debugging = []

clippy_lints/src/approx_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::utils::span_lint;
22
use rustc::hir::*;
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use std::f64::consts as f64;
56
use syntax::ast::{FloatTy, Lit, LitKind};
67
use syntax::symbol;

clippy_lints/src/arithmetic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::utils::span_lint;
22
use rustc::hir;
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::codemap::Span;
56

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

clippy_lints/src/assign_ops.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use crate::utils::{higher, sugg};
33
use rustc::hir;
44
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
55
use rustc::lint::*;
6+
use rustc::{declare_lint, lint_array};
7+
use if_chain::if_chain;
68
use syntax::ast;
79

810
/// **What it does:** Checks for compound assignment operations (`+=` and

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use crate::utils::{
77
};
88
use rustc::hir::*;
99
use rustc::lint::*;
10+
use rustc::{declare_lint, lint_array};
11+
use if_chain::if_chain;
1012
use rustc::ty::{self, TyCtxt};
1113
use semver::Version;
1214
use syntax::ast::{AttrStyle, Attribute, Lit, LitKind, MetaItemKind, NestedMetaItem, NestedMetaItemKind};

clippy_lints/src/bit_mask.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
4+
use if_chain::if_chain;
35
use syntax::ast::LitKind;
46
use syntax::codemap::Span;
57
use crate::utils::{span_lint, span_lint_and_then};

clippy_lints/src/blacklisted_name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
23
use rustc::hir::*;
34
use crate::utils::span_lint;
45

clippy_lints/src/block_in_if_condition.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
use matches::matches;
12
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
3+
use rustc::{declare_lint, lint_array};
24
use rustc::hir::*;
35
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
46
use crate::utils::*;

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
2+
use rustc::{declare_lint, lint_array};
23
use rustc::hir::*;
34
use rustc::hir::intravisit::*;
45
use syntax::ast::{LitKind, NodeId, DUMMY_NODE_ID};

clippy_lints/src/bytecount.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
4+
use if_chain::if_chain;
35
use rustc::ty;
46
use syntax::ast::{Name, UintTy};
57
use crate::utils::{contains_name, get_pat_name, match_type, paths, single_segment_path, snippet, span_lint_and_sugg,

clippy_lints/src/collapsible_if.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
//! This lint is **warn** by default
1414
1515
use rustc::lint::*;
16+
use rustc::{declare_lint, lint_array};
17+
use if_chain::if_chain;
1618
use syntax::ast;
1719

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

clippy_lints/src/const_static_lifetime.rs

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

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

clippy_lints/src/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![allow(float_cmp)]
33

44
use rustc::lint::LateContext;
5+
use rustc::{span_bug, bug};
56
use rustc::hir::def::Def;
67
use rustc::hir::*;
78
use rustc::ty::{self, Ty, TyCtxt, Instance};

clippy_lints/src/copies.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
23
use rustc::ty::Ty;
34
use rustc::hir::*;
45
use std::collections::HashMap;

clippy_lints/src/cyclomatic_complexity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use rustc::cfg::CFG;
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
56
use rustc::hir::*;
67
use rustc::ty;
78
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};

clippy_lints/src/default_trait_access.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
4+
use if_chain::if_chain;
35
use rustc::ty::TypeVariants;
46

57
use crate::utils::{any_parent_is_automatically_derived, match_def_path, opt_def_id, paths, span_lint_and_sugg};

clippy_lints/src/derive.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
3+
use if_chain::if_chain;
24
use rustc::ty::{self, Ty};
35
use rustc::hir::*;
46
use syntax::codemap::Span;

clippy_lints/src/doc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use itertools::Itertools;
22
use pulldown_cmark;
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::ast;
56
use syntax::codemap::{BytePos, Span};
67
use syntax_pos::Pos;

clippy_lints/src/double_comparison.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use rustc::hir::*;
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
56
use syntax::codemap::Span;
67

78
use crate::utils::{snippet, span_lint_and_sugg, SpanlessEq};

clippy_lints/src/double_parens.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use syntax::ast::*;
22
use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
3+
use rustc::{declare_lint, lint_array};
34

45
/// **What it does:** Checks for unnecessary double parentheses.
56
///

clippy_lints/src/drop_forget_ref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
3+
use if_chain::if_chain;
24
use rustc::ty;
35
use rustc::hir::*;
46
use crate::utils::{is_copy, match_def_path, opt_def_id, paths, span_note_and_lint};

clippy_lints/src/duration_subsec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
4+
use if_chain::if_chain;
35
use syntax::codemap::Spanned;
46

57
use crate::consts::{constant, Constant};

clippy_lints/src/else_if_without_else.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! lint on if expressions with an else if, but without a final else branch
22
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::ast::*;
56

67
use crate::utils::{in_external_macro, span_lint_and_sugg};

clippy_lints/src/empty_enum.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! lint when there is an enum with no variants
22
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use rustc::hir::*;
56
use crate::utils::span_lint_and_then;
67

clippy_lints/src/entry.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use rustc::hir::*;
22
use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
5+
use if_chain::if_chain;
46
use syntax::codemap::Span;
57
use crate::utils::SpanlessEq;
68
use crate::utils::{get_item_name, match_type, paths, snippet, span_lint_and_then, walk_ptrs_ty};

clippy_lints/src/enum_clike.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! don't fit into an `i32`
33
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
56
use rustc::hir::*;
67
use rustc::ty;
78
use rustc::ty::subst::Substs;

clippy_lints/src/enum_glob_use.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use rustc::hir::*;
44
use rustc::hir::def::Def;
55
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
6+
use rustc::{declare_lint, lint_array};
67
use syntax::ast::NodeId;
78
use syntax::codemap::Span;
89
use crate::utils::span_lint;

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! lint on enum variants that are prefixed or suffixed by the same characters
22
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::ast::*;
56
use syntax::codemap::Span;
67
use syntax::symbol::LocalInternedString;

clippy_lints/src/eq_op.rs

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

56
/// **What it does:** Checks for equal operands to comparison, logical and

clippy_lints/src/erasing_op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::consts::{constant_simple, Constant};
22
use rustc::hir::*;
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::codemap::Span;
56
use crate::utils::{in_macro, span_lint};
67

clippy_lints/src/escape.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use rustc::hir::*;
22
use rustc::hir::intravisit as visit;
33
use rustc::hir::map::Node::{NodeExpr, NodeStmt};
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
56
use rustc::middle::expr_use_visitor::*;
67
use rustc::middle::mem_categorization::{cmt_, Categorization};
78
use rustc::ty::{self, Ty};

clippy_lints/src/eta_reduction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
23
use rustc::ty;
34
use rustc::hir::*;
45
use crate::utils::{is_adjusted, iter_input_pats, snippet_opt, span_lint_and_then};

clippy_lints/src/eval_order_dependence.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use rustc::hir::intravisit::{walk_expr, NestedVisitorMap, Visitor};
22
use rustc::hir::*;
33
use rustc::ty;
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
6+
use if_chain::if_chain;
57
use syntax::ast;
68
use crate::utils::{get_parent_expr, span_lint, span_note_and_lint};
79

clippy_lints/src/excessive_precision.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc::hir;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
4+
use if_chain::if_chain;
35
use rustc::ty::TypeVariants;
46
use std::f32;
57
use std::f64;

clippy_lints/src/explicit_write.rs

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

clippy_lints/src/fallible_impl_from.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
3+
use if_chain::if_chain;
24
use rustc::hir;
35
use rustc::ty;
46
use syntax_pos::Span;

clippy_lints/src/format.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
4+
use if_chain::if_chain;
35
use rustc::ty;
46
use syntax::ast::LitKind;
57
use syntax_pos::Span;

clippy_lints/src/formatting.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
23
use syntax::ast;
34
use crate::utils::{differing_macro_contexts, in_macro, snippet_opt, span_note_and_lint};
45
use syntax::ptr::P;

clippy_lints/src/functions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
use matches::matches;
12
use rustc::hir::intravisit;
23
use rustc::hir;
34
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
46
use rustc::ty;
57
use rustc::hir::def::Def;
68
use std::collections::HashSet;

clippy_lints/src/identity_conversion.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
23
use rustc::hir::*;
34
use syntax::ast::NodeId;
45
use crate::utils::{in_macro, match_def_path, match_trait_method, same_tys, snippet, span_lint_and_then};

clippy_lints/src/identity_op.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::consts::{constant_simple, Constant};
22
use rustc::hir::*;
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::codemap::Span;
56
use crate::utils::{in_macro, snippet, span_lint, unsext, clip};
67
use rustc::ty;

clippy_lints/src/if_let_redundant_pattern_matching.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
23
use rustc::hir::*;
34
use crate::utils::{match_qpath, paths, snippet, span_lint_and_then};
45

clippy_lints/src/if_not_else.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! on the condition
33
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
56
use syntax::ast::*;
67

78
use crate::utils::{in_external_macro, span_help_and_lint};

clippy_lints/src/indexing_slicing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::utils::higher;
66
use crate::utils::higher::Range;
77
use rustc::hir::*;
88
use rustc::lint::*;
9+
use rustc::{declare_lint, lint_array};
910
use rustc::ty;
1011
use syntax::ast::RangeLimits;
1112

clippy_lints/src/infallible_destructuring_match.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use super::utils::{get_arg_name, match_var, remove_blocks, snippet, span_lint_and_sugg};
22
use rustc::hir::*;
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
5+
use if_chain::if_chain;
46

57
/// **What it does:** Checks for matches being used to destructure a single-variant enum
68
/// or tuple struct where a `let` will suffice.

clippy_lints/src/infinite_iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use rustc::hir::*;
22
use rustc::lint::*;
3+
use rustc::{declare_lint, lint_array};
34
use crate::utils::{get_trait_def_id, higher, implements_trait, match_qpath, paths, span_lint};
45

56
/// **What it does:** Checks for iteration that is guaranteed to be infinite.

clippy_lints/src/inherent_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use rustc::hir::*;
44
use rustc::lint::*;
5+
use rustc::{declare_lint, lint_array};
56
use std::collections::HashMap;
67
use std::default::Default;
78
use syntax_pos::Span;

clippy_lints/src/inline_fn_without_body.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! checks for `#[inline]` on trait methods without bodies
22
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use rustc::hir::*;
56
use syntax::ast::{Attribute, Name};
67
use crate::utils::span_lint_and_then;

clippy_lints/src/int_plus_one.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! lint on blocks unnecessarily using >= with a + 1 or - 1
22
33
use rustc::lint::*;
4+
use rustc::{declare_lint, lint_array};
45
use syntax::ast::*;
56

67
use crate::utils::{snippet_opt, span_lint_and_then};

clippy_lints/src/invalid_ref.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use rustc::lint::*;
2+
use rustc::{declare_lint, lint_array};
3+
use if_chain::if_chain;
24
use rustc::ty;
35
use rustc::hir::*;
46
use crate::utils::{match_def_path, opt_def_id, paths, span_help_and_lint};

0 commit comments

Comments
 (0)