RS.CLIPPY.ITER_OUT_OF_BOUNDS
Calls to `.take()` or `.skip()` that are out of bounds
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_out_of_bounds. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Looks for iterator combinator calls such as .take(x) or .skip(x)
where x is greater than the amount of items that an iterator will produce.
Why is this bad?
Taking or skipping more items than there are in an iterator either creates an iterator with all items from the original iterator or an iterator with no items at all. This is most likely not what the user intended to do.
Example
for _ in [1, 2, 3].iter().take(4) {}
Use instead:
for _ in [1, 2, 3].iter() {}