Skip to content

Commit d0c04b4

Browse files
Clean up tests/ui/rename.rs
1 parent 73a443d commit d0c04b4

File tree

4 files changed

+268
-7
lines changed

4 files changed

+268
-7
lines changed

clippy_lints/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
828828
///
829829
/// Used in `./src/driver.rs`.
830830
pub fn register_renamed(ls: &mut rustc_lint::LintStore) {
831+
// NOTE: when renaming a lint, add a corresponding test to tests/ui/rename.rs
831832
ls.register_renamed("clippy::stutter", "clippy::module_name_repetitions");
832833
ls.register_renamed("clippy::new_without_default_derive", "clippy::new_without_default");
833834
ls.register_renamed("clippy::cyclomatic_complexity", "clippy::cognitive_complexity");

tests/ui/rename.fixed

+48
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,57 @@
66
#![allow(clippy::module_name_repetitions)]
77
#![allow(clippy::new_without_default)]
88
#![allow(clippy::redundant_static_lifetimes)]
9+
#![allow(clippy::bind_instead_of_map)]
10+
#![allow(clippy::blocks_in_if_conditions)]
11+
#![allow(clippy::blocks_in_if_conditions)]
12+
#![allow(clippy::box_collection)]
13+
#![allow(clippy::blocks_in_if_conditions)]
14+
#![allow(clippy::map_unwrap_or)]
15+
#![allow(clippy::unwrap_used)]
16+
#![allow(clippy::expect_used)]
17+
#![allow(clippy::for_loops_over_fallibles)]
18+
#![allow(clippy::useless_conversion)]
19+
#![allow(clippy::invisible_characters)]
20+
#![allow(clippy::single_char_add_str)]
21+
#![allow(clippy::match_result_ok)]
22+
// uplifted lints
23+
#![allow(invalid_value)]
24+
#![allow(array_into_iter)]
25+
#![allow(unused_labels)]
26+
#![allow(drop_bounds)]
27+
#![allow(temporary_cstring_as_ptr)]
28+
#![allow(non_fmt_panics)]
29+
#![allow(unknown_lints)]
30+
#![allow(invalid_atomic_ordering)]
31+
#![allow(enum_intrinsics_non_enums)]
932
// warn for the old lint name here, to test if the renaming worked
1033
#![warn(clippy::cognitive_complexity)]
1134
#![warn(enum_intrinsics_non_enums)]
35+
#![warn(clippy::bind_instead_of_map)]
36+
#![warn(clippy::box_collection)]
37+
#![warn(clippy::map_unwrap_or)]
38+
#![warn(clippy::map_unwrap_or)]
39+
#![warn(clippy::map_unwrap_or)]
40+
#![warn(clippy::unwrap_used)]
41+
#![warn(clippy::unwrap_used)]
42+
#![warn(clippy::expect_used)]
43+
#![warn(clippy::expect_used)]
44+
#![warn(clippy::for_loops_over_fallibles)]
45+
#![warn(clippy::for_loops_over_fallibles)]
46+
#![warn(clippy::useless_conversion)]
47+
#![warn(clippy::invisible_characters)]
48+
#![warn(clippy::single_char_add_str)]
49+
#![warn(clippy::match_result_ok)]
50+
// uplifted lints
51+
#![warn(invalid_value)]
52+
#![warn(array_into_iter)]
53+
#![warn(unused_labels)]
54+
#![warn(drop_bounds)]
55+
#![warn(temporary_cstring_as_ptr)]
56+
#![warn(non_fmt_panics)]
57+
#![warn(unknown_lints)]
58+
#![warn(invalid_atomic_ordering)]
59+
#![warn(enum_intrinsics_non_enums)]
1260

1361
#[warn(clippy::module_name_repetitions)]
1462
fn main() {}

tests/ui/rename.rs

+48
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,57 @@
66
#![allow(clippy::module_name_repetitions)]
77
#![allow(clippy::new_without_default)]
88
#![allow(clippy::redundant_static_lifetimes)]
9+
#![allow(clippy::bind_instead_of_map)]
10+
#![allow(clippy::block_in_if_condition_expr)]
11+
#![allow(clippy::block_in_if_condition_stmt)]
12+
#![allow(clippy::box_collection)]
13+
#![allow(clippy::blocks_in_if_conditions)]
14+
#![allow(clippy::map_unwrap_or)]
15+
#![allow(clippy::unwrap_used)]
16+
#![allow(clippy::expect_used)]
17+
#![allow(clippy::for_loop_over_fallibles)]
18+
#![allow(clippy::useless_conversion)]
19+
#![allow(clippy::invisible_characters)]
20+
#![allow(clippy::single_char_add_str)]
21+
#![allow(clippy::match_result_ok)]
22+
// uplifted lints
23+
#![allow(invalid_value)]
24+
#![allow(array_into_iter)]
25+
#![allow(unused_labels)]
26+
#![allow(drop_bounds)]
27+
#![allow(temporary_cstring_as_ptr)]
28+
#![allow(non_fmt_panics)]
29+
#![allow(unknown_lints)]
30+
#![allow(invalid_atomic_ordering)]
31+
#![allow(enum_intrinsics_non_enums)]
932
// warn for the old lint name here, to test if the renaming worked
1033
#![warn(clippy::cyclomatic_complexity)]
1134
#![warn(clippy::mem_discriminant_non_enum)]
35+
#![warn(clippy::option_and_then_some)]
36+
#![warn(clippy::box_vec)]
37+
#![warn(clippy::option_map_unwrap_or)]
38+
#![warn(clippy::option_map_unwrap_or_else)]
39+
#![warn(clippy::result_map_unwrap_or_else)]
40+
#![warn(clippy::option_unwrap_used)]
41+
#![warn(clippy::result_unwrap_used)]
42+
#![warn(clippy::option_expect_used)]
43+
#![warn(clippy::result_expect_used)]
44+
#![warn(clippy::for_loop_over_option)]
45+
#![warn(clippy::for_loop_over_result)]
46+
#![warn(clippy::identity_conversion)]
47+
#![warn(clippy::zero_width_space)]
48+
#![warn(clippy::single_char_push_str)]
49+
#![warn(clippy::if_let_some_result)]
50+
// uplifted lints
51+
#![warn(clippy::invalid_ref)]
52+
#![warn(clippy::into_iter_on_array)]
53+
#![warn(clippy::unused_label)]
54+
#![warn(clippy::drop_bounds)]
55+
#![warn(clippy::temporary_cstring_as_ptr)]
56+
#![warn(clippy::panic_params)]
57+
#![warn(clippy::unknown_clippy_lints)]
58+
#![warn(clippy::invalid_atomic_ordering)]
59+
#![warn(clippy::mem_discriminant_non_enum)]
1260

1361
#[warn(clippy::stutter)]
1462
fn main() {}

tests/ui/rename.stderr

+171-7
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,198 @@
1+
error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_if_conditions`
2+
--> $DIR/rename.rs:10:10
3+
|
4+
LL | #![allow(clippy::block_in_if_condition_expr)]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
6+
|
7+
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
8+
9+
error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_if_conditions`
10+
--> $DIR/rename.rs:11:10
11+
|
12+
LL | #![allow(clippy::block_in_if_condition_stmt)]
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions`
14+
15+
error: unknown lint: `clippy::for_loop_over_fallibles`
16+
--> $DIR/rename.rs:17:10
17+
|
18+
LL | #![allow(clippy::for_loop_over_fallibles)]
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::for_loops_over_fallibles`
20+
|
21+
= note: `-D unknown-lints` implied by `-D warnings`
22+
123
error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity`
2-
--> $DIR/rename.rs:10:9
24+
--> $DIR/rename.rs:33:9
325
|
426
LL | #![warn(clippy::cyclomatic_complexity)]
527
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity`
28+
29+
error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums`
30+
--> $DIR/rename.rs:34:9
631
|
7-
= note: `-D renamed-and-removed-lints` implied by `-D warnings`
32+
LL | #![warn(clippy::mem_discriminant_non_enum)]
33+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums`
34+
35+
error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map`
36+
--> $DIR/rename.rs:35:9
37+
|
38+
LL | #![warn(clippy::option_and_then_some)]
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map`
40+
41+
error: lint `clippy::box_vec` has been renamed to `clippy::box_collection`
42+
--> $DIR/rename.rs:36:9
43+
|
44+
LL | #![warn(clippy::box_vec)]
45+
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection`
46+
47+
error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or`
48+
--> $DIR/rename.rs:37:9
49+
|
50+
LL | #![warn(clippy::option_map_unwrap_or)]
51+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
52+
53+
error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
54+
--> $DIR/rename.rs:38:9
55+
|
56+
LL | #![warn(clippy::option_map_unwrap_or_else)]
57+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
58+
59+
error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or`
60+
--> $DIR/rename.rs:39:9
61+
|
62+
LL | #![warn(clippy::result_map_unwrap_or_else)]
63+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or`
64+
65+
error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used`
66+
--> $DIR/rename.rs:40:9
67+
|
68+
LL | #![warn(clippy::option_unwrap_used)]
69+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
70+
71+
error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used`
72+
--> $DIR/rename.rs:41:9
73+
|
74+
LL | #![warn(clippy::result_unwrap_used)]
75+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used`
76+
77+
error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used`
78+
--> $DIR/rename.rs:42:9
79+
|
80+
LL | #![warn(clippy::option_expect_used)]
81+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
82+
83+
error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used`
84+
--> $DIR/rename.rs:43:9
85+
|
86+
LL | #![warn(clippy::result_expect_used)]
87+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used`
88+
89+
error: lint `clippy::for_loop_over_option` has been renamed to `clippy::for_loops_over_fallibles`
90+
--> $DIR/rename.rs:44:9
91+
|
92+
LL | #![warn(clippy::for_loop_over_option)]
93+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::for_loops_over_fallibles`
94+
95+
error: lint `clippy::for_loop_over_result` has been renamed to `clippy::for_loops_over_fallibles`
96+
--> $DIR/rename.rs:45:9
97+
|
98+
LL | #![warn(clippy::for_loop_over_result)]
99+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::for_loops_over_fallibles`
100+
101+
error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion`
102+
--> $DIR/rename.rs:46:9
103+
|
104+
LL | #![warn(clippy::identity_conversion)]
105+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion`
106+
107+
error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters`
108+
--> $DIR/rename.rs:47:9
109+
|
110+
LL | #![warn(clippy::zero_width_space)]
111+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters`
112+
113+
error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str`
114+
--> $DIR/rename.rs:48:9
115+
|
116+
LL | #![warn(clippy::single_char_push_str)]
117+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str`
118+
119+
error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok`
120+
--> $DIR/rename.rs:49:9
121+
|
122+
LL | #![warn(clippy::if_let_some_result)]
123+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok`
124+
125+
error: lint `clippy::invalid_ref` has been renamed to `invalid_value`
126+
--> $DIR/rename.rs:51:9
127+
|
128+
LL | #![warn(clippy::invalid_ref)]
129+
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value`
130+
131+
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
132+
--> $DIR/rename.rs:52:9
133+
|
134+
LL | #![warn(clippy::into_iter_on_array)]
135+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter`
136+
137+
error: lint `clippy::unused_label` has been renamed to `unused_labels`
138+
--> $DIR/rename.rs:53:9
139+
|
140+
LL | #![warn(clippy::unused_label)]
141+
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels`
142+
143+
error: lint `clippy::drop_bounds` has been renamed to `drop_bounds`
144+
--> $DIR/rename.rs:54:9
145+
|
146+
LL | #![warn(clippy::drop_bounds)]
147+
| ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds`
148+
149+
error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr`
150+
--> $DIR/rename.rs:55:9
151+
|
152+
LL | #![warn(clippy::temporary_cstring_as_ptr)]
153+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr`
154+
155+
error: lint `clippy::panic_params` has been renamed to `non_fmt_panics`
156+
--> $DIR/rename.rs:56:9
157+
|
158+
LL | #![warn(clippy::panic_params)]
159+
| ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics`
160+
161+
error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
162+
--> $DIR/rename.rs:57:9
163+
|
164+
LL | #![warn(clippy::unknown_clippy_lints)]
165+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
166+
167+
error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering`
168+
--> $DIR/rename.rs:58:9
169+
|
170+
LL | #![warn(clippy::invalid_atomic_ordering)]
171+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering`
8172

9173
error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums`
10-
--> $DIR/rename.rs:11:9
174+
--> $DIR/rename.rs:59:9
11175
|
12176
LL | #![warn(clippy::mem_discriminant_non_enum)]
13177
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums`
14178

15179
error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions`
16-
--> $DIR/rename.rs:13:8
180+
--> $DIR/rename.rs:61:8
17181
|
18182
LL | #[warn(clippy::stutter)]
19183
| ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions`
20184

21185
error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default`
22-
--> $DIR/rename.rs:16:8
186+
--> $DIR/rename.rs:64:8
23187
|
24188
LL | #[warn(clippy::new_without_default_derive)]
25189
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default`
26190

27191
error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes`
28-
--> $DIR/rename.rs:19:8
192+
--> $DIR/rename.rs:67:8
29193
|
30194
LL | #[warn(clippy::const_static_lifetime)]
31195
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes`
32196

33-
error: aborting due to 5 previous errors
197+
error: aborting due to 32 previous errors
34198

0 commit comments

Comments
 (0)