refactor: remove the warning of unused variable, fix #300

This commit is contained in:
sxyazi 2023-10-23 15:58:22 +08:00
parent 2df1dae5af
commit 52e0746f30
No known key found for this signature in database

View file

@ -92,13 +92,14 @@ pub fn copy_with_progress(from: &Path, to: &Path) -> mpsc::Receiver<Result<u64,
} }
// Convert a file mode to a string representation // Convert a file mode to a string representation
#[cfg(windows)]
#[allow(clippy::collapsible_else_if)]
pub fn permissions(_: Permissions) -> Option<String> { None }
// Convert a file mode to a string representation
#[cfg(unix)]
#[allow(clippy::collapsible_else_if)] #[allow(clippy::collapsible_else_if)]
pub fn permissions(permissions: Permissions) -> Option<String> { pub fn permissions(permissions: Permissions) -> Option<String> {
#[cfg(windows)]
return None;
#[cfg(unix)]
Some({
use std::os::unix::prelude::PermissionsExt; use std::os::unix::prelude::PermissionsExt;
use libc::{S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR}; use libc::{S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR};
@ -152,8 +153,7 @@ pub fn permissions(permissions: Permissions) -> Option<String> {
if m & S_ISVTX != 0 { 'T' } else { '-' } if m & S_ISVTX != 0 { 'T' } else { '-' }
}); });
s Some(s)
})
} }
// Find the max common root of a list of files // Find the max common root of a list of files