Display the summary in execution order

This commit is contained in:
Roey Darwish Dror
2018-06-11 08:32:45 +03:00
parent b54276863b
commit 00c0c0b0c1
2 changed files with 4 additions and 8 deletions

View File

@@ -221,9 +221,6 @@ fn main() -> Result<(), Error> {
} }
} }
let mut reports: Vec<_> = reports.into_iter().collect();
reports.sort();
if !reports.is_empty() { if !reports.is_empty() {
terminal.print_separator("Summary"); terminal.print_separator("Summary");

View File

@@ -1,7 +1,6 @@
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::HashMap;
pub type Report = HashMap<String, bool>; pub type Report = Vec<(String, bool)>;
pub trait Reporter { pub trait Reporter {
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report); fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report);
@@ -14,7 +13,7 @@ where
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) { fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) {
match self { match self {
Err(_) => { Err(_) => {
report.insert(key.into().into_owned(), false); report.push((key.into().into_owned(), false));
} }
Ok(item) => { Ok(item) => {
item.report(key, report); item.report(key, report);
@@ -36,12 +35,12 @@ where
impl Reporter for bool { impl Reporter for bool {
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) { fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) {
report.insert(key.into().into_owned(), *self); report.push((key.into().into_owned(), *self));
} }
} }
impl Reporter for () { impl Reporter for () {
fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) { fn report<'a, M: Into<Cow<'a, str>>>(&self, key: M, report: &mut Report) {
report.insert(key.into().into_owned(), true); report.push((key.into().into_owned(), true));
} }
} }