about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-21 12:32:17 +0000
committerbors <bors@rust-lang.org>2018-07-21 12:32:17 +0000
commit606713f37aadbdb314137df464f099130c2062bd (patch)
tree0895d1b1da52820640b824636c8135fc7eef4998
parentef9781358daa0a70bdaf11c9f792210ea30dd396 (diff)
parent2f7edccb036ee4c6a63664b622d9355ef594979f (diff)
downloadrust-606713f37aadbdb314137df464f099130c2062bd.tar.gz
rust-606713f37aadbdb314137df464f099130c2062bd.zip
Auto merge of #52562 - Manishearth:clippyup, r=RalfJung
Update clippy

r? @kennytm @oli-obk
-rw-r--r--src/Cargo.lock20
-rw-r--r--src/librustc/lint/builtin.rs6
-rw-r--r--src/librustc/lint/mod.rs14
m---------src/tools/clippy10
4 files changed, 31 insertions, 19 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 8299dea1c4b..09baaeadaee 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -44,7 +44,7 @@ dependencies = [
  "html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -342,10 +342,10 @@ name = "clippy_lints"
 version = "0.0.212"
 dependencies = [
  "cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex-syntax 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -887,14 +887,14 @@ name = "idna"
 version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "if_chain"
-version = "0.1.2"
+version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -1153,7 +1153,7 @@ dependencies = [
 
 [[package]]
 name = "matches"
-version = "0.1.6"
+version = "0.1.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -2868,7 +2868,7 @@ name = "unicode-bidi"
 version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -2932,7 +2932,7 @@ version = "1.7.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
  "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -3123,7 +3123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b04478cf718862650a0bf66acaf8f2f8c906fbc703f35c916c1f4211b069a364"
 "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
 "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
-"checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8"
+"checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec"
 "checksum ignore 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "787a5940ab88e0f2f3b2cad3687060bddcf67520f3b761abc31065c9c495d088"
 "checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053"
 "checksum isatty 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6c324313540cd4d7ba008d43dc6606a32a5579f13cc17b2804c13096f0a5c522"
@@ -3148,7 +3148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
 "checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
 "checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475"
-"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
+"checksum matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "835511bab37c34c47da5cb44844bea2cfde0236db0b506f90ea4224482c9774a"
 "checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f"
 "checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
 "checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index a46b3120622..0ab10bf223f 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -77,7 +77,8 @@ declare_lint! {
 declare_lint! {
     pub UNREACHABLE_CODE,
     Warn,
-    "detects unreachable code paths"
+    "detects unreachable code paths",
+    report_in_external_macro: true
 }
 
 declare_lint! {
@@ -216,7 +217,8 @@ declare_lint! {
 declare_lint! {
     pub DEPRECATED,
     Warn,
-    "detects use of deprecated items"
+    "detects use of deprecated items",
+    report_in_external_macro: true
 }
 
 declare_lint! {
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index c16029d3320..c0f3c351d26 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -80,6 +80,9 @@ pub struct Lint {
     /// Starting at the given edition, default to the given lint level. If this is `None`, then use
     /// `default_level`.
     pub edition_lint_opts: Option<(Edition, Level)>,
+
+    /// Whether this lint is reported even inside expansions of external macros
+    pub report_in_external_macro: bool,
 }
 
 impl Lint {
@@ -100,11 +103,18 @@ impl Lint {
 #[macro_export]
 macro_rules! declare_lint {
     ($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
+        declare_lint!{$vis $NAME, $Level, $desc, false}
+    );
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr, report_in_external_macro: $rep: expr) => (
+        declare_lint!{$vis $NAME, $Level, $desc, $rep}
+    );
+    ($vis: vis $NAME: ident, $Level: ident, $desc: expr, $external: expr) => (
         $vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
             name: stringify!($NAME),
             default_level: $crate::lint::$Level,
             desc: $desc,
             edition_lint_opts: None,
+            report_in_external_macro: $external,
         };
     );
     ($vis: vis $NAME: ident, $Level: ident, $desc: expr,
@@ -115,6 +125,7 @@ macro_rules! declare_lint {
             default_level: $crate::lint::$Level,
             desc: $desc,
             edition_lint_opts: Some(($lint_edition, $crate::lint::Level::$edition_level)),
+            report_in_external_macro: false,
         };
     );
 }
@@ -583,8 +594,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
     // items to take care of (delete the macro invocation). As a result we have
     // a few lints we whitelist here for allowing a lint even though it's in a
     // foreign macro invocation.
-    } else if lint_id != LintId::of(builtin::UNREACHABLE_CODE) &&
-        lint_id != LintId::of(builtin::DEPRECATED) {
+    } else if !lint.report_in_external_macro {
         if err.span.primary_spans().iter().any(|s| in_external_macro(sess, *s)) {
             err.cancel();
         }
diff --git a/src/tools/clippy b/src/tools/clippy
-Subproject c05adc545cff45449d40b1c72070ada7db5fc95
+Subproject 8085ed733fefeaf37aca0a39da93344326de5d5