Skip to content

Commit

Permalink
Regression test for explicit_iter_loop
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed May 12, 2019
1 parent 2122bdb commit 19e852c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/ui/explicit_iter_loop_no_sugg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Tracking issue: #3913
#![deny(clippy::explicit_iter_loop)]

fn main() {
let vec = vec![1];
for _v in vec.iter() {} //~ ERROR change to `&vec`
}
14 changes: 14 additions & 0 deletions tests/ui/explicit_iter_loop_no_sugg.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/explicit_iter_loop_no_sugg.rs:6:15
|
LL | for _v in vec.iter() {} //~ ERROR change to `&vec`
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
|
note: lint level defined here
--> $DIR/explicit_iter_loop_no_sugg.rs:2:9
|
LL | #![deny(clippy::explicit_iter_loop)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit 19e852c

Please sign in to comment.