rust-lang / rust-lang/rust-clippy
New lint for all/any after mapping to bool.
Open
@tamaroning is already working on this.
Since Feb 2, 2022.
A-lint
E-medium
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.