Skip to content

Commit d19c651

Browse files
authored
Remove some clippy::all uses from UI tests (#14600)
It's either unneeded (`warn`/`deny`) or can be replaced by individual lints (`allow`). Also removes some redundant `allow`s covered by the default `-Aunused` that I saw along the way changelog: none
2 parents b157411 + 4b140cb commit d19c651

File tree

89 files changed

+454
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+454
-510
lines changed

tests/ui/author/if.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ check-pass
22

3-
#[allow(clippy::all)]
3+
#![allow(clippy::all)]
44

55
fn main() {
66
#[clippy::author]

tests/ui/box_collection.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![warn(clippy::all)]
21
#![allow(
32
clippy::boxed_local,
43
clippy::needless_pass_by_value,

tests/ui/box_collection.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you seem to be trying to use `Box<Vec<..>>`. Consider using just `Vec<..>`
2-
--> tests/ui/box_collection.rs:21:15
2+
--> tests/ui/box_collection.rs:20:15
33
|
44
LL | fn test1(foo: Box<Vec<bool>>) {}
55
| ^^^^^^^^^^^^^^
@@ -9,63 +9,63 @@ LL | fn test1(foo: Box<Vec<bool>>) {}
99
= help: to override `-D warnings` add `#[allow(clippy::box_collection)]`
1010

1111
error: you seem to be trying to use `Box<String>`. Consider using just `String`
12-
--> tests/ui/box_collection.rs:29:15
12+
--> tests/ui/box_collection.rs:28:15
1313
|
1414
LL | fn test3(foo: Box<String>) {}
1515
| ^^^^^^^^^^^
1616
|
1717
= help: `String` is already on the heap, `Box<String>` makes an extra allocation
1818

1919
error: you seem to be trying to use `Box<HashMap<..>>`. Consider using just `HashMap<..>`
20-
--> tests/ui/box_collection.rs:32:15
20+
--> tests/ui/box_collection.rs:31:15
2121
|
2222
LL | fn test4(foo: Box<HashMap<String, String>>) {}
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424
|
2525
= help: `HashMap<..>` is already on the heap, `Box<HashMap<..>>` makes an extra allocation
2626

2727
error: you seem to be trying to use `Box<HashSet<..>>`. Consider using just `HashSet<..>`
28-
--> tests/ui/box_collection.rs:35:15
28+
--> tests/ui/box_collection.rs:34:15
2929
|
3030
LL | fn test5(foo: Box<HashSet<i64>>) {}
3131
| ^^^^^^^^^^^^^^^^^
3232
|
3333
= help: `HashSet<..>` is already on the heap, `Box<HashSet<..>>` makes an extra allocation
3434

3535
error: you seem to be trying to use `Box<VecDeque<..>>`. Consider using just `VecDeque<..>`
36-
--> tests/ui/box_collection.rs:38:15
36+
--> tests/ui/box_collection.rs:37:15
3737
|
3838
LL | fn test6(foo: Box<VecDeque<i32>>) {}
3939
| ^^^^^^^^^^^^^^^^^^
4040
|
4141
= help: `VecDeque<..>` is already on the heap, `Box<VecDeque<..>>` makes an extra allocation
4242

4343
error: you seem to be trying to use `Box<LinkedList<..>>`. Consider using just `LinkedList<..>`
44-
--> tests/ui/box_collection.rs:41:15
44+
--> tests/ui/box_collection.rs:40:15
4545
|
4646
LL | fn test7(foo: Box<LinkedList<i16>>) {}
4747
| ^^^^^^^^^^^^^^^^^^^^
4848
|
4949
= help: `LinkedList<..>` is already on the heap, `Box<LinkedList<..>>` makes an extra allocation
5050

5151
error: you seem to be trying to use `Box<BTreeMap<..>>`. Consider using just `BTreeMap<..>`
52-
--> tests/ui/box_collection.rs:44:15
52+
--> tests/ui/box_collection.rs:43:15
5353
|
5454
LL | fn test8(foo: Box<BTreeMap<i8, String>>) {}
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5656
|
5757
= help: `BTreeMap<..>` is already on the heap, `Box<BTreeMap<..>>` makes an extra allocation
5858

5959
error: you seem to be trying to use `Box<BTreeSet<..>>`. Consider using just `BTreeSet<..>`
60-
--> tests/ui/box_collection.rs:47:15
60+
--> tests/ui/box_collection.rs:46:15
6161
|
6262
LL | fn test9(foo: Box<BTreeSet<u64>>) {}
6363
| ^^^^^^^^^^^^^^^^^^
6464
|
6565
= help: `BTreeSet<..>` is already on the heap, `Box<BTreeSet<..>>` makes an extra allocation
6666

6767
error: you seem to be trying to use `Box<BinaryHeap<..>>`. Consider using just `BinaryHeap<..>`
68-
--> tests/ui/box_collection.rs:50:16
68+
--> tests/ui/box_collection.rs:49:16
6969
|
7070
LL | fn test10(foo: Box<BinaryHeap<u32>>) {}
7171
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/cognitive_complexity.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
#![allow(clippy::all)]
21
#![warn(clippy::cognitive_complexity)]
3-
#![allow(unused, unused_crate_dependencies)]
2+
#![allow(
3+
clippy::eq_op,
4+
clippy::needless_borrows_for_generic_args,
5+
clippy::needless_return,
6+
clippy::nonminimal_bool,
7+
clippy::uninlined_format_args
8+
)]
49

