summaryrefslogtreecommitdiffstats
path: root/imag-todo
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-07-15 21:21:36 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-21 17:14:12 +0200
commit0cca04c6ac31fcd358660a9efb72ded9f25b2f8e (patch)
treeb665cb4d4c4798b02c1cc45875e19e54b0a74507 /imag-todo
parentca7a9012697d5820892d732c14ac7c01cbd75f62 (diff)
Use Iterator::enumerate() instead of mut variable
Diffstat (limited to 'imag-todo')
-rw-r--r--imag-todo/src/main.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/imag-todo/src/main.rs b/imag-todo/src/main.rs
index 9771442e..764e7bae 100644
--- a/imag-todo/src/main.rs
+++ b/imag-todo/src/main.rs
@@ -58,12 +58,11 @@ fn tw_hook(rt: &Runtime) {
} else if subcmd.is_present("delete") {
// The used hook is "on-modify". This hook gives two json-objects
// per usage und wants one (the second one) back.
- let mut counter = 0;
let stdin = stdin();
let stdin = stdin.lock();
match import_tasks(stdin) {
- Ok(ttasks) => for ttask in ttasks {
+ Ok(ttasks) => for (counter, ttask) in ttasks.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
@@ -91,7 +90,6 @@ fn tw_hook(rt: &Runtime) {
}
} // end match ttask.status()
} // end if c % 2
- counter += 1;
},
Err(e) => {
trace_error(&e);