Skip to content

New lint for all/any after mapping to bool. #7339

@duongdominhchau

Description

@duongdominhchau

What it does

Eliminate map to bool if it is before a call to all/any

Categories (optional)

What is the advantage of the recommended code over the original code

Shorter code.

Drawbacks

If the map operation has side-effect, applying the suggestion will change the meaning of the program.

Example

iter
    .map(|value| value > 0)
    .all(|x| x)

Could be written as:

iter.all(|value| value > 0)

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions