clippy: use matches!

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 11:08:10 +01:00
parent 6334bdc1c5
commit a6bd669854
4 changed files with 6 additions and 18 deletions

View File

@ -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 { .. })
}
}

View File

@ -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> {