Skip to content

Commit afceb72

Browse files
committed
Fix clippy::unnecessary_map_or warning
``` warning: this `map_or` can be simplified --> 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: `-W clippy::unnecessary-map-or` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_map_or)]` help: use `is_some_and` instead | 18 - .map_or(false, |version| version.contains("nightly") || version.contains("dev")) 18 + .is_some_and(|version| version.contains("nightly") || version.contains("dev")) | warning: this `map_or` can be simplified --> pin-project-internal/src/pinned_drop.rs:143:28 | 143 | && get_ty_path(elem).map_or(false, |path| path.is_ident("Self")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `-W clippy::unnecessary-map-or` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_map_or)]` help: use `is_some_and` instead | 143 - && get_ty_path(elem).map_or(false, |path| path.is_ident("Self")) 143 + && get_ty_path(elem).is_some_and(|path| path.is_ident("Self")) | ```
1 parent e985eee commit afceb72

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pin-project-internal/src/pinned_drop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn validate_sig(sig: &Signature) -> Result<()> {
140140
// (mut) self: (<path>::)Pin<&mut Self>
141141
if args.args.len() == 1
142142
&& ty.ident == "Pin"
143-
&& get_ty_path(elem).map_or(false, |path| path.is_ident("Self"))
143+
&& get_ty_path(elem).is_some_and(|path| path.is_ident("Self"))
144144
{
145145
if sig.unsafety.is_some() {
146146
bail!(sig.unsafety, "implementing the method `drop` is not unsafe");

tests/no-core/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ fn is_nightly() -> bool {
1515
env::var_os("RUSTC")
1616
.and_then(|rustc| Command::new(rustc).arg("--version").output().ok())
1717
.and_then(|output| String::from_utf8(output.stdout).ok())
18-
.map_or(false, |version| version.contains("nightly") || version.contains("dev"))
18+
.is_some_and(|version| version.contains("nightly") || version.contains("dev"))
1919
}

0 commit comments

Comments
 (0)