Suggest Iterator::count instead of collecting + len #7110
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
What it does
Suggests the use of
Iterator::count
instead of collecting into a collection and then calling itslen
function.Categories (optional)
clippy::complexity
What is the advantage of the recommended code over the original code
Drawbacks
None.
Example
Could be written as:
playground
The text was updated successfully, but these errors were encountered: