summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-11-07 12:48:34 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-11-07 12:48:35 +0100
commitd8a6e9ca9ae9ce92105b63c57d3a67088fc4cf7e (patch)
tree0255d7233d3db6075d19e74fa9ec769321a25fdb
parent8e1768b4247629ae54e5b280c5e5a2d76211f211 (diff)
Rewrite iteration without collecting inbetween
Because why not? Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/domain/imag-contact/src/main.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/bin/domain/imag-contact/src/main.rs b/bin/domain/imag-contact/src/main.rs
index dc86208..68f47a4 100644
--- a/bin/domain/imag-contact/src/main.rs
+++ b/bin/domain/imag-contact/src/main.rs
@@ -142,19 +142,15 @@ fn list(rt: &Runtime) {
}
}
} else {
- let rendered = iterator
+ let output = rt.stdout();
+ let mut output = output.lock();
+ iterator
.map(|(i, dvcard)| build_data_object_for_handlebars(i, &dvcard))
.map(|data| list_format.render("format", &data).map_err(Error::from))
.trace_unwrap_exit(1)
- .collect::<Vec<String>>();
- // collect, so that we can have rendered all the things and printing is faster.
-
- let output = rt.stdout();
- let mut output = output.lock();
-
- rendered.into_iter().for_each(|s| {
- writeln!(output, "{}", s).to_exit_code().unwrap_or_exit()
- });
+ .for_each(|s| {
+ writeln!(output, "{}", s).to_exit_code().unwrap_or_exit()
+ });
}
}