RS.CLIPPY.ITER_NEXT_LOOP

For-looping over `_.next()` which is probably not intended

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

What it does

Checks for loops on x.next().

Why is this bad?

next() returns either Some(value) if there was a value, or None otherwise. The insidious thing is that Option<_> implements IntoIterator, so that possibly one value will be iterated, leading to some hard to find bugs. No one will want to write such code except to win an Underhanded Rust Contest.

Example

for x in y.next() {
    ..
}