RS.CLIPPY.ITER_COUNT
Replace `.iter().count()` with `.len()`
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_count. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for the use of .iter().count().
Why is this bad?
.len() is more efficient and more
readable.
Example
let some_vec = vec![0, 1, 2, 3];
some_vec.iter().count();
&some_vec[..].iter().count();
Use instead:
let some_vec = vec![0, 1, 2, 3];
some_vec.len();
&some_vec[..].len();