Skip to content

Commit 78323ba

Browse files
committed
Attributes cleanup in tests [09/20]
1 parent 3e3db3f commit 78323ba

85 files changed

Lines changed: 481 additions & 657 deletions

File tree

Some content is hidden

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

tests/ui/items_after_test_module/imported_module.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22
//@compile-flags: --test
3-
#![allow(unused)]
43
#![warn(clippy::items_after_test_module)]
54

65
// Nothing here should lint, as `tests` is an imported module (that has no body).

tests/ui/iter_cloned_collect.fixed

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(unused)]
2-
#![allow(clippy::useless_vec)]
1+
#![expect(clippy::useless_vec)]
32

43
use std::collections::{HashSet, VecDeque};
54

tests/ui/iter_cloned_collect.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#![allow(unused)]
2-
#![allow(clippy::useless_vec)]
1+
#![expect(clippy::useless_vec)]
32

43
use std::collections::{HashSet, VecDeque};
54

tests/ui/iter_cloned_collect.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: called `.iter().cloned().collect()` on a slice to create a `Vec`
2-
--> tests/ui/iter_cloned_collect.rs:8:27
2+
--> tests/ui/iter_cloned_collect.rs:7:27
33
|
44
LL | let v2: Vec<isize> = v.iter().cloned().collect();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL + let v2: Vec<isize> = v.to_vec();
1313
|
1414

1515
error: called `.iter().cloned().collect()` on a slice to create a `Vec`
16-
--> tests/ui/iter_cloned_collect.rs:14:38
16+
--> tests/ui/iter_cloned_collect.rs:13:38
1717
|
1818
LL | let _: Vec<isize> = vec![1, 2, 3].iter().cloned().collect();
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL + let _: Vec<isize> = vec![1, 2, 3].to_vec();
2525
|
2626

2727
error: called `.iter().cloned().collect()` on a slice to create a `Vec`
28-
--> tests/ui/iter_cloned_collect.rs:20:24
28+
--> tests/ui/iter_cloned_collect.rs:19:24
2929
|
3030
LL | .to_bytes()
3131
| ________________________^
@@ -46,7 +46,7 @@ LL + .to_bytes().to_vec();
4646
|
4747

4848
error: called `.iter().cloned().collect()` on a slice to create a `Vec`
49-
--> tests/ui/iter_cloned_collect.rs:29:24
49+
--> tests/ui/iter_cloned_collect.rs:28:24
5050
|
5151
LL | let _: Vec<_> = arr.iter().cloned().collect();
5252
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -58,7 +58,7 @@ LL + let _: Vec<_> = arr.to_vec();
5858
|
5959

6060
error: called `.iter().copied().collect()` on a slice to create a `Vec`
61-
--> tests/ui/iter_cloned_collect.rs:33:26
61+
--> tests/ui/iter_cloned_collect.rs:32:26
6262
|
6363
LL | let _: Vec<isize> = v.iter().copied().collect();
6464
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -70,7 +70,7 @@ LL + let _: Vec<isize> = v.to_vec();
7070
|
7171

7272
error: called `.iter().cloned().collect()` on a slice to create a `Vec`
73-
--> tests/ui/iter_cloned_collect.rs:59:33
73+
--> tests/ui/iter_cloned_collect.rs:58:33
7474
|
7575
LL | let v: Vec<&&String> = a.iter().cloned().collect();
7676
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/iter_count.fixed

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
//@aux-build:option_helpers.rs
22

33
#![warn(clippy::iter_count)]
4-
#![allow(
5-
unused_variables,
6-
array_into_iter,
7-
unused_mut,
8-
clippy::into_iter_on_ref,
9-
clippy::unnecessary_operation,
10-
clippy::useless_vec
11-
)]
4+
#![allow(clippy::into_iter_on_ref, clippy::useless_vec)]
5+
#![expect(clippy::unnecessary_operation)]
126

137
extern crate option_helpers;
148

@@ -33,7 +27,6 @@ impl HasIter {
3327
}
3428
}
3529

