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

@@ -1212,14 +1212,16 @@ mod tests {
// VisionClient pointed at a closed local port. Reqwest fails the
// POST immediately (connection refused), but the prep work runs
// before the POST is even built.
let mut cfg = AnalysisConfig::default();
cfg.endpoint = "http://127.0.0.1:1/v1/chat/completions".into();
cfg.model = "stub".into();
cfg.request_timeout = Duration::from_secs(1);
// Tune slice geometry to match the test image's shape.
cfg.max_pixels = 1_000_000;
cfg.min_slice_height = 100;
cfg.tall_aspect_threshold = 1.8;
let cfg = AnalysisConfig {
endpoint: "http://127.0.0.1:1/v1/chat/completions".into(),
model: "stub".into(),
request_timeout: Duration::from_secs(1),
// Tune slice geometry to match the test image's shape.
max_pixels: 1_000_000,
min_slice_height: 100,
tall_aspect_threshold: 1.8,
..Default::default()
};
let http = reqwest::Client::builder()
.timeout(cfg.request_timeout)
.no_proxy()