mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Refactor: use if let instead of is_some
This commit is contained in:
+8
-8
@@ -173,16 +173,12 @@ fn should_ignore_file(
|
|||||||
inodes: &mut HashSet<(u64, u64)>,
|
inodes: &mut HashSet<(u64, u64)>,
|
||||||
maybe_inode: Option<(u64, u64)>,
|
maybe_inode: Option<(u64, u64)>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
|
||||||
if let Some(inode_dev_pair) = maybe_inode {
|
if let Some(inode_dev_pair) = maybe_inode {
|
||||||
// Ignore files on different devices (if flag applied)
|
// Ignore files on different devices (if flag applied)
|
||||||
if restricted_filesystems.is_some()
|
if let Some(rs) = restricted_filesystems {
|
||||||
&& !restricted_filesystems
|
if !rs.contains(&inode_dev_pair.1) {
|
||||||
.as_ref()
|
return true;
|
||||||
.unwrap()
|
}
|
||||||
.contains(&inode_dev_pair.1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !apparent_size {
|
if !apparent_size {
|
||||||
@@ -382,5 +378,9 @@ mod tests {
|
|||||||
let new_file = (11, 12);
|
let new_file = (11, 12);
|
||||||
assert!(should_ignore_file(false, &od, &mut files, Some(new_file)));
|
assert!(should_ignore_file(false, &od, &mut files, Some(new_file)));
|
||||||
assert!(should_ignore_file(true, &od, &mut files, Some(new_file)));
|
assert!(should_ignore_file(true, &od, &mut files, Some(new_file)));
|
||||||
|
|
||||||
|
// We do not ignore files on the same device
|
||||||
|
assert!(!should_ignore_file(false, &od, &mut files, Some((2, 99))));
|
||||||
|
assert!(!should_ignore_file(true, &od, &mut files, Some((2, 99))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user