mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +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_IXUSR -> user has execute permission
|
||||||
// S_IXGRP -> group has execute permission
|
// S_IXGRP -> group has execute permission
|
||||||
// S_IXOTH -> other users have execute permission
|
// S_IXOTH -> other users have execute permission
|
||||||
#[cfg(all(
|
#[allow(clippy::unnecessary_cast)]
|
||||||
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"))]
|
|
||||||
return md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0;
|
return md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,17 +277,15 @@ impl Pinky {
|
||||||
|
|
||||||
let mesg;
|
let mesg;
|
||||||
let last_change;
|
let last_change;
|
||||||
|
|
||||||
match pts_path.metadata() {
|
match pts_path.metadata() {
|
||||||
|
#[allow(clippy::unnecessary_cast)]
|
||||||
Ok(meta) => {
|
Ok(meta) => {
|
||||||
#[cfg(all(
|
mesg = if meta.mode() & S_IWGRP as u32 != 0 {
|
||||||
not(target_os = "android"),
|
' '
|
||||||
not(target_os = "freebsd"),
|
} else {
|
||||||
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 { '*' };
|
|
||||||
last_change = meta.atime();
|
last_change = meta.atime();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -520,13 +520,7 @@ fn handle_writable_directory(path: &Path, options: &Options, metadata: &Metadata
|
||||||
let mode = metadata.permissions().mode();
|
let mode = metadata.permissions().mode();
|
||||||
// Check if directory has user write permissions
|
// Check if directory has user write permissions
|
||||||
// Why is S_IWUSR showing up as a u16 on macos?
|
// Why is S_IWUSR showing up as a u16 on macos?
|
||||||
#[cfg(all(
|
#[allow(clippy::unnecessary_cast)]
|
||||||
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"))]
|
|
||||||
let user_writable = (mode & (libc::S_IWUSR as u32)) != 0;
|
let user_writable = (mode & (libc::S_IWUSR as u32)) != 0;
|
||||||
if !user_writable {
|
if !user_writable {
|
||||||
prompt_yes!("remove write-protected directory {}?", path.quote())
|
prompt_yes!("remove write-protected directory {}?", path.quote())
|
||||||
|
|
Loading…
Reference in a new issue