test: satisfy clippy assert_is_empty
ci / web (push) Successful in 22s
e2e / e2e (push) Failing after 54s
ci / rust (push) Successful in 1m58s
ci / image (push) Successful in 3m46s

Stable 1.99 added the lint and CI denies warnings, which failed the
build and skipped the deploy. Each flagged assert now uses the
assert_eq! form clippy suggests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-10-24 20:17:20 +01:00
co-authored by Claude Opus 5.5
parent 1b6dae676a
commit ee7f05bf22
16 changed files with 142 additions and 55 deletions
+1 -1
View File
@@ -319,7 +319,7 @@ mod tests {
.json()
.await
.expect("alice json");
assert!(alice_view.is_empty());
assert_eq!(alice_view, [] as [serde_json::Value; 0]);
let bob_view: Vec<serde_json::Value> =
reqwest::get(format!("{base}/api/movies?owner_id={bob_id}"))
+1 -1
View File
@@ -946,7 +946,7 @@ mod tests {
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(stored_path(&base, 1).await, new.to_str().expect("utf-8"));
assert!(!new.exists(), "nothing was created on disk");
assert!(file_paths(&state).await.is_empty());
assert_eq!(file_paths(&state).await, [] as [std::string::String; 0]);
}
/// Issue #236: a destination already holding a folder of that name is a
+4 -1
View File
@@ -1224,7 +1224,10 @@ mod tests {
let body: serde_json::Value = response.json().await.expect("json");
assert_eq!(body["library"][0]["kind"], "movie");
assert_eq!(body["library"][0]["title"], "Dune");
assert!(body["tmdb"].as_array().expect("tmdb").is_empty());
assert_eq!(
body["tmdb"].as_array().expect("tmdb").as_slice(),
[] as [serde_json::Value; 0]
);
assert_eq!(body["tmdb_status"], "unavailable");
drop(dir);
}
+2 -2
View File
@@ -3517,7 +3517,7 @@ mod tests {
.json()
.await
.expect("json");
assert!(empty.is_empty());
assert_eq!(empty, [] as [serde_json::Value; 0]);
let tagged = reqwest::Client::new()
.put(format!("{base}/api/series/{series_id}/owners/{owner_id}"))
@@ -3557,7 +3557,7 @@ mod tests {
.json()
.await
.expect("json");
assert!(owners.is_empty());
assert_eq!(owners, [] as [serde_json::Value; 0]);
}
#[tokio::test]
+60 -24
View File
@@ -2225,10 +2225,13 @@ mod tests {
// No grab record backs this file, so nothing can claim its release
// name — the chip reads "no", never "unknown".
assert_eq!(candidates[0]["release_match"], false);
assert!(body["provider_errors"]
.as_array()
.expect("errors")
.is_empty());
assert_eq!(
body["provider_errors"]
.as_array()
.expect("errors")
.as_slice(),
[] as [serde_json::Value; 0]
);
}
/// One provider failing is not the search failing: §15 configures two.
@@ -2574,7 +2577,10 @@ mod tests {
let (status, body) = grab(&fixture, pt()).await;
assert_eq!(status, StatusCode::SERVICE_UNAVAILABLE, "{body}");
assert!(fixture.subtitle_rows().await.is_empty());
assert_eq!(
fixture.subtitle_rows().await,
[] as [arr_db::SubtitleFile; 0]
);
assert!(!fixture
.folder
.join("Dune (2021) [tmdbid-438631] - [2160p][WEB-DL].pt-PT.srt")
@@ -2600,7 +2606,10 @@ mod tests {
assert_eq!(status, StatusCode::NOT_FOUND, "{body}");
assert_eq!(body["code"], "candidate_expired");
assert!(fixture.subtitle_rows().await.is_empty());
assert_eq!(
fixture.subtitle_rows().await,
[] as [arr_db::SubtitleFile; 0]
);
}
#[tokio::test]
@@ -2822,7 +2831,10 @@ mod tests {
.expect("delete");
assert_eq!(response.status(), StatusCode::NO_CONTENT);
assert!(!path.exists(), "the sidecar is gone from disk");
assert!(fixture.subtitle_rows().await.is_empty());
assert_eq!(
fixture.subtitle_rows().await,
[] as [arr_db::SubtitleFile; 0]
);
assert_eq!(
fixture.attempt_state("pt-PT").await.as_deref(),
Some("wanted")
@@ -2923,10 +2935,13 @@ mod tests {
let statuses = status(&format!("{}/api/movies/1/subtitles/status", fixture.base)).await;
assert_eq!(statuses.len(), 1);
assert_eq!(statuses[0]["media_file_id"], 1);
assert!(statuses[0]["subtitles"]
.as_array()
.expect("subtitles")
.is_empty());
assert_eq!(
statuses[0]["subtitles"]
.as_array()
.expect("subtitles")
.as_slice(),
[] as [serde_json::Value; 0]
);
let missing = statuses[0]["missing"].as_array().expect("missing");
assert_eq!(missing.len(), 2, "{missing:?}");
assert_eq!(missing[0]["language"], "pt-PT");
@@ -3108,10 +3123,13 @@ mod tests {
fixture.probe(serde_json::json!(["en", "pt-PT"])).await;
let statuses = status(&format!("{}/api/movies/1/subtitles/status", fixture.base)).await;
assert!(statuses[0]["embedded_tracks"]
.as_array()
.expect("embedded_tracks")
.is_empty());
assert_eq!(
statuses[0]["embedded_tracks"]
.as_array()
.expect("embedded_tracks")
.as_slice(),
[] as [serde_json::Value; 0]
);
}
/// The issue's whole point: nothing is missing on this file, so the
@@ -3223,7 +3241,10 @@ mod tests {
let (status, body) = extract(&fixture, 0).await;
assert_eq!(status, StatusCode::UNPROCESSABLE_ENTITY, "{body}");
assert!(fixture.subtitle_rows().await.is_empty());
assert_eq!(
fixture.subtitle_rows().await,
[] as [arr_db::SubtitleFile; 0]
);
}
#[tokio::test]
@@ -3268,8 +3289,14 @@ mod tests {
async fn subtitle_queue_omits_titles_with_no_gaps() {
let fixture = stub_application().await;
let body = queue(&fixture.base).await;
assert!(body["movies"].as_array().expect("movies").is_empty());
assert!(body["series"].as_array().expect("series").is_empty());
assert_eq!(
body["movies"].as_array().expect("movies").as_slice(),
[] as [serde_json::Value; 0]
);
assert_eq!(
body["series"].as_array().expect("series").as_slice(),
[] as [serde_json::Value; 0]
);
}
/// #202: an attempt row for a language no longer in the wanted set is
@@ -3292,7 +3319,10 @@ mod tests {
.expect("narrow wanted set");
let body = queue(&fixture.base).await;
assert!(body["movies"].as_array().expect("movies").is_empty());
assert_eq!(
body["movies"].as_array().expect("movies").as_slice(),
[] as [serde_json::Value; 0]
);
}
/// #202: a movie's failed attempt surfaces with its language and detail.
@@ -3418,10 +3448,13 @@ mod tests {
let body = queue(&fixture.base).await;
let series = body["series"].as_array().expect("series");
assert_eq!(series.len(), 1, "{series:?}");
assert!(series[0]["episodes"]
.as_array()
.expect("episodes")
.is_empty());
assert_eq!(
series[0]["episodes"]
.as_array()
.expect("episodes")
.as_slice(),
[] as [serde_json::Value; 0]
);
let seasons = series[0]["seasons"].as_array().expect("seasons");
assert_eq!(seasons.len(), 1, "{seasons:?}");
assert_eq!(seasons[0]["season_number"], 1);
@@ -3475,7 +3508,10 @@ mod tests {
let body = queue(&fixture.base).await;
let series = body["series"].as_array().expect("series");
assert_eq!(series.len(), 1, "{series:?}");
assert!(series[0]["seasons"].as_array().expect("seasons").is_empty());
assert_eq!(
series[0]["seasons"].as_array().expect("seasons").as_slice(),
[] as [serde_json::Value; 0]
);
let episodes = series[0]["episodes"].as_array().expect("episodes");
assert_eq!(episodes.len(), 2, "{episodes:?}");
}
+19 -7
View File
@@ -1904,7 +1904,7 @@ mod tests {
action.tick(&database).await.unwrap();
let outcomes = action.tick(&database).await.unwrap();
assert!(outcomes.is_empty());
assert_eq!(outcomes, [] as [crate::reconcile::Outcome; 0]);
assert_eq!(fake.torrents().len(), 1);
assert_eq!(grabs(&database).await.len(), 1);
}
@@ -2163,7 +2163,7 @@ mod tests {
let outcomes = action(&indexer, &downloader).tick(&database).await.unwrap();
assert!(outcomes.is_empty());
assert_eq!(outcomes, [] as [crate::reconcile::Outcome; 0]);
assert!(fake.torrents().is_empty());
}
@@ -2244,7 +2244,10 @@ mod tests {
action(&indexer, &downloader).tick(&database).await.unwrap();
assert!(grabs(&database).await.is_empty());
assert_eq!(
grabs(&database).await,
[] as [(i64, std::string::String, std::string::String); 0]
);
assert!(
fake.torrents().is_empty(),
"a torrent added this tick and then found blacklisted is removed"
@@ -2311,7 +2314,10 @@ mod tests {
assert_eq!(targeted_searches(&indexer).await, 1);
assert_eq!(deck(&database).await.len(), 3, "every candidate is cached");
assert!(fake.torrents().is_empty());
assert!(grabs(&database).await.is_empty());
assert_eq!(
grabs(&database).await,
[] as [(i64, std::string::String, std::string::String); 0]
);
}
/// The digital-release gate belongs to targeted search (§6.2). A movie
@@ -2385,7 +2391,10 @@ mod tests {
assert!(outcome.is_none());
assert_eq!(targeted_searches(&indexer).await, 0);
assert!(deck(&database).await.is_empty());
assert_eq!(
deck(&database).await,
[] as [(std::string::String, std::string::String); 0]
);
assert!(fake.torrents().is_empty());
}
@@ -2402,9 +2411,12 @@ mod tests {
let outcomes = action(&indexer, &downloader).tick(&database).await.unwrap();
assert!(outcomes.is_empty());
assert_eq!(outcomes, [] as [crate::reconcile::Outcome; 0]);
assert!(fake.torrents().is_empty());
assert!(grabs(&database).await.is_empty());
assert_eq!(
grabs(&database).await,
[] as [(i64, std::string::String, std::string::String); 0]
);
}
#[tokio::test]
+1 -1
View File
@@ -1835,7 +1835,7 @@ mod tests {
let outcomes = h.action.tick(&h.database).await.unwrap();
assert!(outcomes.is_empty());
assert_eq!(outcomes, [] as [crate::reconcile::Outcome; 0]);
}
/// #108, overriding §86: a `downloaded` grab whose torrent qBittorrent
+4 -1
View File
@@ -171,7 +171,10 @@ mod tests {
let action = ReaperAction::new(QbitClient::new(&server.uri()).unwrap());
let labels = HashSet::from(["movies-main".to_owned()]);
assert!(action.tick(&labels).await.unwrap().is_empty());
assert_eq!(
action.tick(&labels).await.unwrap(),
[] as [crate::reconcile::Outcome; 0]
);
assert!(deleted.lock().unwrap().is_empty());
}
}
+5 -2
View File
@@ -983,9 +983,12 @@ mod tests {
let outcomes = action(&indexer, &downloader).tick(&database).await.unwrap();
assert!(outcomes.is_empty());
assert_eq!(outcomes, [] as [crate::reconcile::Outcome; 0]);
assert!(fake.added.lock().unwrap().is_empty());
assert!(stored_releases(&database).await.is_empty());
assert_eq!(
stored_releases(&database).await,
[] as [std::string::String; 0]
);
}
/// §6.2: RSS never backs off, so nothing it does may spend one of
+1 -1
View File
@@ -998,7 +998,7 @@ mod tests {
let after_first = server.received_requests().await.unwrap().len();
let second = action(&server).tick(&database).await.unwrap();
assert!(second.is_empty());
assert_eq!(second, [] as [crate::reconcile::Outcome; 0]);
assert_eq!(
server.received_requests().await.unwrap().len(),
after_first,
+20 -5
View File
@@ -1053,7 +1053,10 @@ mod tests {
assert_eq!(row.sync, SubtitleSync::Rejected);
delete_file(db.pool(), id).await.unwrap();
assert!(files_for(db.pool(), file).await.unwrap().is_empty());
assert_eq!(
files_for(db.pool(), file).await.unwrap(),
[] as [crate::subtitles::SubtitleFile; 0]
);
}
#[tokio::test]
@@ -1244,8 +1247,14 @@ mod tests {
.await
.unwrap();
assert!(files_for(db.pool(), file).await.unwrap().is_empty());
assert!(attempts_for(db.pool(), file).await.unwrap().is_empty());
assert_eq!(
files_for(db.pool(), file).await.unwrap(),
[] as [crate::subtitles::SubtitleFile; 0]
);
assert_eq!(
attempts_for(db.pool(), file).await.unwrap(),
[] as [crate::subtitles::SubtitleAttempt; 0]
);
}
}
@@ -1273,7 +1282,10 @@ mod unsatisfy_tests {
async fn a_deleted_subtitle_puts_its_language_back_in_the_work_list() {
let (db, _dir, file) = file().await;
mark_satisfied(db.pool(), file, "pt-PT").await.unwrap();
assert!(pending(db.pool(), 10).await.unwrap().is_empty());
assert_eq!(
pending(db.pool(), 10).await.unwrap(),
[] as [crate::subtitles::PendingSubtitle; 0]
);
unsatisfy(db.pool(), file, "pt-PT").await.unwrap();
@@ -1306,7 +1318,10 @@ mod unsatisfy_tests {
async fn an_untracked_language_is_left_alone() {
let (db, _dir, file) = file().await;
unsatisfy(db.pool(), file, "es").await.unwrap();
assert!(attempts_for(db.pool(), file).await.unwrap().is_empty());
assert_eq!(
attempts_for(db.pool(), file).await.unwrap(),
[] as [crate::subtitles::SubtitleAttempt; 0]
);
}
/// Only a satisfied claim is withdrawn: a language the loop has already
+16 -4
View File
@@ -724,8 +724,14 @@ mod tests {
let client =
QbitClient::with_credentials(&server.uri(), "user".into(), "pass".into()).unwrap();
assert!(client.list_torrents().await.unwrap().is_empty());
assert!(client.list_torrents().await.unwrap().is_empty());
assert_eq!(
client.list_torrents().await.unwrap(),
[] as [crate::Torrent; 0]
);
assert_eq!(
client.list_torrents().await.unwrap(),
[] as [crate::Torrent; 0]
);
}
/// An instance that bypasses authentication for arr's address answers
@@ -748,7 +754,10 @@ mod tests {
let client =
QbitClient::with_credentials(&server.uri(), "user".into(), "stale".into()).unwrap();
assert!(client.list_torrents().await.unwrap().is_empty());
assert_eq!(
client.list_torrents().await.unwrap(),
[] as [crate::Torrent; 0]
);
}
#[tokio::test]
@@ -1072,6 +1081,9 @@ mod tests {
.await;
let client = QbitClient::new(&format!("{}/qbt", server.uri())).unwrap();
assert!(client.list_torrents().await.unwrap().is_empty());
assert_eq!(
client.list_torrents().await.unwrap(),
[] as [crate::Torrent; 0]
);
}
}
+4 -1
View File
@@ -707,7 +707,10 @@ mod tests {
);
assert_eq!(searches[2].error, None);
assert!(searches[3].releases.is_empty());
assert_eq!(
searches[3].releases,
[] as [crate::search::SearchRelease; 0]
);
assert_eq!(searches[3].error, Some(SearchError::InvalidResponse));
}
+2 -2
View File
@@ -216,7 +216,7 @@ async fn unreleased_movie_has_no_dates_and_no_imdb_id() {
assert_eq!(movie.digital_release, None);
assert_eq!(movie.imdb_id, None);
assert_eq!(movie.runtime, None);
assert!(movie.origin_countries.is_empty());
assert_eq!(movie.origin_countries, [] as [std::string::String; 0]);
// TMDB reports vote_average: 0 for an unrated title — absence, not zero
// (#156), so it is normalised away like any other zero-valued null.
assert_eq!(movie.vote_average, None);
@@ -537,7 +537,7 @@ async fn find_by_imdb_resolves_series() {
.await
.expect("lookup succeeds");
assert!(results.movies.is_empty());
assert_eq!(results.movies, [] as [arr_meta::MovieSearchResult; 0]);
assert_eq!(results.series.len(), 1);
let series = &results.series[0];
assert_eq!(series.tmdb_id, 82_728);
+1 -1
View File
@@ -417,7 +417,7 @@ mod tests {
fn the_template_splits_on_whitespace() {
assert_eq!(argv("ssh box claude -p"), ["ssh", "box", "claude", "-p"]);
assert_eq!(argv(" claude "), ["claude"]);
assert!(argv(" ").is_empty());
assert_eq!(argv(" "), [] as [std::string::String; 0]);
}
/// #225: a fresh verdict is served straight from the cache; a stale one
+1 -1
View File
@@ -612,7 +612,7 @@ mod tests {
.await
.expect("nothing to send");
assert!(translated.is_empty());
assert_eq!(translated, [] as [crate::srt::Cue; 0]);
assert_eq!(backend.calls.load(Ordering::SeqCst), 0);
}