Skip to content

Commit 606713f

Browse files
committed
Auto merge of #52562 - Manishearth:clippyup, r=RalfJung
Update clippy r? @kennytm @oli-obk
2 parents ef97813 + 2f7edcc commit 606713f

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

src/Cargo.lock

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dependencies = [
4444
"html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)",
4545
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
4646
"maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
47-
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
47+
"matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
4848
"tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
4949
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
5050
]
@@ -342,10 +342,10 @@ name = "clippy_lints"
342342
version = "0.0.212"
343343
dependencies = [
344344
"cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
345-
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
345+
"if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
346346
"itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
347347
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
348-
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
348+
"matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
349349
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
350350
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
351351
"regex-syntax 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -887,14 +887,14 @@ name = "idna"
887887
version = "0.1.5"
888888
source = "registry+https://github.com/rust-lang/crates.io-index"
889889
dependencies = [
890-
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
890+
"matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
891891
"unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
892892
"unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
893893
]
894894

895895
[[package]]
896896
name = "if_chain"
897-
version = "0.1.2"
897+
version = "0.1.3"
898898
source = "registry+https://github.com/rust-lang/crates.io-index"
899899

900900
[[package]]
@@ -1153,7 +1153,7 @@ dependencies = [
11531153

11541154
[[package]]
11551155
name = "matches"
1156-
version = "0.1.6"
1156+
version = "0.1.7"
11571157
source = "registry+https://github.com/rust-lang/crates.io-index"
11581158

11591159
[[package]]
@@ -2868,7 +2868,7 @@ name = "unicode-bidi"
28682868
version = "0.3.4"
28692869
source = "registry+https://github.com/rust-lang/crates.io-index"
28702870
dependencies = [
2871-
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
2871+
"matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
28722872
]
28732873

28742874
[[package]]
@@ -2932,7 +2932,7 @@ version = "1.7.1"
29322932
source = "registry+https://github.com/rust-lang/crates.io-index"
29332933
dependencies = [
29342934
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
2935-
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
2935+
"matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
29362936
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
29372937
]
29382938

@@ -3123,7 +3123,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31233123
"checksum html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b04478cf718862650a0bf66acaf8f2f8c906fbc703f35c916c1f4211b069a364"
31243124
"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
31253125
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
3126-
"checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8"
3126+
"checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec"
31273127
"checksum ignore 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "787a5940ab88e0f2f3b2cad3687060bddcf67520f3b761abc31065c9c495d088"
31283128
"checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053"
31293129
"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"
31483148
"checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
31493149
"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
31503150
"checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475"
3151-
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
3151+
"checksum matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "835511bab37c34c47da5cb44844bea2cfde0236db0b506f90ea4224482c9774a"
31523152
"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f"
31533153
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
31543154
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"

src/librustc/lint/builtin.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ declare_lint! {
7777
declare_lint! {
7878
pub UNREACHABLE_CODE,
7979
Warn,
80-
"detects unreachable code paths"
80+
"detects unreachable code paths",
81+
report_in_external_macro: true
8182
}
8283

8384
declare_lint! {
@@ -216,7 +217,8 @@ declare_lint! {
216217
declare_lint! {
217218
pub DEPRECATED,
218219
Warn,
219-
"detects use of deprecated items"
220+
"detects use of deprecated items",
221+
report_in_external_macro: true
220222
}
221223

222224
declare_lint! {

src/librustc/lint/mod.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ pub struct Lint {
8080
/// Starting at the given edition, default to the given lint level. If this is `None`, then use
8181
/// `default_level`.
8282
pub edition_lint_opts: Option<(Edition, Level)>,
83+
84+
/// Whether this lint is reported even inside expansions of external macros
85+
pub report_in_external_macro: bool,
8386
}
8487

8588
impl Lint {
@@ -100,11 +103,18 @@ impl Lint {
100103
#[macro_export]
101104
macro_rules! declare_lint {
102105
($vis: vis $NAME: ident, $Level: ident, $desc: expr) => (
106+
declare_lint!{$vis $NAME, $Level, $desc, false}
107+
);
108+
($vis: vis $NAME: ident, $Level: ident, $desc: expr, report_in_external_macro: $rep: expr) => (
109+
declare_lint!{$vis $NAME, $Level, $desc, $rep}
110+
);
111+
($vis: vis $NAME: ident, $Level: ident, $desc: expr, $external: expr) => (
103112
$vis static $NAME: &$crate::lint::Lint = &$crate::lint::Lint {
104113
name: stringify!($NAME),
105114
default_level: $crate::lint::$Level,
106115
desc: $desc,
107116
edition_lint_opts: None,
117+
report_in_external_macro: $external,
108118
};
109119
);
110120
($vis: vis $NAME: ident, $Level: ident, $desc: expr,
@@ -115,6 +125,7 @@ macro_rules! declare_lint {
115125
default_level: $crate::lint::$Level,
116126
desc: $desc,
117127
edition_lint_opts: Some(($lint_edition, $crate::lint::Level::$edition_level)),
128+
report_in_external_macro: false,
118129
};
119130
);
120131
}
@@ -583,8 +594,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
583594
// items to take care of (delete the macro invocation). As a result we have
584595
// a few lints we whitelist here for allowing a lint even though it's in a
585596
// foreign macro invocation.
586-
} else if lint_id != LintId::of(builtin::UNREACHABLE_CODE) &&
587-
lint_id != LintId::of(builtin::DEPRECATED) {
597+
} else if !lint.report_in_external_macro {
588598
if err.span.primary_spans().iter().any(|s| in_external_macro(sess, *s)) {
589599
err.cancel();
590600
}

src/tools/clippy

0 commit comments

Comments
 (0)