Skip to content

Commit

Permalink
Fix clippy::unnecessary_map_or warning
Browse files Browse the repository at this point in the history
```
error: this `map_or` is redundant
   --> src/cli.rs:509:16
    |
509 |             if optional_deps.as_ref().map_or(false, |d| d.contains(f)) {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `optional_deps.as_ref().is_some_and(|d| d.contains(f))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
```
  • Loading branch information
taiki-e committed Nov 17, 2024
1 parent 40e8691 commit 8f15cdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl Args {
if features.contains(f) {
bail!("feature `{f}` specified by both --exclude-features and --features");
}
if optional_deps.as_ref().map_or(false, |d| d.contains(f)) {
if optional_deps.as_ref().is_some_and(|d| d.contains(f)) {
bail!("feature `{f}` specified by both --exclude-features and --optional-deps");
}
if group_features.iter().any(|v| v.matches(f)) {
Expand Down

0 comments on commit 8f15cdb

Please sign in to comment.