Open
Description
When using into_iter
on an array within the size limits of the current impl IntoIterator for &[T; _]
implementations you get a deny-by-default lint failure:
error: this .into_iter() call is equivalent to .iter() and will not move the array
--> src/main.rs:2:22
|
2 | for _ in [0; 32].into_iter() {
| ^^^^^^^^^ help: call directly: `iter`
|
= note: `#[deny(clippy::into_iter_on_array)]` on by default
If you increase the array size past those provided implementations you instead get a warn-by-default lint:
warning: this .into_iter() call is equivalent to .iter() and will not move the slice
--> src/main.rs:2:22
|
2 | for _ in [0; 33].into_iter() {
| ^^^^^^^^^ help: call directly: `iter`
|
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
It seems both of these cases would be affected equally by a future const-generic powered impl<T, const N: usize> IntoIterator for [T; N]
.