diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 8f6de3ccd..fdf368e4b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -2702,13 +2702,7 @@ fn file_is_executable(md: &Metadata) -> bool { // S_IXUSR -> user has execute permission // S_IXGRP -> group has execute permission // S_IXOTH -> other users have execute permission - #[cfg(all( - not(target_os = "android"), - not(target_os = "freebsd"), - not(target_vendor = "apple") - ))] - return md.mode() & (S_IXUSR | S_IXGRP | S_IXOTH) != 0; - #[cfg(any(target_os = "android", target_os = "freebsd", target_vendor = "apple"))] + #[allow(clippy::unnecessary_cast)] return md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0; } diff --git a/src/uu/pinky/src/pinky.rs b/src/uu/pinky/src/pinky.rs index 0647e7d37..c4e68705e 100644 --- a/src/uu/pinky/src/pinky.rs +++ b/src/uu/pinky/src/pinky.rs @@ -277,17 +277,15 @@ impl Pinky { let mesg; let last_change; + match pts_path.metadata() { + #[allow(clippy::unnecessary_cast)] Ok(meta) => { - #[cfg(all( - not(target_os = "android"), - not(target_os = "freebsd"), - not(target_vendor = "apple") - ))] - let iwgrp = S_IWGRP; - #[cfg(any(target_os = "android", target_os = "freebsd", target_vendor = "apple"))] - let iwgrp = S_IWGRP as u32; - mesg = if meta.mode() & iwgrp != 0 { ' ' } else { '*' }; + mesg = if meta.mode() & S_IWGRP as u32 != 0 { + ' ' + } else { + '*' + }; last_change = meta.atime(); } _ => { diff --git a/src/uu/rm/src/rm.rs b/src/uu/rm/src/rm.rs index aeb6794f7..08d7f0ac5 100644 --- a/src/uu/rm/src/rm.rs +++ b/src/uu/rm/src/rm.rs @@ -520,13 +520,7 @@ fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata let mode = metadata.permissions().mode(); // Check if directory has user write permissions // Why is S_IWUSR showing up as a u16 on macos? - #[cfg(all( - not(target_os = "android"), - not(target_vendor = "apple"), - not(target_os = "freebsd") - ))] - let user_writable = (mode & libc::S_IWUSR) != 0; - #[cfg(any(target_os = "android", target_os = "freebsd", target_vendor = "apple"))] + #[allow(clippy::unnecessary_cast)] let user_writable = (mode & (libc::S_IWUSR as u32)) != 0; if !user_writable { prompt_yes!("remove write-protected directory {}?", path.quote())