diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-07-15 21:21:36 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-07-21 17:14:12 +0200 |
commit | 0cca04c6ac31fcd358660a9efb72ded9f25b2f8e (patch) | |
tree | b665cb4d4c4798b02c1cc45875e19e54b0a74507 /imag-todo | |
parent | ca7a9012697d5820892d732c14ac7c01cbd75f62 (diff) |
Use Iterator::enumerate() instead of mut variable
Diffstat (limited to 'imag-todo')
-rw-r--r-- | imag-todo/src/main.rs | 4 |
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); |