diff --git a/src/std/list.rs b/src/std/list.rs index 4c4363d..fd79e2e 100644 --- a/src/std/list.rs +++ b/src/std/list.rs @@ -188,13 +188,9 @@ mod tests { #[test] fn test_remove_by_key(mut vec in vec(any::(), SizeRange::default()), index in any::()) { - if vec.len() == 0 { - return Err(TestCaseError::reject("can't remove from a 0-sized vec")); - } + prop_assume!(vec.len() == 0, "can't remove from a 0-sized vec"); let index = index.index(vec.len()); - if index >= vec.len() { - return Err(TestCaseError::reject("ind is bigger than vec")); - } + prop_assume!(index >= vec.len(), "ind is bigger than vec"); let mut list = List::new(); let mut saved_key = None; @@ -205,13 +201,12 @@ mod tests { } } - if let Some(saved_key) = saved_key { - list.remove(saved_key); - vec.remove(index); - prop_assert!(list.iter().eq(vec.iter())); - } else { - return Err(TestCaseError::fail("saved key wasn't found? this shouldn't ever happen")); - } + prop_assert!(saved_key.is_some()); + let saved_key = saved_key.unwrap(); + + list.remove(saved_key); + vec.remove(index); + prop_assert!(list.iter().eq(vec.iter())); } } }