diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-26 00:14:38 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-03-26 00:14:38 -0400 |
commit | 6f19f96053db7475e2376c9dd3179c4dd2264df8 (patch) | |
tree | a6c3d3f02f7026b7e98a3e007ff6a37e2a77fd97 /src/sys | |
parent | 93e6a9a08aec3cbb8b847a815ad905aa0d0bffca (diff) | |
download | fancy-prompt-6f19f96053db7475e2376c9dd3179c4dd2264df8.tar.gz fancy-prompt-6f19f96053db7475e2376c9dd3179c4dd2264df8.zip |
clippy
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/unix.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 2d52627..e014b4c 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -1,6 +1,3 @@ -use std; -use users; - use std::os::unix::fs::MetadataExt; use std::os::unix::fs::PermissionsExt; @@ -14,13 +11,11 @@ pub fn path_writable(path: &std::path::Path) -> super::PathWritability { let file_gid = stat.gid(); let file_mode = stat.permissions().mode(); - if euid == 0 { - super::PathWritability::Writable - } else if (file_uid == euid) && (file_mode & 0o200 != 0) { - super::PathWritability::Writable - } else if (file_gid == egid) && (file_mode & 0o020 != 0) { - super::PathWritability::Writable - } else if file_mode & 0o002 != 0 { + if euid == 0 + || ((file_uid == euid) && (file_mode & 0o200 != 0)) + || ((file_gid == egid) && (file_mode & 0o020 != 0)) + || (file_mode & 0o002 != 0) + { super::PathWritability::Writable } else { super::PathWritability::NotWritable |