diff --git a/src/backup/catalog.rs b/src/backup/catalog.rs index b500fb93..b686fd5f 100644 --- a/src/backup/catalog.rs +++ b/src/backup/catalog.rs @@ -137,18 +137,12 @@ impl DirEntry { /// Check if DirEntry is a directory pub fn is_directory(&self) -> bool { - match self.attr { - DirEntryAttribute::Directory { .. } => true, - _ => false, - } + matches!(self.attr, DirEntryAttribute::Directory { .. }) } /// Check if DirEntry is a symlink pub fn is_symlink(&self) -> bool { - match self.attr { - DirEntryAttribute::Symlink { .. } => true, - _ => false, - } + matches!(self.attr, DirEntryAttribute::Symlink { .. }) } } diff --git a/src/backup/datastore.rs b/src/backup/datastore.rs index be764836..de129135 100644 --- a/src/backup/datastore.rs +++ b/src/backup/datastore.rs @@ -546,7 +546,7 @@ impl DataStore { } pub fn garbage_collection_running(&self) -> bool { - if let Ok(_) = self.gc_mutex.try_lock() { false } else { true } + !matches!(self.gc_mutex.try_lock(), Ok(_)) } pub fn garbage_collection(&self, worker: &dyn TaskState, upid: &UPID) -> Result<(), Error> { diff --git a/src/pxar/create.rs b/src/pxar/create.rs index cc28a79d..a21511c3 100644 --- a/src/pxar/create.rs +++ b/src/pxar/create.rs @@ -40,8 +40,7 @@ fn detect_fs_type(fd: RawFd) -> Result { pub fn is_virtual_file_system(magic: i64) -> bool { use proxmox::sys::linux::magic::*; - match magic { - BINFMTFS_MAGIC | + matches!(magic, BINFMTFS_MAGIC | CGROUP2_SUPER_MAGIC | CGROUP_SUPER_MAGIC | CONFIGFS_MAGIC | @@ -58,9 +57,7 @@ pub fn is_virtual_file_system(magic: i64) -> bool { SECURITYFS_MAGIC | SELINUX_MAGIC | SMACK_MAGIC | - SYSFS_MAGIC => true, - _ => false - } + SYSFS_MAGIC) } #[derive(Debug)] diff --git a/src/pxar/metadata.rs b/src/pxar/metadata.rs index ae72890c..12a89cbe 100644 --- a/src/pxar/metadata.rs +++ b/src/pxar/metadata.rs @@ -345,10 +345,7 @@ fn apply_quota_project_id(flags: Flags, fd: RawFd, metadata: &Metadata) -> Resul } pub(crate) fn errno_is_unsupported(errno: Errno) -> bool { - match errno { - Errno::ENOTTY | Errno::ENOSYS | Errno::EBADF | Errno::EOPNOTSUPP | Errno::EINVAL => true, - _ => false, - } + matches!(errno, Errno::ENOTTY | Errno::ENOSYS | Errno::EBADF | Errno::EOPNOTSUPP | Errno::EINVAL) } fn apply_chattr(fd: RawFd, chattr: libc::c_long, mask: libc::c_long) -> Result<(), Error> {