summaryrefslogtreecommitdiff
path: root/src/cmd/show_gen.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/show_gen.rs')
-rw-r--r--src/cmd/show_gen.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cmd/show_gen.rs b/src/cmd/show_gen.rs
index ba39809..7dc52cf 100644
--- a/src/cmd/show_gen.rs
+++ b/src/cmd/show_gen.rs
@@ -23,14 +23,17 @@ impl ShowGeneration {
let gen = client.fetch_generation(&gen_id, temp.path())?;
let files = gen.files()?;
- let total_bytes = files.iter().fold(0, |acc, file| {
- let e = file.entry();
- if e.kind() == FilesystemKind::Regular {
- acc + file.entry().len()
- } else {
- acc
- }
+ let total_bytes = files.into_iter().try_fold(0, |acc, file| {
+ file.map(|file| {
+ let e = file.entry();
+ if e.kind() == FilesystemKind::Regular {
+ acc + e.len()
+ } else {
+ acc
+ }
+ })
});
+ let total_bytes = total_bytes?;
println!("generation-id: {}", gen_id);
println!("file-count: {}", gen.file_count()?);