mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Merge pull request #55 from bootandy/ab-neaten
Ab fix clippy warnings, increment version number
This commit is contained in:
Generated
+1
-1
@@ -180,7 +180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "du-dust"
|
name = "du-dust"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "du-dust"
|
name = "du-dust"
|
||||||
description = "A more intuitive version of du"
|
description = "A more intuitive version of du"
|
||||||
version = "0.4.3"
|
version = "0.4.4"
|
||||||
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
|
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
+3
-8
@@ -76,7 +76,6 @@ pub fn get_dir_tree(
|
|||||||
threads: Option<usize>,
|
threads: Option<usize>,
|
||||||
) -> (bool, HashMap<String, u64>) {
|
) -> (bool, HashMap<String, u64>) {
|
||||||
let mut permissions = 0;
|
let mut permissions = 0;
|
||||||
let mut inodes: HashSet<(u64, u64)> = HashSet::new();
|
|
||||||
let mut data: HashMap<String, u64> = HashMap::new();
|
let mut data: HashMap<String, u64> = HashMap::new();
|
||||||
let restricted_filesystems = if limit_filesystem {
|
let restricted_filesystems = if limit_filesystem {
|
||||||
get_allowed_filesystems(top_level_names)
|
get_allowed_filesystems(top_level_names)
|
||||||
@@ -90,7 +89,6 @@ pub fn get_dir_tree(
|
|||||||
apparent_size,
|
apparent_size,
|
||||||
&restricted_filesystems,
|
&restricted_filesystems,
|
||||||
&ignore_directory,
|
&ignore_directory,
|
||||||
&mut inodes,
|
|
||||||
&mut data,
|
&mut data,
|
||||||
&mut permissions,
|
&mut permissions,
|
||||||
threads,
|
threads,
|
||||||
@@ -121,11 +119,11 @@ fn examine_dir(
|
|||||||
apparent_size: bool,
|
apparent_size: bool,
|
||||||
filesystems: &Option<HashSet<u64>>,
|
filesystems: &Option<HashSet<u64>>,
|
||||||
ignore_directory: &Option<&str>,
|
ignore_directory: &Option<&str>,
|
||||||
inodes: &mut HashSet<(u64, u64)>,
|
|
||||||
data: &mut HashMap<String, u64>,
|
data: &mut HashMap<String, u64>,
|
||||||
file_count_no_permission: &mut u64,
|
file_count_no_permission: &mut u64,
|
||||||
threads: Option<usize>,
|
threads: Option<usize>,
|
||||||
) {
|
) {
|
||||||
|
let mut inodes: HashSet<(u64, u64)> = HashSet::new();
|
||||||
let mut iter = WalkDir::new(top_dir)
|
let mut iter = WalkDir::new(top_dir)
|
||||||
.preload_metadata(true)
|
.preload_metadata(true)
|
||||||
.skip_hidden(false);
|
.skip_hidden(false);
|
||||||
@@ -135,18 +133,15 @@ fn examine_dir(
|
|||||||
for entry in iter {
|
for entry in iter {
|
||||||
if let Ok(e) = entry {
|
if let Ok(e) = entry {
|
||||||
let maybe_size_and_inode = get_metadata(&e, apparent_size);
|
let maybe_size_and_inode = get_metadata(&e, apparent_size);
|
||||||
match ignore_directory {
|
if let Some(d) = ignore_directory {
|
||||||
Some(d) => {
|
|
||||||
if e.path().to_string_lossy().contains(*d) {
|
if e.path().to_string_lossy().contains(*d) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
match maybe_size_and_inode {
|
match maybe_size_and_inode {
|
||||||
Some((size, maybe_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)
|
process_file_with_size_and_inode(top_dir, data, e, size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user