Skip to content

Commit 2420eab

Browse files
committed
Regression test for into_iter_on_array
1 parent 19e852c commit 2420eab

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Tracking issue: #3913
2+
#![deny(clippy::into_iter_on_array)]
3+
4+
fn main() {
5+
for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: this .into_iter() call is equivalent to .iter() and will not move the array
2+
--> $DIR/into_iter_on_ref.rs:5:24
3+
|
4+
LL | for _ in [1, 2, 3].into_iter() {} //~ ERROR equivalent to .iter()
5+
| ^^^^^^^^^ help: call directly: `iter`
6+
|
7+
note: lint level defined here
8+
--> $DIR/into_iter_on_ref.rs:2:9
9+
|
10+
LL | #![deny(clippy::into_iter_on_array)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)