diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-15 20:31:46 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-15 20:31:46 +0800 |
commit | d2fda42dca410a9319f3f08b24545cbd8b8f1f59 (patch) | |
tree | fbf842c148009ae2e7a8cd07cde5f29440b8846d /src/aggregate.rs | |
parent | 4990fa4202f2b687ee2476efe0a406fdfe23fd96 (diff) |
Revert "Upgrade to jwalk 0.5; stop following symlinks during traversal"
This reverts commit 4990fa4202f2b687ee2476efe0a406fdfe23fd96.
Performance regression - it only uses a single thread for most of the
iteration.
Diffstat (limited to 'src/aggregate.rs')
-rw-r--r-- | src/aggregate.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs index b8d3f6b..0652a03 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -29,24 +29,26 @@ pub fn aggregate( stats.entries_traversed += 1; match entry { Ok(entry) => { - let file_size = match entry.metadata() { - Ok(ref m) if !m.is_dir() && (options.count_hard_links || inodes.add(m)) => { + let file_size = match entry.metadata { + Some(Ok(ref m)) if !m.is_dir() && (options.count_hard_links || inodes.add(m)) => { if options.apparent_size { m.len() } else { - filesize::file_real_size_fast(&entry.path(), m).unwrap_or_else( - |_| { + filesize::file_real_size_fast(&entry.path(), m) + .unwrap_or_else(|_| { num_errors += 1; 0 - }, - ) + }) } - } - Ok(_) => 0, - Err(_) => { + }, + Some(Ok(_)) => 0, + Some(Err(_)) => { num_errors += 1; 0 } + None => unreachable!( + "we ask for metadata, so we at least have Some(Err(..))). Issue in jwalk?" + ), }; stats.largest_file_in_bytes = stats.largest_file_in_bytes.max(file_size); stats.smallest_file_in_bytes = stats.smallest_file_in_bytes.min(file_size); |