Skip to content

Commit

Permalink
Regression test for into_iter_on_array
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed May 12, 2019
1 parent 19e852c commit 2420eab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/ui/into_iter_on_array_in_for_loop.rs
@@ -0,0 +1,6 @@
// Tracking issue: #3913
#![deny(clippy::into_iter_on_array)]

fn main() {
for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
}
14 changes: 14 additions & 0 deletions tests/ui/into_iter_on_array_in_for_loop.stderr
@@ -0,0 +1,14 @@
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> $DIR/into_iter_on_ref.rs:5:24
|
LL | for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
| ^^^^^^^^^ help: call directly: `iter`
|
note: lint level defined here
--> $DIR/into_iter_on_ref.rs:2:9
|
LL | #![deny(clippy::into_iter_on_array)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit 2420eab

Please sign in to comment.