Skip to content

new lint: map().count() on iterator #4010

@matthiaskrgr

Description

@matthiaskrgr
x.iter().map(|x| some_function(x)).count()

This looks suspicious, especially if some_function returns bool.
In this case, maybe the user wanted to use filter() instead of map()?
Otherwise the map might still be redundant (if some_function() does not have side effects...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-complexityLint: Belongs in the complexity lint group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions