Skip to content

Commit

Permalink
Fix trivials
Browse files Browse the repository at this point in the history
  • Loading branch information
linw1995 committed Sep 13, 2024
1 parent cfb6bdb commit 594b5b5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/api/bookmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ mod test {
before = _,
limit = _
)),
results.len() == 0,
results.is_empty(),
"Expected 0 bookmark, got {}",
results.len()
);
Expand Down Expand Up @@ -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()
);
Expand Down
2 changes: 1 addition & 1 deletion src/api/folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Folder> = 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));

Expand Down
2 changes: 1 addition & 1 deletion src/db/bookmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub(crate) mod test {
.await
.expect("Error loading bookmarks");

assert!(results.len() > 0);
assert!(!results.is_empty());
info!("{:?}", results[0]);
}

Expand Down
7 changes: 2 additions & 5 deletions src/db/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Query>(source, &out_arena, &err_arena);
let rv = parse::<Query>(source, out_arena, err_arena);
debug!(?rv, ?source, "parsed");
assert!(rv.is_ok());
rv.unwrap()
Expand All @@ -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"#,
Expand All @@ -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");
}
}
Expand Down

0 comments on commit 594b5b5

Please sign in to comment.