Make code more functional by more function chaining.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
d8a6e9ca9a
commit
07cbecc1ba
1 changed files with 32 additions and 34 deletions
|
@ -140,8 +140,7 @@ fn show(rt: &Runtime) {
|
|||
}
|
||||
};
|
||||
|
||||
for iter in iters {
|
||||
let _ = iter
|
||||
Itertools::flatten(iters.into_iter())
|
||||
.into_get_iter(rt.store())
|
||||
.trace_unwrap_exit(1)
|
||||
.filter_map(|opt| {
|
||||
|
@ -153,10 +152,10 @@ fn show(rt: &Runtime) {
|
|||
})
|
||||
.filter(|e| e.is_log().map_err_trace_exit_unwrap(1))
|
||||
.map(|entry| (entry.diary_id().map_err_trace_exit_unwrap(1), entry))
|
||||
.sorted_by_key(|&(ref id, _)| id.clone())
|
||||
.sorted_by_key(|tpl| tpl.0.clone())
|
||||
.into_iter()
|
||||
.map(|tpl| { debug!("Found entry: {:?}", tpl.1); tpl })
|
||||
.map(|(id, entry)| {
|
||||
debug!("Found entry: {:?}", entry);
|
||||
let _ = writeln!(rt.stdout(),
|
||||
"{dname: >10} - {y: >4}-{m:0>2}-{d:0>2}T{H:0>2}:{M:0>2} - {text}",
|
||||
dname = id.diary_name(),
|
||||
|
@ -175,7 +174,6 @@ fn show(rt: &Runtime) {
|
|||
})
|
||||
.collect::<Result<Vec<()>, ExitCode>>()
|
||||
.unwrap_or_exit();
|
||||
}
|
||||
}
|
||||
|
||||
fn get_diary_name(rt: &Runtime) -> String {
|
||||
|
|
Loading…
Reference in a new issue