diff --git a/src/api/bookmark.rs b/src/api/bookmark.rs index 89c1d18..d13d2ed 100644 --- a/src/api/bookmark.rs +++ b/src/api/bookmark.rs @@ -376,7 +376,7 @@ mod test { before = _, limit = _ )), - results.len() == 0, + results.is_empty(), "Expected 0 bookmark, got {}", results.len() ); @@ -468,7 +468,7 @@ mod test { assert_eq!(response.status(), Status::Ok); assert_get_bookmark!( - results.len() == 0, + results.is_empty(), "Expected 0 bookmarks, got {}", results.len() ); diff --git a/src/api/folder.rs b/src/api/folder.rs index e72fa0e..784d503 100644 --- a/src/api/folder.rs +++ b/src/api/folder.rs @@ -215,7 +215,7 @@ pub(crate) mod test { let res = client.get(uri!(super::list_folders(cwd = _))).dispatch(); assert_eq!(res.status(), Status::Ok); let folders: Vec = res.into_json().unwrap(); - assert!(folders.len() > 0); + assert!(folders.is_empty()); assert!(folders.iter().any(|f| f.path == parent_path)); assert!(folders.iter().all(|f| f.path != path)); diff --git a/src/db/bookmark.rs b/src/db/bookmark.rs index 0668114..34adc29 100644 --- a/src/db/bookmark.rs +++ b/src/db/bookmark.rs @@ -139,7 +139,7 @@ pub(crate) mod test { .await .expect("Error loading bookmarks"); - assert!(results.len() > 0); + assert!(!results.is_empty()); info!("{:?}", results[0]); } diff --git a/src/db/tag.rs b/src/db/tag.rs index a713214..2215704 100644 --- a/src/db/tag.rs +++ b/src/db/tag.rs @@ -207,7 +207,7 @@ pub mod tests { assert_eq!(bookmark.id, new.id); assert!(tags.is_empty()); - let tag_names = vec![rand_str(4), rand_str(4)] + let tag_names = [rand_str(4), rand_str(4)] .iter() .sorted() .map(|i| i.to_string()) @@ -222,10 +222,7 @@ pub mod tests { assert_eq!(bookmark.id, new.id); assert_eq!(tags.len(), 2); assert_eq!( - tags.into_iter() - .map(|t| t.name.clone()) - .sorted() - .collect_vec(), + tags.iter().map(|t| t.name.clone()).sorted().collect_vec(), tag_names ); } diff --git a/src/utils/search.rs b/src/utils/search.rs index bafe0e9..348d9de 100644 --- a/src/utils/search.rs +++ b/src/utils/search.rs @@ -175,7 +175,7 @@ mod test { fn parse_query<'a>(raw: &'a str, out_arena: &'a Arena, err_arena: &'a Arena) -> Query<'a> { let source = Source::new(raw); - let rv = parse::(source, &out_arena, &err_arena); + let rv = parse::(source, out_arena, err_arena); debug!(?rv, ?source, "parsed"); assert!(rv.is_ok()); rv.unwrap() @@ -186,7 +186,7 @@ mod test { let out_arena = Arena::new(); let err_arena = Arena::new(); - for src in vec![ + for src in [ r#"/cs/pl/rust title #rust"#, r#"/cs/pl title #rust"#, r#"/cs title #rust"#, @@ -196,7 +196,7 @@ mod test { r#"title ( #rust | #langs )"#, r#"/blog/"#, ] { - let rv = parse_query(&src, &out_arena, &err_arena); + let rv = parse_query(src, &out_arena, &err_arena); info!(?rv, ?src, "parsed"); } }