Skip to content

Commit

Permalink
Deprecate unused_label lint
Browse files Browse the repository at this point in the history
This lint was uplifted/turned into warn-by-default in rustc
  • Loading branch information
flip1995 committed Dec 21, 2019
1 parent acbc609 commit 710c749
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 167 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

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

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

Expand Down
9 changes: 9 additions & 0 deletions clippy_lints/src/deprecated_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,12 @@ declare_deprecated_lint! {
pub INTO_ITER_ON_ARRAY,
"this lint has been uplifted to rustc and is now called `array_into_iter`"
}

declare_deprecated_lint! {
/// **What it does:** Nothing. This lint has been deprecated.
///
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
/// `unused_labels`.
pub UNUSED_LABEL,
"this lint has been uplifted to rustc and is now called `unused_labels`"
}
9 changes: 4 additions & 5 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ pub mod types;
pub mod unicode;
pub mod unsafe_removed_from_name;
pub mod unused_io_amount;
pub mod unused_label;
pub mod unused_self;
pub mod unwrap;
pub mod use_self;
Expand Down Expand Up @@ -446,6 +445,10 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
"clippy::into_iter_on_array",
"this lint has been uplifted to rustc and is now called `array_into_iter`",
);
store.register_removed(
"clippy::unused_label",
"this lint has been uplifted to rustc and is now called `unused_labels`",
);
// end deprecated lints, do not remove this comment, it’s used in `update_lints`

// begin register lints, do not remove this comment, it’s used in `update_lints`
Expand Down Expand Up @@ -774,7 +777,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
&unicode::ZERO_WIDTH_SPACE,
&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
&unused_io_amount::UNUSED_IO_AMOUNT,
&unused_label::UNUSED_LABEL,
&unused_self::UNUSED_SELF,
&unwrap::PANICKING_UNWRAP,
&unwrap::UNNECESSARY_UNWRAP,
Expand Down Expand Up @@ -868,7 +870,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
store.register_late_pass(|| box format::UselessFormat);
store.register_late_pass(|| box swap::Swap);
store.register_late_pass(|| box overflow_check_conditional::OverflowCheckConditional);
store.register_late_pass(|| box unused_label::UnusedLabel);
store.register_late_pass(|| box new_without_default::NewWithoutDefault::default());
let blacklisted_names = conf.blacklisted_names.iter().cloned().collect::<FxHashSet<_>>();
store.register_late_pass(move || box blacklisted_name::BlacklistedName::new(blacklisted_names.clone()));
Expand Down Expand Up @@ -1302,7 +1303,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
LintId::of(&unicode::ZERO_WIDTH_SPACE),
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
LintId::of(&unused_label::UNUSED_LABEL),
LintId::of(&unwrap::PANICKING_UNWRAP),
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
LintId::of(&vec::USELESS_VEC),
Expand Down Expand Up @@ -1482,7 +1482,6 @@ pub fn register_plugins(store: &mut lint::LintStore, sess: &Session, conf: &Conf
LintId::of(&types::UNIT_ARG),
LintId::of(&types::UNNECESSARY_CAST),
LintId::of(&types::VEC_BOX),
LintId::of(&unused_label::UNUSED_LABEL),
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
LintId::of(&zero_div_zero::ZERO_DIVIDED_BY_ZERO),
]);
Expand Down
83 changes: 0 additions & 83 deletions clippy_lints/src/unused_label.rs

This file was deleted.

9 changes: 1 addition & 8 deletions src/lintlist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub use lint::Lint;
pub use lint::LINT_LEVELS;

// begin lint list, do not remove this comment, it’s used in `update_lints`
pub const ALL_LINTS: [Lint; 340] = [
pub const ALL_LINTS: [Lint; 339] = [
Lint {
name: "absurd_extreme_comparisons",
group: "correctness",
Expand Down Expand Up @@ -2177,13 +2177,6 @@ pub const ALL_LINTS: [Lint; 340] = [
deprecation: None,
module: "unused_io_amount",
},
Lint {
name: "unused_label",
group: "complexity",
desc: "unused labels",
deprecation: None,
module: "unused_label",
},
Lint {
name: "unused_self",
group: "pedantic",
Expand Down
1 change: 1 addition & 0 deletions tests/ui/deprecated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
#[warn(clippy::unused_collect)]
#[warn(clippy::invalid_ref)]
#[warn(clippy::into_iter_on_array)]
#[warn(clippy::unused_label)]

fn main() {}
8 changes: 7 additions & 1 deletion tests/ui/deprecated.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ error: lint `clippy::into_iter_on_array` has been removed: `this lint has been u
LL | #[warn(clippy::into_iter_on_array)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::unused_label` has been removed: `this lint has been uplifted to rustc and is now called `unused_labels``
--> $DIR/deprecated.rs:9:8
|
LL | #[warn(clippy::unused_label)]
| ^^^^^^^^^^^^^^^^^^^^

error: lint `clippy::str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon`
--> $DIR/deprecated.rs:1:8
|
LL | #[warn(clippy::str_to_string)]
| ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 9 previous errors
error: aborting due to 10 previous errors

1 change: 0 additions & 1 deletion tests/ui/empty_loop.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// aux-build:macro_rules.rs

#![warn(clippy::empty_loop)]
#![allow(clippy::unused_label)]

#[macro_use]
extern crate macro_rules;
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/empty_loop.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
--> $DIR/empty_loop.rs:10:5
--> $DIR/empty_loop.rs:9:5
|
LL | loop {}
| ^^^^^^^
|
= note: `-D clippy::empty-loop` implied by `-D warnings`

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

error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
--> $DIR/empty_loop.rs:16:9
--> $DIR/empty_loop.rs:15:9
|
LL | 'inner: loop {}
| ^^^^^^^^^^^^^^^
Expand Down
35 changes: 0 additions & 35 deletions tests/ui/unused_labels.rs

This file was deleted.

30 changes: 0 additions & 30 deletions tests/ui/unused_labels.stderr

This file was deleted.

0 comments on commit 710c749

Please sign in to comment.