refactor(clippy): fix the never-loop error and clear all lint warnings
All checks were successful
deploy / test-backend (push) Successful in 30m17s
deploy / test-frontend (push) Successful in 10m33s
deploy / build-and-push (push) Successful in 11m11s
deploy / deploy (push) Successful in 13s

`cargo clippy --all-targets` was failing on a deny-by-default
`never_loop` in the analysis SSE handler (the `loop` always returned on
the first iteration — the stream `unfold` already re-enters per event),
plus ~28 warnings. All resolved with no behaviour change:

- admin/analysis SSE: drop the dead `loop` wrapper.
- app: match port literals directly instead of `if p == 80` guards.
- repo/user: separate doc list from the following paragraphs.
- repo/upload_history: `sort_by_key(Reverse(..))` over `sort_by`.
- crawler/nav test: construct the error directly (no `unwrap_err` on a
  literal `Err`).
- test helpers: build configs via struct-update syntax instead of
  `Default::default()` + field reassignment; add a type alias for a
  complex audit-row tuple.
- plus the mechanical `deref`/etc. fixes from `cargo clippy --fix`.

Note: not running `cargo fmt` — the backend uses a consistent
hand-formatted style that differs from rustfmt-default across ~110
files, so a blanket reformat would be pure churn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-02 20:45:37 +02:00
parent ded77fe4ba
commit 35c02066fe
13 changed files with 91 additions and 70 deletions

View File

@@ -279,7 +279,7 @@ async fn backfill_fills_unmeasured_pages_and_covers_idempotently(pool: PgPool) {
let body2 = common::body_json(resp2).await;
assert_eq!(body2["pages"].as_i64().unwrap(), 0);
assert_eq!(body2["covers"].as_i64().unwrap(), 0);
assert_eq!(body2["more_remaining"].as_bool().unwrap(), false);
assert!(!body2["more_remaining"].as_bool().unwrap());
}
#[sqlx::test(migrations = "./migrations")]
@@ -362,7 +362,7 @@ async fn backfill_caps_per_run_and_reports_more_remaining(pool: PgPool) {
assert_eq!(resp.status(), StatusCode::OK);
let body = common::body_json(resp).await;
// Capped at 20_000 attempts this run; one row left → run again.
assert_eq!(body["more_remaining"].as_bool().unwrap(), true);
assert!(body["more_remaining"].as_bool().unwrap());
assert_eq!(body["missing"].as_i64().unwrap(), 20_000);
assert_eq!(body["pages"].as_i64().unwrap(), 0);
}
@@ -403,9 +403,8 @@ async fn backfill_at_exact_cap_is_not_more_remaining(pool: PgPool) {
.unwrap();
let body = common::body_json(resp).await;
assert_eq!(body["missing"].as_i64().unwrap(), 20_000);
assert_eq!(
body["more_remaining"].as_bool().unwrap(),
false,
assert!(
!body["more_remaining"].as_bool().unwrap(),
"exactly-cap backlog drains in one run; no follow-up needed"
);
}