RS.CLIPPY.INTO_ITER_ON_REF

Using `.into_iter()` on a reference

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: into_iter_on_ref. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for into_iter calls on references which should be replaced by iter or iter_mut.

Why is this bad?

Readability. Calling into_iter on a reference will not move out its content into the resulting iterator, which is confusing. It is better just call iter or iter_mut directly.

Example

(&vec).into_iter();

Use instead:

(&vec).iter();