diff --git a/Cargo.lock b/Cargo.lock index c736480..8683faf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "du-dust" -version = "0.4.3" +version = "0.4.4" dependencies = [ "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 100a5c1..14f786c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "du-dust" description = "A more intuitive version of du" -version = "0.4.3" +version = "0.4.4" authors = ["bootandy ", "nebkor "] edition = "2018" diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 105ef32..5344d99 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -76,7 +76,6 @@ pub fn get_dir_tree( threads: Option, ) -> (bool, HashMap) { let mut permissions = 0; - let mut inodes: HashSet<(u64, u64)> = HashSet::new(); let mut data: HashMap = HashMap::new(); let restricted_filesystems = if limit_filesystem { get_allowed_filesystems(top_level_names) @@ -90,7 +89,6 @@ pub fn get_dir_tree( apparent_size, &restricted_filesystems, &ignore_directory, - &mut inodes, &mut data, &mut permissions, threads, @@ -121,11 +119,11 @@ fn examine_dir( apparent_size: bool, filesystems: &Option>, ignore_directory: &Option<&str>, - inodes: &mut HashSet<(u64, u64)>, data: &mut HashMap, file_count_no_permission: &mut u64, threads: Option, ) { + let mut inodes: HashSet<(u64, u64)> = HashSet::new(); let mut iter = WalkDir::new(top_dir) .preload_metadata(true) .skip_hidden(false); @@ -135,18 +133,15 @@ fn examine_dir( for entry in iter { if let Ok(e) = entry { let maybe_size_and_inode = get_metadata(&e, apparent_size); - match ignore_directory { - Some(d) => { - if e.path().to_string_lossy().contains(*d) { - continue; - } + if let Some(d) = ignore_directory { + if e.path().to_string_lossy().contains(*d) { + continue; } - _ => {} } match maybe_size_and_inode { Some((size, maybe_inode)) => { - if !should_ignore_file(apparent_size, filesystems, inodes, maybe_inode) { + if !should_ignore_file(apparent_size, filesystems, &mut inodes, maybe_inode) { process_file_with_size_and_inode(top_dir, data, e, size) } }