pub static ARRAY_INTO_ITER: &'static Lint
Expand description

The array_into_iter lint detects calling into_iter on arrays.

Example

[1, 2, 3].into_iter().for_each(|n| { *n; });

{{produces}}

Explanation

Since Rust 1.53, arrays implement IntoIterator. However, to avoid breakage, array.into_iter() in Rust 2015 and 2018 code will still behave as (&array).into_iter(), returning an iterator over references, just like in Rust 1.52 and earlier. This only applies to the method call syntax array.into_iter(), not to any other syntax such as for _ in array or IntoIterator::into_iter(array).