Use len() instead of iter().count() #6262
Labels
A-lint
Area: New lints
good-first-issue
These issues are a good way to get started with Clippy
L-style
Lint: Belongs in the style lint group
T-middle
Type: Probably requires verifiying types
What it does
Suggests using
collection.len()
instead ofcollection.iter().count()
.Categories (optional)
What is the advantage of the recommended code over the original code
Simpler, idiomatic.
Drawbacks
None.
Example
Could be written as:
Notes
into_iter
ExactSizeIterator::len
The text was updated successfully, but these errors were encountered: