Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy: unnecessary_map_or #5061

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brooksprumo
Copy link

Problem

New clippy lints when upgrading to rust 1.85.0.

warning: this `map_or` can be simplified
   --> install/src/command.rs:926:36
    |
926 |   ...                   && version_filter
    |  __________________________^
927 | | ...                       .as_ref()
928 | | ...                       .map_or(true, |version_filter| version_filter.matches(&version))
    | |__________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `#[warn(clippy::unnecessary_map_or)]` on by default
help: use is_none_or instead
    |
926 ~                                 && version_filter
927 +                                     .as_ref().is_none_or(|version_filter| version_filter.matches(&version))
    |

Summary of Changes

cargo clippy --fix

```
warning: this `map_or` can be simplified
   --> install/src/command.rs:926:36
    |
926 |   ...                   && version_filter
    |  __________________________^
927 | | ...                       .as_ref()
928 | | ...                       .map_or(true, |version_filter| version_filter.matches(&version))
    | |__________________________________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `#[warn(clippy::unnecessary_map_or)]` on by default
help: use is_none_or instead
    |
926 ~                                 && version_filter
927 +                                     .as_ref().is_none_or(|version_filter| version_filter.matches(&version))
    |
```
@brooksprumo brooksprumo self-assigned this Feb 24, 2025
@brooksprumo brooksprumo marked this pull request as ready for review February 24, 2025 19:43
@brooksprumo brooksprumo requested a review from yihau February 24, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants