Skip to content

Commit 0f3f8ae

Browse files
committed
1 parent 5b54e08 commit 0f3f8ae

5 files changed

Lines changed: 6 additions & 15 deletions

File tree

src/uu/cat/src/platform/windows.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ pub fn is_unsafe_overwrite<I: AsHandleRef, O: AsHandleRef>(input: &I, output: &O
2020
}
2121

2222
// Check if the output file is empty
23-
FileInformation::from_file(output)
24-
.map(|info| info.file_size() > 0)
25-
.unwrap_or(false)
23+
FileInformation::from_file(output).is_ok_and(|info| info.file_size() > 0)
2624
}
2725

2826
/// Get the file path for a file handle

src/uucore/build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,7 @@ fn embed_locale_file(
350350
/// Check if we are cross-compiling for WASI (build.rs runs on the host,
351351
/// so `#[cfg(target_os = "wasi")]` does not work here).
352352
fn is_wasi_target() -> bool {
353-
env::var("CARGO_CFG_TARGET_OS")
354-
.map(|os| os == "wasi")
355-
.unwrap_or(false)
353+
env::var("CARGO_CFG_TARGET_OS").is_ok_and(|os| os == "wasi")
356354
}
357355

358356
/// For WASI/WASM builds, embed ALL available .ftl files in a locale

src/uucore/src/lib/features/pipes.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ pub fn splice_exact(source: &impl AsFd, target: &impl AsFd, len: usize) -> std::
6767
#[inline]
6868
#[cfg(any(target_os = "linux", target_os = "android"))]
6969
pub fn might_fuse(source: &impl AsFd) -> bool {
70-
rustix::fs::fstatfs(source)
71-
.map(|stats| stats.f_type == 0x6573_5546) // FUSE magic number, too many platform specific clippy warning with const
72-
.unwrap_or(true)
70+
rustix::fs::fstatfs(source).map_or(true, |stats| stats.f_type == 0x6573_5546) // FUSE magic number, too many platform specific clippy warning with const
7371
}
7472

7573
/// Return verified /dev/null

tests/by-util/test_df.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,7 @@ fn test_nonexistent_file() {
10541054
fn test_df_all_shows_binfmt_misc() {
10551055
// Check if binfmt_misc is mounted
10561056
let is_mounted = std::fs::read_to_string("/proc/self/mountinfo")
1057-
.map(|content| content.lines().any(|line| line.contains("binfmt_misc")))
1058-
.unwrap_or(false);
1057+
.is_ok_and(|content| content.lines().any(|line| line.contains("binfmt_misc")));
10591058

10601059
if is_mounted {
10611060
let output = new_ucmd!()
@@ -1076,8 +1075,7 @@ fn test_df_all_shows_binfmt_misc() {
10761075
fn test_df_hides_binfmt_misc_by_default() {
10771076
// Check if binfmt_misc is mounted
10781077
let is_mounted = std::fs::read_to_string("/proc/self/mountinfo")
1079-
.map(|content| content.lines().any(|line| line.contains("binfmt_misc")))
1080-
.unwrap_or(false);
1078+
.is_ok_and(|content| content.lines().any(|line| line.contains("binfmt_misc")));
10811079

10821080
if is_mounted {
10831081
let output = new_ucmd!()

tests/uutests/src/lib/util.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ pub fn is_locale_available(locale: &str) -> bool {
109109
.env("LC_ALL", locale)
110110
.arg("charmap")
111111
.output()
112-
.map(|o| String::from_utf8_lossy(&o.stdout).trim() == "UTF-8")
113-
.unwrap_or(false)
112+
.is_ok_and(|o| String::from_utf8_lossy(&o.stdout).trim() == "UTF-8")
114113
}
115114

116115
/// Read a test scenario fixture, returning its bytes

0 commit comments

Comments
 (0)