Rewrite iteration without collecting inbetween
Because why not? Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
8e1768b424
commit
d8a6e9ca9a
1 changed files with 6 additions and 10 deletions
|
@ -142,17 +142,13 @@ 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| {
|
||||
.for_each(|s| {
|
||||
writeln!(output, "{}", s).to_exit_code().unwrap_or_exit()
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue