Skip to content

Commit 19e852c

Browse files
committed
Regression test for explicit_iter_loop
1 parent 2122bdb commit 19e852c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Tracking issue: #3913
2+
#![deny(clippy::explicit_iter_loop)]
3+
4+
fn main() {
5+
let vec = vec![1];
6+
for _v in vec.iter() {} //~ ERROR change to `&vec`
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2+
--> $DIR/explicit_iter_loop_no_sugg.rs:6:15
3+
|
4+
LL | for _v in vec.iter() {} //~ ERROR change to `&vec`
5+
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
6+
|
7+
note: lint level defined here
8+
--> $DIR/explicit_iter_loop_no_sugg.rs:2:9
9+
|
10+
LL | #![deny(clippy::explicit_iter_loop)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)