summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen S <ogham@bsago.me>2015-08-25 15:27:24 +0100
committerBen S <ogham@bsago.me>2015-08-25 15:27:24 +0100
commit2741c19e933df1a4cd91ea2e482a560a1a35a0a4 (patch)
treee1ac9e50a655aea895bef07f21447cf014c9d572
parent2a9b6fe93080ba00cf99c05db41076e843c8aae7 (diff)
Fix bug where errors' tree parts ended early
Have to collect the results into a Vec in order to make sure we only do the ending part for the last one.
-rw-r--r--src/output/details.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/output/details.rs b/src/output/details.rs
index 6be3b68..8f35b8e 100644
--- a/src/output/details.rs
+++ b/src/output/details.rs
@@ -105,10 +105,12 @@ impl Details {
Some(Ok(ref dir)) => {
let mut files = Vec::new();
- for file_to_add in dir.files(true) {
+ let files_to_add = dir.files(true).collect::<Vec<_>>();
+ let child_count = files_to_add.len();
+ for (index, file_to_add) in files_to_add.into_iter().enumerate() {
match file_to_add {
Ok(f) => files.push(f),
- Err((path, e)) => table.add_error(&e, depth + 1, false, Some(&*path)),
+ Err((path, e)) => table.add_error(&e, depth + 1, index == child_count - 1 && files.is_empty(), Some(&*path)),
}
}