Skip to content

Commit cff4757

Browse files
committed
Resolve unnecessary_map_or clippy lints
warning: this `map_or` is redundant --> gen/build/src/target.rs:31:20 | 31 | && dir | ____________________^ 32 | | .parent() 33 | | .map_or(false, |parent| parent.join("Cargo.toml").exists()) | |_______________________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or help: use is_some_and instead | 31 ~ && dir 32 + .parent().is_some_and(|parent| parent.join("Cargo.toml").exists()) | warning: this `map_or` is redundant --> gen/src/write.rs:1151:5 | 1151 | / sig.ret 1152 | | .as_ref() 1153 | | .map_or(false, |ret| sig.throws || types.needs_indirect_abi(ret)) | |_________________________________________________________________________^ | = 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 | 1151 ~ sig.ret 1152 + .as_ref().is_some_and(|ret| sig.throws || types.needs_indirect_abi(ret)) | warning: this `map_or` is redundant --> macro/src/expand.rs:1837:5 | 1837 | / sig.ret 1838 | | .as_ref() 1839 | | .map_or(false, |ret| sig.throws || types.needs_indirect_abi(ret)) | |_________________________________________________________________________^ | = 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 | 1837 ~ sig.ret 1838 + .as_ref().is_some_and(|ret| sig.throws || types.needs_indirect_abi(ret)) |
1 parent d077e42 commit cff4757

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

gen/build/src/target.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) fn find_target_dir(out_dir: &Path) -> TargetDir {
3030
|| dir.file_name() == Some(OsStr::new("target"))
3131
&& dir
3232
.parent()
33-
.map_or(false, |parent| parent.join("Cargo.toml").exists())
33+
.is_some_and(|parent| parent.join("Cargo.toml").exists())
3434
{
3535
return TargetDir::Path(dir);
3636
}

gen/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ fn write_return_type(out: &mut OutFile, ty: &Option<Type>) {
11501150
fn indirect_return(sig: &Signature, types: &Types) -> bool {
11511151
sig.ret
11521152
.as_ref()
1153-
.map_or(false, |ret| sig.throws || types.needs_indirect_abi(ret))
1153+
.is_some_and(|ret| sig.throws || types.needs_indirect_abi(ret))
11541154
}
11551155

11561156
fn write_indirect_return_type(out: &mut OutFile, ty: &Type) {

macro/src/expand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ fn expand_return_type(ret: &Option<Type>) -> TokenStream {
18361836
fn indirect_return(sig: &Signature, types: &Types) -> bool {
18371837
sig.ret
18381838
.as_ref()
1839-
.map_or(false, |ret| sig.throws || types.needs_indirect_abi(ret))
1839+
.is_some_and(|ret| sig.throws || types.needs_indirect_abi(ret))
18401840
}
18411841

18421842
fn expand_extern_type(ty: &Type, types: &Types, proper: bool) -> TokenStream {

0 commit comments

Comments
 (0)