36-
#[allow(unused_must_use)]
3730
fn main() {
3831
let mut vec = vec![0, 1, 2, 3];
3932
let mut boxed_slice: Box<[u8]> = Box::new([0, 1, 2, 3]);

tests/ui/iter_count.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
//@aux-build:option_helpers.rs
22

33
#![warn(clippy::iter_count)]
4-
#![allow(
5-
unused_variables,
6-
array_into_iter,
7-
unused_mut,
8-
clippy::into_iter_on_ref,
9-
clippy::unnecessary_operation,
10-
clippy::useless_vec
11-
)]
4+
#![allow(clippy::into_iter_on_ref, clippy::useless_vec)]
5+
#![expect(clippy::unnecessary_operation)]
126

137
extern crate option_helpers;
148

@@ -33,7 +27,6 @@ impl HasIter {
3327
}
3428
}
3529

36-
#[allow(unused_must_use)]
3730
fn main() {
3831
let mut vec = vec![0, 1, 2, 3];
3932
let mut boxed_slice: Box<[u8]> = Box::new([0, 1, 2, 3]);

tests/ui/iter_count.stderr

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: called `.iter().count()` on a `slice`
2-
--> tests/ui/iter_count.rs:54:6
2+
--> tests/ui/iter_count.rs:47:6
33
|
44
LL | &vec[..].iter().count();
55
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()`
@@ -8,145 +8,145 @@ LL | &vec[..].iter().count();
88
= help: to override `-D warnings` add `#[allow(clippy::iter_count)]`
99

1010
error: called `.iter().count()` on a `Vec`
11-
--> tests/ui/iter_count.rs:56:5
11+
--> tests/ui/iter_count.rs:49:5
1212
|
1313
LL | vec.iter().count();
1414
| ^^^^^^^^^^^^^^^^^^ help: try: `vec.len()`
1515

1616
error: called `.iter().count()` on a `slice`
17-
--> tests/ui/iter_count.rs:58:5
17+
--> tests/ui/iter_count.rs:51:5
1818
|
1919
LL | boxed_slice.iter().count();
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `boxed_slice.len()`
2121

2222
error: called `.iter().count()` on a `VecDeque`
23-
--> tests/ui/iter_count.rs:60:5
23+
--> tests/ui/iter_count.rs:53:5
2424
|
2525
LL | vec_deque.iter().count();
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()`
2727

2828
error: called `.iter().count()` on a `HashSet`
29-
--> tests/ui/iter_count.rs:62:5
29+
--> tests/ui/iter_count.rs:55:5
3030
|
3131
LL | hash_set.iter().count();
3232
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_set.len()`
3333

3434
error: called `.iter().count()` on a `HashMap`
35-
--> tests/ui/iter_count.rs:64:5
35+
--> tests/ui/iter_count.rs:57:5
3636
|
3737
LL | hash_map.iter().count();
3838
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()`
3939

4040
error: called `.iter().count()` on a `BTreeMap`
41-
--> tests/ui/iter_count.rs:66:5
41+
--> tests/ui/iter_count.rs:59:5
4242
|
4343
LL | b_tree_map.iter().count();
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()`
4545

4646
error: called `.iter().count()` on a `BTreeSet`
47-
--> tests/ui/iter_count.rs:68:5
47+
--> tests/ui/iter_count.rs:61:5
4848
|
4949
LL | b_tree_set.iter().count();
5050
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_set.len()`
5151

5252
error: called `.iter().count()` on a `LinkedList`
53-
--> tests/ui/iter_count.rs:70:5
53+
--> tests/ui/iter_count.rs:63:5
5454
|
5555
LL | linked_list.iter().count();
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()`
5757

5858
error: called `.iter().count()` on a `BinaryHeap`
59-
--> tests/ui/iter_count.rs:72:5
59+
--> tests/ui/iter_count.rs:65:5
6060
|
6161
LL | binary_heap.iter().count();
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `binary_heap.len()`
6363

6464
error: called `.iter_mut().count()` on a `Vec`
65-
--> tests/ui/iter_count.rs:75:5
65+
--> tests/ui/iter_count.rs:68:5
6666
|
6767
LL | vec.iter_mut().count();
6868
| ^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()`
6969

7070
error: called `.iter_mut().count()` on a `slice`
71-
--> tests/ui/iter_count.rs:77:6
71+
--> tests/ui/iter_count.rs:70:6
7272
|
7373
LL | &vec[..].iter_mut().count();
7474
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()`
7575

7676
error: called `.iter_mut().count()` on a `VecDeque`
77-
--> tests/ui/iter_count.rs:79:5
77+
--> tests/ui/iter_count.rs:72:5
7878
|
7979
LL | vec_deque.iter_mut().count();
8080
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()`
8181

8282
error: called `.iter_mut().count()` on a `HashMap`
83-
--> tests/ui/iter_count.rs:81:5
83+
--> tests/ui/iter_count.rs:74:5
8484
|
8585
LL | hash_map.iter_mut().count();
8686
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()`
8787

8888
error: called `.iter_mut().count()` on a `BTreeMap`
89-
--> tests/ui/iter_count.rs:83:5
89+
--> tests/ui/iter_count.rs:76:5
9090
|
9191
LL | b_tree_map.iter_mut().count();
9292
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()`
9393

9494
error: called `.iter_mut().count()` on a `LinkedList`
95-
--> tests/ui/iter_count.rs:85:5
95+
--> tests/ui/iter_count.rs:78:5
9696
|
9797
LL | linked_list.iter_mut().count();
9898
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()`
9999

100100
error: called `.into_iter().count()` on a `slice`
101-
--> tests/ui/iter_count.rs:88:6
101+
--> tests/ui/iter_count.rs:81:6
102102
|
103103
LL | &vec[..].into_iter().count();
104104
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec[..].len()`
105105

106106
error: called `.into_iter().count()` on a `Vec`
107-
--> tests/ui/iter_count.rs:90:5
107+
--> tests/ui/iter_count.rs:83:5
108108
|
109109
LL | vec.into_iter().count();
110110
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec.len()`
111111

112112
error: called `.into_iter().count()` on a `VecDeque`
113-
--> tests/ui/iter_count.rs:92:5
113+
--> tests/ui/iter_count.rs:85:5
114114
|
115115
LL | vec_deque.into_iter().count();
116116
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec_deque.len()`
117117

118118
error: called `.into_iter().count()` on a `HashSet`
119-
--> tests/ui/iter_count.rs:94:5
119+
--> tests/ui/iter_count.rs:87:5
120120
|
121121
LL | hash_set.into_iter().count();
122122
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_set.len()`
123123

124124
error: called `.into_iter().count()` on a `HashMap`
125-
--> tests/ui/iter_count.rs:96:5
125+
--> tests/ui/iter_count.rs:89:5
126126
|
127127
LL | hash_map.into_iter().count();
128128
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `hash_map.len()`
129129

130130
error: called `.into_iter().count()` on a `BTreeMap`
131-
--> tests/ui/iter_count.rs:98:5
131+
--> tests/ui/iter_count.rs:91:5
132132
|
133133
LL | b_tree_map.into_iter().count();
134134
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_map.len()`
135135

136136
error: called `.into_iter().count()` on a `BTreeSet`
137-
--> tests/ui/iter_count.rs:100:5
137+
--> tests/ui/iter_count.rs:93:5
138138
|
139139
LL | b_tree_set.into_iter().count();
140140
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b_tree_set.len()`
141141

142142
error: called `.into_iter().count()` on a `LinkedList`
143-
--> tests/ui/iter_count.rs:102:5
143+
--> tests/ui/iter_count.rs:95:5
144144
|
145145
LL | linked_list.into_iter().count();
146146
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `linked_list.len()`
147147

148148
error: called `.into_iter().count()` on a `BinaryHeap`
149-
--> tests/ui/iter_count.rs:104:5
149+
--> tests/ui/iter_count.rs:97:5
150150
|
151151
LL | binary_heap.into_iter().count();
152152
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `binary_heap.len()`

tests/ui/iter_filter_is_ok.fixed

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#![warn(clippy::iter_filter_is_ok)]
2-
#![allow(
3-
clippy::map_identity,
4-
clippy::result_filter_map,
5-
clippy::needless_borrow,
6-
clippy::redundant_closure
7-
)]
2+
#![allow(clippy::needless_borrow, clippy::redundant_closure)]
3+
#![expect(clippy::map_identity, clippy::result_filter_map)]
84

95
fn main() {
106
{

tests/ui/iter_filter_is_ok.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#![warn(clippy::iter_filter_is_ok)]
2-
#![allow(
3-
clippy::map_identity,
4-
clippy::result_filter_map,
5-
clippy::needless_borrow,
6-
clippy::redundant_closure
7-
)]
2+
#![allow(clippy::needless_borrow, clippy::redundant_closure)]
3+
#![expect(clippy::map_identity, clippy::result_filter_map)]
84

95
fn main() {
106
{

0 commit comments

Comments
 (0)