Skip to content

Commit

Permalink
Ignore clippy::unnecessary_map_or lint
Browse files Browse the repository at this point in the history
```
error: this `map_or` is redundant
  --> tests/no-core/build.rs:15:5
   |
15 | /     env::var_os("RUSTC")
16 | |         .and_then(|rustc| Command::new(rustc).arg("--version").output().ok())
17 | |         .and_then(|output| String::from_utf8(output.stdout).ok())
18 | |         .map_or(false, |version| version.contains("nightly") || version.contains("dev"))
   | |________________________________________________________________________________________^
   |
   = 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)]`
help: use is_some_and instead
   |
15 ~     env::var_os("RUSTC")
16 +         .and_then(|rustc| Command::new(rustc).arg("--version").output().ok())
17 +         .and_then(|output| String::from_utf8(output.stdout).ok()).is_some_and(|version| version.contains("nightly") || version.contains("dev"))
   |
```
  • Loading branch information
taiki-e committed Nov 17, 2024
1 parent fde6a7f commit 327ba29
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/no-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "no-core"
version = "0.0.0"
edition = "2018"
rust-version = "1.37" # Prevent clippy from suggesting a code that requires a new version.
publish = false

[lib]
Expand Down

0 comments on commit 327ba29

Please sign in to comment.