510
#[rustfmt::skip]
611
fn main() {

tests/ui/cognitive_complexity.stderr

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: the function has a cognitive complexity of (28/25)
2-
--> tests/ui/cognitive_complexity.rs:6:4
2+
--> tests/ui/cognitive_complexity.rs:11:4
33
|
44
LL | fn main() {
55
| ^^^^
@@ -9,151 +9,151 @@ LL | fn main() {
99
= help: to override `-D warnings` add `#[allow(clippy::cognitive_complexity)]`
1010

1111
error: the function has a cognitive complexity of (7/1)
12-
--> tests/ui/cognitive_complexity.rs:93:4
12+
--> tests/ui/cognitive_complexity.rs:98:4
1313
|
1414
LL | fn kaboom() {
1515
| ^^^^^^
1616
|
1717
= help: you could split it up into multiple smaller functions
1818

1919
error: the function has a cognitive complexity of (2/1)
20-
--> tests/ui/cognitive_complexity.rs:153:4
20+
--> tests/ui/cognitive_complexity.rs:158:4
2121
|
2222
LL | fn baa() {
2323
| ^^^
2424
|
2525
= help: you could split it up into multiple smaller functions
2626

2727
error: the function has a cognitive complexity of (2/1)
28-
--> tests/ui/cognitive_complexity.rs:156:13
28+
--> tests/ui/cognitive_complexity.rs:161:13
2929
|
3030
LL | let x = || match 99 {
3131
| ^^
3232
|
3333
= help: you could split it up into multiple smaller functions
3434

3535
error: the function has a cognitive complexity of (2/1)
36-
--> tests/ui/cognitive_complexity.rs:174:4
36+
--> tests/ui/cognitive_complexity.rs:179:4
3737
|
3838
LL | fn bar() {
3939
| ^^^
4040
|
4141
= help: you could split it up into multiple smaller functions
4242

4343
error: the function has a cognitive complexity of (2/1)
44-
--> tests/ui/cognitive_complexity.rs:187:4
44+
--> tests/ui/cognitive_complexity.rs:192:4
4545
|
4646
LL | fn dont_warn_on_tests() {
4747
| ^^^^^^^^^^^^^^^^^^
4848
|
4949
= help: you could split it up into multiple smaller functions
5050

5151
error: the function has a cognitive complexity of (2/1)
52-
--> tests/ui/cognitive_complexity.rs:197:4
52+
--> tests/ui/cognitive_complexity.rs:202:4
5353
|
5454
LL | fn barr() {
5555
| ^^^^
5656
|
5757
= help: you could split it up into multiple smaller functions
5858

5959
error: the function has a cognitive complexity of (3/1)
60-
--> tests/ui/cognitive_complexity.rs:209:4
60+
--> tests/ui/cognitive_complexity.rs:214:4
6161
|
6262
LL | fn barr2() {
6363
| ^^^^^
6464
|
6565
= help: you could split it up into multiple smaller functions
6666

6767
error: the function has a cognitive complexity of (2/1)
68-
--> tests/ui/cognitive_complexity.rs:227:4
68+
--> tests/ui/cognitive_complexity.rs:232:4
6969
|
7070
LL | fn barrr() {
7171
| ^^^^^
7272
|
7373
= help: you could split it up into multiple smaller functions
7474

7575
error: the function has a cognitive complexity of (3/1)
76-
--> tests/ui/cognitive_complexity.rs:239:4
76+
--> tests/ui/cognitive_complexity.rs:244:4
7777
|
7878
LL | fn barrr2() {
7979
| ^^^^^^
8080
|
8181
= help: you could split it up into multiple smaller functions
8282

8383
error: the function has a cognitive complexity of (2/1)
84-
--> tests/ui/cognitive_complexity.rs:257:4
84+
--> tests/ui/cognitive_complexity.rs:262:4
8585
|
8686
LL | fn barrrr() {
8787
| ^^^^^^
8888
|
8989
= help: you could split it up into multiple smaller functions
9090

9191
error: the function has a cognitive complexity of (3/1)
92-
--> tests/ui/cognitive_complexity.rs:269:4
92+
--> tests/ui/cognitive_complexity.rs:274:4
9393
|
9494
LL | fn barrrr2() {
9595
| ^^^^^^^
9696
|
9797
= help: you could split it up into multiple smaller functions
9898

9999
error: the function has a cognitive complexity of (2/1)
100-
--> tests/ui/cognitive_complexity.rs:287:4
100+
--> tests/ui/cognitive_complexity.rs:292:4
101101
|
102102
LL | fn cake() {
103103
| ^^^^
104104
|
105105
= help: you could split it up into multiple smaller functions
106106

107107
error: the function has a cognitive complexity of (4/1)
108-
--> tests/ui/cognitive_complexity.rs:299:8
108+
--> tests/ui/cognitive_complexity.rs:304:8
109109
|
110110
LL | pub fn read_file(input_path: &str) -> String {
111111
| ^^^^^^^^^
112112
|
113113
= help: you could split it up into multiple smaller functions
114114

115115
error: the function has a cognitive complexity of (2/1)
116-
--> tests/ui/cognitive_complexity.rs:332:4
116+
--> tests/ui/cognitive_complexity.rs:337:4
117117
|
118118
LL | fn void(void: Void) {
119119
| ^^^^
120120
|
121121
= help: you could split it up into multiple smaller functions
122122

123123
error: the function has a cognitive complexity of (8/1)
124-
--> tests/ui/cognitive_complexity.rs:385:4
124+
--> tests/ui/cognitive_complexity.rs:390:4
125125
|
126126
LL | fn early_ret() -> i32 {
127127
| ^^^^^^^^^
128128
|
129129
= help: you could split it up into multiple smaller functions
130130

131131
error: the function has a cognitive complexity of (2/1)
132-
--> tests/ui/cognitive_complexity.rs:408:13
132+
--> tests/ui/cognitive_complexity.rs:413:13
133133
|
134134
LL | let x = |a: i32, b: i32| -> i32 {
135135
| ^^^^^^^^^^^^^^^^
136136
|
137137
= help: you could split it up into multiple smaller functions
138138

139139
error: the function has a cognitive complexity of (2/1)
140-
--> tests/ui/cognitive_complexity.rs:423:8
140+
--> tests/ui/cognitive_complexity.rs:428:8
141141
|
142142
LL | fn moo(&self) {
143143
| ^^^
144144
|
145145
= help: you could split it up into multiple smaller functions
146146

147147
error: the function has a cognitive complexity of (2/1)
148-
--> tests/ui/cognitive_complexity.rs:434:14
148+
--> tests/ui/cognitive_complexity.rs:439:14
149149
|
150150
LL | async fn a() {
151151
| ^
152152
|
153153
= help: you could split it up into multiple smaller functions
154154

155155
error: the function has a cognitive complexity of (2/1)
156-
--> tests/ui/cognitive_complexity.rs:443:22
156+
--> tests/ui/cognitive_complexity.rs:448:22
157157
|
158158
LL | pub async fn async_method() {
159159
| ^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
//@ check-pass
22

3-
#![deny(clippy::all)]
4-
#![allow(unused_imports)]
5-
63
use std::*;
74

85
fn main() {}

tests/ui/crashes/ice-1588.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ check-pass
22

3-
#![allow(clippy::all)]
3+
#![expect(clippy::no_effect)]
44

55
// Test for https://github.com/rust-lang/rust-clippy/issues/1588
66

tests/ui/crashes/ice-1969.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ check-pass
22

3-
#![allow(clippy::all)]
4-
53
// Test for https://github.com/rust-lang/rust-clippy/issues/1969
64

75
fn main() {}

tests/ui/crashes/ice-3462.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//@ check-pass
22

3-
#![warn(clippy::all)]
4-
#![allow(clippy::disallowed_names, clippy::equatable_if_let, clippy::needless_if)]
5-
#![allow(unused)]
3+
#![expect(clippy::disallowed_names)]
64

75
// Test for https://github.com/rust-lang/rust-clippy/issues/3462
86

tests/ui/crashes/ice-700.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//@ check-pass
22

3-
#![deny(clippy::all)]
4-
53
// Test for https://github.com/rust-lang/rust-clippy/issues/700
64

75
fn core() {}

tests/ui/crashes/ice-7012.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ check-pass
22

3-
#![allow(clippy::all)]
3+
#![expect(clippy::single_match)]
44

55
enum _MyOption {
66
None,

tests/ui/crashes/ice_exact_size.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
//@ check-pass
22

3-
#![deny(clippy::all)]
4-
53
// Test for https://github.com/rust-lang/rust-clippy/issues/1336
64

7-
#[allow(dead_code)]
85
struct Foo;
96

107
impl Iterator for Foo {

tests/ui/crashes/needless_borrow_fp.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22

3-
#[deny(clippy::all)]
43
#[derive(Debug)]
54
pub enum Error {
65
Type(&'static str),

tests/ui/crate_level_checks/no_std_swap.fixed

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

44
use core::panic::PanicInfo;
55

6-
#[warn(clippy::all)]
76
pub fn main() {
87
let mut a = 42;
98
let mut b = 1337;

tests/ui/crate_level_checks/no_std_swap.rs

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

44
use core::panic::PanicInfo;
55

6-
#[warn(clippy::all)]
76
pub fn main() {
87
let mut a = 42;
98
let mut b = 1337;
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
error: this looks like you are trying to swap `a` and `b`
2-
--> tests/ui/crate_level_checks/no_std_swap.rs:11:5
2+
--> tests/ui/crate_level_checks/no_std_swap.rs:10:5
33
|
44
LL | / a = b;
55
... |
66
LL | | b = a;
77
| |_________^ help: try: `core::mem::swap(&mut a, &mut b)`
88
|
99
= note: or maybe you should use `core::mem::replace`?
10-
= note: `-D clippy::almost-swapped` implied by `-D warnings`
11-
= help: to override `-D warnings` add `#[allow(clippy::almost_swapped)]`
10+
= note: `#[deny(clippy::almost_swapped)]` on by default
1211

1312
error: aborting due to 1 previous error
1413

tests/ui/filter_map_next.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::all, clippy::pedantic)]
1+
#![warn(clippy::filter_map_next)]
22

33
fn main() {
44
let a = ["1", "lol", "3", "NaN", "5"];

tests/ui/filter_map_next_fixable.fixed

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![warn(clippy::all, clippy::pedantic)]
2-
#![allow(unused)]
1+
#![warn(clippy::filter_map_next)]
32

43
fn main() {
54
let a = ["1", "lol", "3", "NaN", "5"];

0 commit comments

Comments
 (0)