diff --git a/taskchampion/lib/src/string.rs b/taskchampion/lib/src/string.rs index 36db8a4ac..44e00dcc8 100644 --- a/taskchampion/lib/src/string.rs +++ b/taskchampion/lib/src/string.rs @@ -317,7 +317,7 @@ impl<'a> From for RustString<'a> { } } -impl<'a> From<&str> for RustString<'static> { +impl From<&str> for RustString<'static> { fn from(string: &str) -> RustString<'static> { RustString::String(string.to_string()) } diff --git a/taskchampion/lib/src/traits.rs b/taskchampion/lib/src/traits.rs index ee698b777..c9040071d 100644 --- a/taskchampion/lib/src/traits.rs +++ b/taskchampion/lib/src/traits.rs @@ -276,13 +276,11 @@ where let mut vec = unsafe { CL::take_val_from_arg(list, CL::null_value()) }; // first, drop each of the elements in turn - for e in vec.drain(..) { - if let Some(e) = e { - // SAFETY: - // - e is a valid Element (promised by caller) - // - e is owned - drop(unsafe { PassByPointer::take_from_ptr_arg(e.as_ptr()) }); - } + for e in vec.drain(..).flatten() { + // SAFETY: + // - e is a valid Element (promised by caller) + // - e is owned + drop(unsafe { PassByPointer::take_from_ptr_arg(e.as_ptr()) }); } // then drop the vector drop(vec); diff --git a/taskchampion/taskchampion/src/server/crypto.rs b/taskchampion/taskchampion/src/server/crypto.rs index 9a34f6575..bf9367a51 100644 --- a/taskchampion/taskchampion/src/server/crypto.rs +++ b/taskchampion/taskchampion/src/server/crypto.rs @@ -271,7 +271,7 @@ mod test { let unsealed = Unsealed { version_id, - payload: payload, + payload, }; let sealed = cryptor.seal(unsealed).unwrap(); @@ -291,7 +291,7 @@ mod test { let unsealed = Unsealed { version_id, - payload: payload, + payload, }; let mut sealed = cryptor.seal(unsealed).unwrap(); sealed.version_id = Uuid::new_v4(); // change the version_id @@ -309,7 +309,7 @@ mod test { let unsealed = Unsealed { version_id, - payload: payload, + payload, }; let sealed = cryptor.seal(unsealed).unwrap(); diff --git a/taskchampion/taskchampion/src/taskdb/mod.rs b/taskchampion/taskchampion/src/taskdb/mod.rs index ee1fcc0ad..3eb4ac291 100644 --- a/taskchampion/taskchampion/src/taskdb/mod.rs +++ b/taskchampion/taskchampion/src/taskdb/mod.rs @@ -173,10 +173,7 @@ impl TaskDb { #[cfg(test)] pub(crate) fn operations(&mut self) -> Vec { let mut txn = self.storage.txn().unwrap(); - txn.operations() - .unwrap() - .iter().cloned() - .collect() + txn.operations().unwrap().to_vec() } } diff --git a/taskchampion/taskchampion/src/taskdb/working_set.rs b/taskchampion/taskchampion/src/taskdb/working_set.rs index d6ae3c9fd..88d2dbbb6 100644 --- a/taskchampion/taskchampion/src/taskdb/working_set.rs +++ b/taskchampion/taskchampion/src/taskdb/working_set.rs @@ -119,12 +119,7 @@ mod test { assert_eq!( db.working_set()?, - vec![ - None, - Some(uuids[1]), - Some(uuids[3]), - Some(uuids[4]) - ] + vec![None, Some(uuids[1]), Some(uuids[3]), Some(uuids[4])] ); rebuild( @@ -142,22 +137,11 @@ mod test { let exp = if renumber { // uuids[1] and uuids[4] are already in the working set, so are compressed // to the top, and then uuids[0] is added. - vec![ - None, - Some(uuids[1]), - Some(uuids[4]), - Some(uuids[0]), - ] + vec![None, Some(uuids[1]), Some(uuids[4]), Some(uuids[0])] } else { // uuids[1] and uuids[4] are already in the working set, at indexes 1 and 3, // and then uuids[0] is added. - vec![ - None, - Some(uuids[1]), - None, - Some(uuids[4]), - Some(uuids[0]), - ] + vec![None, Some(uuids[1]), None, Some(uuids[4]), Some(uuids[0])] }; assert_eq!(db.working_set()?, exp);