From 4c95e403e9f326e08e3dd7416466b23b2a0627c6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 2 Jan 2016 16:09:44 +0100 Subject: [PATCH] Add information output to BM-remove --- src/module/bm/mod.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/module/bm/mod.rs b/src/module/bm/mod.rs index 8ce411ff..0c693f0f 100644 --- a/src/module/bm/mod.rs +++ b/src/module/bm/mod.rs @@ -143,15 +143,21 @@ impl<'a> BM<'a> { let f = file.deref().borrow(); self.rt.store().remove(f.id().clone()) }) - .all(|x| x); + .fold((0, 0), |acc, succeeded| { + let (worked, failed) = acc; + if succeeded { + (worked + 1, failed) + } else { + (worked, failed + 1) + } + }); - if result { - info!("Removing succeeded"); - } else { - info!("Removing failed"); - } + let (worked, failed) = result; - return result; + info!("Removing succeeded for {} files", worked); + info!("Removing failed for {} files", failed); + + return failed == 0; } /**