Skip to content

Commit b13704a

Browse files
committed
update test suites
1 parent 0e1cbc5 commit b13704a

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

tests/ui/explicit_counter_loop.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ error: the variable `idx_usize` is used as a loop counter
4646
--> $DIR/explicit_counter_loop.rs:170:9
4747
|
4848
LL | for _item in slice {
49-
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_usize, _item) in slice.into_iter().enumerate()`
49+
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_usize, _item) in slice.iter().enumerate()`
5050

5151
error: the variable `idx_u32` is used as a loop counter
5252
--> $DIR/explicit_counter_loop.rs:182:9
5353
|
5454
LL | for _item in slice {
55-
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_u32, _item) in (0_u32..).zip(slice.into_iter())`
55+
| ^^^^^^^^^^^^^^^^^^ help: consider using: `for (idx_u32, _item) in (0_u32..).zip(slice.iter())`
5656
|
5757
= note: `idx_u32` is of type `u32`, making it ineligible for `Iterator::enumerate`
5858

tests/ui/manual_flatten.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ fn main() {
2626
}
2727

2828
// Test for loop over an implicit reference
29-
// Note: if `clippy::manual_flatten` is made autofixable, this case will
30-
// lead to a follow-up lint `clippy::into_iter_on_ref`
3129
let z = &y;
3230
for n in z {
3331
if let Ok(n) = n {

tests/ui/manual_flatten.stderr

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ LL | | }
6363
| |_________^
6464

6565
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
66-
--> $DIR/manual_flatten.rs:32:5
66+
--> $DIR/manual_flatten.rs:30:5
6767
|
6868
LL | for n in z {
69-
| ^ - help: try: `z.into_iter().flatten()`
69+
| ^ - help: try: `z.iter().flatten()`
7070
| _____|
7171
| |
7272
LL | | if let Ok(n) = n {
@@ -76,15 +76,15 @@ LL | | }
7676
| |_____^
7777
|
7878
help: ...and remove the `if let` statement in the for loop
79-
--> $DIR/manual_flatten.rs:33:9
79+
--> $DIR/manual_flatten.rs:31:9
8080
|
8181
LL | / if let Ok(n) = n {
8282
LL | | println!("{}", n);
8383
LL | | }
8484
| |_________^
8585

8686
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
87-
--> $DIR/manual_flatten.rs:41:5
87+
--> $DIR/manual_flatten.rs:39:5
8888
|
8989
LL | for n in z {
9090
| ^ - help: try: `z.flatten()`
@@ -97,15 +97,15 @@ LL | | }
9797
| |_____^
9898
|
9999
help: ...and remove the `if let` statement in the for loop
100-
--> $DIR/manual_flatten.rs:42:9
100+
--> $DIR/manual_flatten.rs:40:9
101101
|
102102
LL | / if let Some(m) = n {
103103
LL | | println!("{}", m);
104104
LL | | }
105105
| |_________^
106106

107107
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
108-
--> $DIR/manual_flatten.rs:74:5
108+
--> $DIR/manual_flatten.rs:72:5
109109
|
110110
LL | for n in &vec_of_ref {
111111
| ^ ----------- help: try: `vec_of_ref.iter().copied().flatten()`
@@ -118,18 +118,18 @@ LL | | }
118118
| |_____^
119119
|
120120
help: ...and remove the `if let` statement in the for loop
121-
--> $DIR/manual_flatten.rs:75:9
121+
--> $DIR/manual_flatten.rs:73:9
122122
|
123123
LL | / if let Some(n) = n {
124124
LL | | println!("{:?}", n);
125125
LL | | }
126126
| |_________^
127127

128128
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
129-
--> $DIR/manual_flatten.rs:81:5
129+
--> $DIR/manual_flatten.rs:79:5
130130
|
131131
LL | for n in vec_of_ref {
132-
| ^ ---------- help: try: `vec_of_ref.into_iter().copied().flatten()`
132+
| ^ ---------- help: try: `vec_of_ref.iter().copied().flatten()`
133133
| _____|
134134
| |
135135
LL | | if let Some(n) = n {
@@ -139,18 +139,18 @@ LL | | }
139139
| |_____^
140140
|
141141
help: ...and remove the `if let` statement in the for loop
142-
--> $DIR/manual_flatten.rs:82:9
142+
--> $DIR/manual_flatten.rs:80:9
143143
|
144144
LL | / if let Some(n) = n {
145145
LL | | println!("{:?}", n);
146146
LL | | }
147147
| |_________^
148148

149149
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
150-
--> $DIR/manual_flatten.rs:88:5
150+
--> $DIR/manual_flatten.rs:86:5
151151
|
152152
LL | for n in slice_of_ref {
153-
| ^ ------------ help: try: `slice_of_ref.into_iter().copied().flatten()`
153+
| ^ ------------ help: try: `slice_of_ref.iter().copied().flatten()`
154154
| _____|
155155
| |
156156
LL | | if let Some(n) = n {
@@ -160,7 +160,7 @@ LL | | }
160160
| |_____^
161161
|
162162
help: ...and remove the `if let` statement in the for loop
163-
--> $DIR/manual_flatten.rs:89:9
163+
--> $DIR/manual_flatten.rs:87:9
164164
|
165165
LL | / if let Some(n) = n {
166166
LL | | println!("{:?}", n);

0 commit comments

Comments
 (0)