summaryrefslogtreecommitdiffstats
path: root/imag-todo
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-07-15 21:24:49 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-21 17:14:13 +0200
commit8d89f7bf7443c6d515a8f8088e576ac1784fb3cc (patch)
tree1821af14ef8837df79668e5e05bb4571da9242b6 /imag-todo
parent0cca04c6ac31fcd358660a9efb72ded9f25b2f8e (diff)
Use if() instead of match here, to have less noise
Diffstat (limited to 'imag-todo')
-rw-r--r--imag-todo/src/main.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/imag-todo/src/main.rs b/imag-todo/src/main.rs
index 764e7bae..e7971080 100644
--- a/imag-todo/src/main.rs
+++ b/imag-todo/src/main.rs
@@ -19,6 +19,7 @@ use std::io::stdin;
use std::io::BufRead;
use task_hookrs::import::{import_task, import_tasks};
+use task_hookrs::status::TaskStatus;
use libimagrt::runtime::Runtime;
use libimagrt::setup::generate_runtime_setup;
@@ -62,7 +63,7 @@ fn tw_hook(rt: &Runtime) {
let stdin = stdin.lock();
match import_tasks(stdin) {
- Ok(ttasks) => for (counter, ttask) in ttasks.enumerate() {
+ Ok(ttasks) => for (counter, ttask) in ttasks.iter().enumerate() {
if counter % 2 == 1 {
// Only every second task is needed, the first one is the
// task before the change, and the second one after
@@ -76,19 +77,15 @@ fn tw_hook(rt: &Runtime) {
}
}
- match ttask.status() {
- &task_hookrs::status::TaskStatus::Deleted => {
- match Task::delete_by_uuid(rt.store(), *ttask.uuid()) {
- Ok(_) => println!("Deleted task {}", *ttask.uuid()),
- Err(e) => {
- trace_error(&e);
- exit(1);
- }
+ if *ttask.status() == TaskStatus::Deleted {
+ match Task::delete_by_uuid(rt.store(), *ttask.uuid()) {
+ Ok(_) => println!("Deleted task {}", *ttask.uuid()),
+ Err(e) => {
+ trace_error(&e);
+ exit(1);
}
}
- _ => {
- }
- } // end match ttask.status()
+ }
} // end if c % 2
},
Err(e) => {