Skip to content

Commit 770c425

Browse files
committed
Use register_renamed instead of register_removed for uplifted lints
This still applies the lint, and also adds a structured suggestion to rename it.
1 parent 75efc14 commit 770c425

File tree

4 files changed

+23
-112
lines changed

4 files changed

+23
-112
lines changed

CHANGELOG.md

-7
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,6 @@ Released 2018-09-13
21782178
[`double_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_must_use
21792179
[`double_neg`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_neg
21802180
[`double_parens`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_parens
2181-
[`drop_bounds`]: https://rust-lang.github.io/rust-clippy/master/index.html#drop_bounds
21822181
[`drop_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#drop_copy
21832182
[`drop_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#drop_ref
21842183
[`duplicate_underscore_argument`]: https://rust-lang.github.io/rust-clippy/master/index.html#duplicate_underscore_argument
@@ -2264,11 +2263,9 @@ Released 2018-09-13
22642263
[`int_plus_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#int_plus_one
22652264
[`integer_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic
22662265
[`integer_division`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_division
2267-
[`into_iter_on_array`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_array
22682266
[`into_iter_on_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
22692267
[`invalid_atomic_ordering`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_atomic_ordering
22702268
[`invalid_null_ptr_usage`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_null_ptr_usage
2271-
[`invalid_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_ref
22722269
[`invalid_regex`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_regex
22732270
[`invalid_upcast_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_upcast_comparisons
22742271
[`invisible_characters`]: https://rust-lang.github.io/rust-clippy/master/index.html#invisible_characters
@@ -2403,7 +2400,6 @@ Released 2018-09-13
24032400
[`overflow_check_conditional`]: https://rust-lang.github.io/rust-clippy/master/index.html#overflow_check_conditional
24042401
[`panic`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic
24052402
[`panic_in_result_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_in_result_fn
2406-
[`panic_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#panic_params
24072403
[`panicking_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#panicking_unwrap
24082404
[`partialeq_ne_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
24092405
[`path_buf_push_overwrite`]: https://rust-lang.github.io/rust-clippy/master/index.html#path_buf_push_overwrite
@@ -2489,7 +2485,6 @@ Released 2018-09-13
24892485
[`suspicious_unary_op_formatting`]: https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_unary_op_formatting
24902486
[`tabs_in_doc_comments`]: https://rust-lang.github.io/rust-clippy/master/index.html#tabs_in_doc_comments
24912487
[`temporary_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_assignment
2492-
[`temporary_cstring_as_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#temporary_cstring_as_ptr
24932488
[`to_digit_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_digit_is_some
24942489
[`to_string_in_display`]: https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_display
24952490
[`todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
@@ -2518,7 +2513,6 @@ Released 2018-09-13
25182513
[`unit_arg`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_arg
25192514
[`unit_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_cmp
25202515
[`unit_return_expecting_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#unit_return_expecting_ord
2521-
[`unknown_clippy_lints`]: https://rust-lang.github.io/rust-clippy/master/index.html#unknown_clippy_lints
25222516
[`unnecessary_cast`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
25232517
[`unnecessary_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map
25242518
[`unnecessary_fold`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold
@@ -2542,7 +2536,6 @@ Released 2018-09-13
25422536
[`unstable_as_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#unstable_as_slice
25432537
[`unused_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_collect
25442538
[`unused_io_amount`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_io_amount
2545-
[`unused_label`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_label
25462539
[`unused_self`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_self
25472540
[`unused_unit`]: https://rust-lang.github.io/rust-clippy/master/index.html#unused_unit
25482541
[`unusual_byte_groupings`]: https://rust-lang.github.io/rust-clippy/master/index.html#unusual_byte_groupings

clippy_lints/src/deprecated_lints.rs

-63
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,6 @@ declare_deprecated_lint! {
9393
"the replacement suggested by this lint had substantially different behavior"
9494
}
9595

96-
declare_deprecated_lint! {
97-
/// **What it does:** Nothing. This lint has been deprecated.
98-
///
99-
/// **Deprecation reason:** This lint has been superseded by the warn-by-default
100-
/// `invalid_value` rustc lint.
101-
pub INVALID_REF,
102-
"superseded by rustc lint `invalid_value`"
103-
}
104-
10596
declare_deprecated_lint! {
10697
/// **What it does:** Nothing. This lint has been deprecated.
10798
///
@@ -110,24 +101,6 @@ declare_deprecated_lint! {
110101
"`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
111102
}
112103

113-
declare_deprecated_lint! {
114-
/// **What it does:** Nothing. This lint has been deprecated.
115-
///
116-
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
117-
/// `array_into_iter`.
118-
pub INTO_ITER_ON_ARRAY,
119-
"this lint has been uplifted to rustc and is now called `array_into_iter`"
120-
}
121-
122-
declare_deprecated_lint! {
123-
/// **What it does:** Nothing. This lint has been deprecated.
124-
///
125-
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
126-
/// `unused_labels`.
127-
pub UNUSED_LABEL,
128-
"this lint has been uplifted to rustc and is now called `unused_labels`"
129-
}
130-
131104
declare_deprecated_lint! {
132105
/// **What it does:** Nothing. This lint has been deprecated.
133106
///
@@ -144,42 +117,6 @@ declare_deprecated_lint! {
144117
"the regex! macro has been removed from the regex crate in 2018"
145118
}
146119

147-
declare_deprecated_lint! {
148-
/// **What it does:** Nothing. This lint has been deprecated.
149-
///
150-
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
151-
/// `drop_bounds`.
152-
pub DROP_BOUNDS,
153-
"this lint has been uplifted to rustc and is now called `drop_bounds`"
154-
}
155-
156-
declare_deprecated_lint! {
157-
/// **What it does:** Nothing. This lint has been deprecated.
158-
///
159-
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
160-
/// `temporary_cstring_as_ptr`.
161-
pub TEMPORARY_CSTRING_AS_PTR,
162-
"this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr`"
163-
}
164-
165-
declare_deprecated_lint! {
166-
/// **What it does:** Nothing. This lint has been deprecated.
167-
///
168-
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
169-
/// `panic_fmt`.
170-
pub PANIC_PARAMS,
171-
"this lint has been uplifted to rustc and is now called `panic_fmt`"
172-
}
173-
174-
declare_deprecated_lint! {
175-
/// **What it does:** Nothing. This lint has been deprecated.
176-
///
177-
/// **Deprecation reason:** This lint has been integrated into the `unknown_lints`
178-
/// rustc lint.
179-
pub UNKNOWN_CLIPPY_LINTS,
180-
"this lint has been integrated into the `unknown_lints` rustc lint"
181-
}
182-
183120
declare_deprecated_lint! {
184121
/// **What it does:** Nothing. This lint has been deprecated.
185122
///

clippy_lints/src/lib.rs

+9-28
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,10 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
493493
"clippy::unsafe_vector_initialization",
494494
"the replacement suggested by this lint had substantially different behavior",
495495
);
496-
store.register_removed(
497-
"clippy::invalid_ref",
498-
"superseded by rustc lint `invalid_value`",
499-
);
500496
store.register_removed(
501497
"clippy::unused_collect",
502498
"`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint",
503499
);
504-
store.register_removed(
505-
"clippy::into_iter_on_array",
506-
"this lint has been uplifted to rustc and is now called `array_into_iter`",
507-
);
508-
store.register_removed(
509-
"clippy::unused_label",
510-
"this lint has been uplifted to rustc and is now called `unused_labels`",
511-
);
512500
store.register_removed(
513501
"clippy::replace_consts",
514502
"associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants",
@@ -517,22 +505,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
517505
"clippy::regex_macro",
518506
"the regex! macro has been removed from the regex crate in 2018",
519507
);
520-
store.register_removed(
521-
"clippy::drop_bounds",
522-
"this lint has been uplifted to rustc and is now called `drop_bounds`",
523-
);
524-
store.register_removed(
525-
"clippy::temporary_cstring_as_ptr",
526-
"this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr`",
527-
);
528-
store.register_removed(
529-
"clippy::panic_params",
530-
"this lint has been uplifted to rustc and is now called `panic_fmt`",
531-
);
532-
store.register_removed(
533-
"clippy::unknown_clippy_lints",
534-
"this lint has been integrated into the `unknown_lints` rustc lint",
535-
);
536508
store.register_removed(
537509
"clippy::find_map",
538510
"this lint has been replaced by `manual_find_map`, a more specific lint",
@@ -2155,6 +2127,15 @@ pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
21552127
ls.register_renamed("clippy::identity_conversion", "clippy::useless_conversion");
21562128
ls.register_renamed("clippy::zero_width_space", "clippy::invisible_characters");
21572129
ls.register_renamed("clippy::single_char_push_str", "clippy::single_char_add_str");
2130+
2131+
// uplifted lints
2132+
ls.register_renamed("clippy::invalid_ref", "invalid_value");
2133+
ls.register_renamed("clippy::into_iter_on_array", "array_into_iter");
2134+
ls.register_renamed("clippy::unused_label", "unused_labels");
2135+
ls.register_renamed("clippy::drop_bounds", "drop_bounds");
2136+
ls.register_renamed("clippy::temporary_cstring_as_ptr", "temporary_cstring_as_ptr");
2137+
ls.register_renamed("clippy::panic_params", "non_fmt_panic");
2138+
ls.register_renamed("clippy::unknown_clippy_lints", "unknown_lints");
21582139
}
21592140

21602141
// only exists to let the dogfood integration test works.

tests/ui/deprecated.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -24,53 +24,53 @@ error: lint `clippy::unused_collect` has been removed: `collect` has been marked
2424
LL | #[warn(clippy::unused_collect)]
2525
| ^^^^^^^^^^^^^^^^^^^^^^
2626

27-
error: lint `clippy::invalid_ref` has been removed: superseded by rustc lint `invalid_value`
27+
error: lint `clippy::invalid_ref` has been renamed to `invalid_value`
2828
--> $DIR/deprecated.rs:5:8
2929
|
3030
LL | #[warn(clippy::invalid_ref)]
31-
| ^^^^^^^^^^^^^^^^^^^
31+
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value`
3232

33-
error: lint `clippy::into_iter_on_array` has been removed: this lint has been uplifted to rustc and is now called `array_into_iter`
33+
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
3434
--> $DIR/deprecated.rs:6:8
3535
|
3636
LL | #[warn(clippy::into_iter_on_array)]
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter`
3838

39-
error: lint `clippy::unused_label` has been removed: this lint has been uplifted to rustc and is now called `unused_labels`
39+
error: lint `clippy::unused_label` has been renamed to `unused_labels`
4040
--> $DIR/deprecated.rs:7:8
4141
|
4242
LL | #[warn(clippy::unused_label)]
43-
| ^^^^^^^^^^^^^^^^^^^^
43+
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels`
4444

4545
error: lint `clippy::regex_macro` has been removed: the regex! macro has been removed from the regex crate in 2018
4646
--> $DIR/deprecated.rs:8:8
4747
|
4848
LL | #[warn(clippy::regex_macro)]
4949
| ^^^^^^^^^^^^^^^^^^^
5050

51-
error: lint `clippy::drop_bounds` has been removed: this lint has been uplifted to rustc and is now called `drop_bounds`
51+
error: lint `clippy::drop_bounds` has been renamed to `drop_bounds`
5252
--> $DIR/deprecated.rs:9:8
5353
|
5454
LL | #[warn(clippy::drop_bounds)]
55-
| ^^^^^^^^^^^^^^^^^^^
55+
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds`
5656

57-
error: lint `clippy::temporary_cstring_as_ptr` has been removed: this lint has been uplifted to rustc and is now called `temporary_cstring_as_ptr`
57+
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr`
5858
--> $DIR/deprecated.rs:10:8
5959
|
6060
LL | #[warn(clippy::temporary_cstring_as_ptr)]
61-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr`
6262

63-
error: lint `clippy::panic_params` has been removed: this lint has been uplifted to rustc and is now called `panic_fmt`
63+
error: lint `clippy::panic_params` has been renamed to `non_fmt_panic`
6464
--> $DIR/deprecated.rs:11:8
6565
|
6666
LL | #[warn(clippy::panic_params)]
67-
| ^^^^^^^^^^^^^^^^^^^^
67+
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panic`
6868

69-
error: lint `clippy::unknown_clippy_lints` has been removed: this lint has been integrated into the `unknown_lints` rustc lint
69+
error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
7070
--> $DIR/deprecated.rs:12:8
7171
|
7272
LL | #[warn(clippy::unknown_clippy_lints)]
73-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
7474

7575
error: lint `clippy::find_map` has been removed: this lint has been replaced by `manual_find_map`, a more specific lint
7676
--> $DIR/deprecated.rs:13:8

0 commit comments

Comments
 (0)