From cbe11a1d3d130f468b090552f710b5bb17f42a8a Mon Sep 17 00:00:00 2001 From: "Dustin J. Mitchell" Date: Sun, 16 May 2021 09:38:40 -0400 Subject: [PATCH] fix new clippy warnings --- taskchampion/src/taskdb.rs | 6 ++---- taskchampion/src/workingset.rs | 8 +------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/taskchampion/src/taskdb.rs b/taskchampion/src/taskdb.rs index f4850f487..06c1ff6d9 100644 --- a/taskchampion/src/taskdb.rs +++ b/taskchampion/src/taskdb.rs @@ -144,10 +144,8 @@ impl TaskDb { // if renumbering, clear the working set and re-add if renumber { txn.clear_working_set()?; - for elt in new_ws.drain(0..new_ws.len()) { - if let Some(uuid) = elt { - txn.add_to_working_set(uuid)?; - } + for uuid in new_ws.drain(0..new_ws.len()).flatten() { + txn.add_to_working_set(uuid)?; } } else { // ..otherwise, just clear the None items determined above from the working set diff --git a/taskchampion/src/workingset.rs b/taskchampion/src/workingset.rs index 5bdc3696b..586a16cf4 100644 --- a/taskchampion/src/workingset.rs +++ b/taskchampion/src/workingset.rs @@ -58,13 +58,7 @@ impl WorkingSet { self.by_index .iter() .enumerate() - .filter_map(|(index, uuid)| { - if let Some(uuid) = uuid { - Some((index, *uuid)) - } else { - None - } - }) + .filter_map(|(index, uuid)| uuid.as_ref().map(|uuid| (index, *uuid))) } }