mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
clippy: Allow some unnecessary casts
This commit is contained in:
parent
c94a039358
commit
ca0414d867
3 changed files with 9 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue