Skip to content

Commit 19dbb22

Browse files
committed
Auto merge of #4930 - flip1995:unused_label, r=phansch
Deprecate unused_label lint This lint was uplifted/turned into warn-by-default in rustc Fixes #4925 changelog: Deprecate [`unused_label`] lint
2 parents 7b670a9 + 710c749 commit 19dbb22

11 files changed

+26
-167
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are 340 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are 339 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

1111
We have a bunch of lint categories to allow you to choose how much Clippy is supposed to ~~annoy~~ help you:
1212

clippy_lints/src/deprecated_lints.rs

+9
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,12 @@ declare_deprecated_lint! {
138138
pub INTO_ITER_ON_ARRAY,
139139
"this lint has been uplifted to rustc and is now called `array_into_iter`"
140140
}
141+
142+
declare_deprecated_lint! {
143+
/// **What it does:** Nothing. This lint has been deprecated.
144+
///
145+
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
146+
/// `unused_labels`.
147+
pub UNUSED_LABEL,
148+
"this lint has been uplifted to rustc and is now called `unused_labels`"
149+
}

clippy_lints/src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ pub mod types;
292292
pub mod unicode;
293293
pub mod unsafe_removed_from_name;
294294
pub mod unused_io_amount;
295-
pub mod unused_label;
296295
pub mod unused_self;
297296
pub mod unwrap;
298297
pub mod use_self;
@@ -446,6 +445,10 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
446445
"clippy::into_iter_on_array",
447446
"this lint has been uplifted to rustc and is now called `array_into_iter`",
448447
);
448+
store.register_removed(
449+
"clippy::unused_label",
450+
"this lint has been uplifted to rustc and is now called `unused_labels`",
451+
);
449452
// end deprecated lints, do not remove this comment, it’s used in `update_lints`
450453

451454
// begin register lints, do not remove this comment, it’s used in `update_lints`
@@ -774,7 +777,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
774777
&unicode::ZERO_WIDTH_SPACE,
775778
&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
776779
&unused_io_amount::UNUSED_IO_AMOUNT,
777-
&unused_label::UNUSED_LABEL,
778780
&unused_self::UNUSED_SELF,
779781
&unwrap::PANICKING_UNWRAP,
780782
&unwrap::UNNECESSARY_UNWRAP,
@@ -868,7 +870,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
868870
store.register_late_pass(|| box format::UselessFormat);
869871
store.register_late_pass(|| box swap::Swap);
870872
store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
871-
store.register_late_pass(|| box unused_label::UnusedLabel);
872873
store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
873874
let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
874875
store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
@@ -1302,7 +1303,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
13021303
LintId::of(&unicode::ZERO_WIDTH_SPACE),
13031304
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
13041305
LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1305-
LintId::of(&unused_label::UNUSED_LABEL),
13061306
LintId::of(&unwrap::PANICKING_UNWRAP),
13071307
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
13081308
LintId::of(&vec::USELESS_VEC),
@@ -1482,7 +1482,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
14821482
LintId::of(&types::UNIT_ARG),
14831483
LintId::of(&types::UNNECESSARY_CAST),
14841484
LintId::of(&types::VEC_BOX),
1485-
LintId::of(&unused_label::UNUSED_LABEL),
14861485
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
14871486
LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
14881487
]);

clippy_lints/src/unused_label.rs

-83
This file was deleted.

src/lintlist/mod.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub use lint::Lint;
66
pub use lint::LINT_LEVELS;
77

88
// begin lint list, do not remove this comment, it’s used in `update_lints`
9-
pub const ALL_LINTS: [Lint; 340] = [
9+
pub const ALL_LINTS: [Lint; 339] = [
1010
Lint {
1111
name: "absurd_extreme_comparisons",
1212
group: "correctness",
@@ -2177,13 +2177,6 @@ pub const ALL_LINTS: [Lint; 340] = [
21772177
deprecation: None,
21782178
module: "unused_io_amount",
21792179
},
2180-
Lint {
2181-
name: "unused_label",
2182-
group: "complexity",
2183-
desc: "unused labels",
2184-
deprecation: None,
2185-
module: "unused_label",
2186-
},
21872180
Lint {
21882181
name: "unused_self",
21892182
group: "pedantic",

tests/ui/deprecated.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
#[warn(clippy::unused_collect)]
77
#[warn(clippy::invalid_ref)]
88
#[warn(clippy::into_iter_on_array)]
9+
#[warn(clippy::unused_label)]
910

1011
fn main() {}

tests/ui/deprecated.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ error: lint `clippy::into_iter_on_array` has been removed: `this lint has been u
4848
LL | #[warn(clippy::into_iter_on_array)]
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
5050

51+
error: lint `clippy::unused_label` has been removed: `this lint has been uplifted to rustc and is now called `unused_labels``
52+
--> $DIR/deprecated.rs:9:8
53+
|
54+
LL | #[warn(clippy::unused_label)]
55+
| ^^^^^^^^^^^^^^^^^^^^
56+
5157
error: lint `clippy::str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
5258
--> $DIR/deprecated.rs:1:8
5359
|
5460
LL | #[warn(clippy::str_to_string)]
5561
| ^^^^^^^^^^^^^^^^^^^^^
5662

57-
error: aborting due to 9 previous errors
63+
error: aborting due to 10 previous errors
5864

tests/ui/empty_loop.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// aux-build:macro_rules.rs
22

33
#![warn(clippy::empty_loop)]
4-
#![allow(clippy::unused_label)]
54

65
#[macro_use]
76
extern crate macro_rules;

tests/ui/empty_loop.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
2-
--> $DIR/empty_loop.rs:10:5
2+
--> $DIR/empty_loop.rs:9:5
33
|
44
LL | loop {}
55
| ^^^^^^^
66
|
77
= note: `-D clippy::empty-loop` implied by `-D warnings`
88

99
error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
10-
--> $DIR/empty_loop.rs:12:9
10+
--> $DIR/empty_loop.rs:11:9
1111
|
1212
LL | loop {}
1313
| ^^^^^^^
1414

1515
error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
16-
--> $DIR/empty_loop.rs:16:9
16+
--> $DIR/empty_loop.rs:15:9
1717
|
1818
LL | 'inner: loop {}
1919
| ^^^^^^^^^^^^^^^

tests/ui/unused_labels.rs

-35
This file was deleted.

tests/ui/unused_labels.stderr

-30
This file was deleted.

0 commit comments

Comments
 (0)