BOXED_SLICE_INTO_ITER in rustc_lint - Rust
Description: The `boxed_slice_into_iter` lint detects calling `into_iter` on boxed slices.

Skip to main content

## BOXED_SLICE_INTO_ITER

# Static BOXED_SLICE_INTO_ITER

Source

    pub static BOXED_SLICE_INTO_ITER: &Lint

Expand description

The `boxed_slice_into_iter` lint detects calling `into_iter` on boxed slices.

#### §Example

ⓘ

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

{{produces}}

#### §Explanation

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