Skip to content

Apply the simple-rust audit: fmt, clippy -D warnings, typed errors - #62

Merged
jrodal98 merged 1 commit into
masterfrom
chore/simple-rust-audit
Oct 21, 2026
Merged

jrodal98 merged 1 commit into
masterfrom
chore/simple-rust-audit

Conversation

@jrodal98

Copy link
Copy Markdown
Owner

Applies the simple-rust skill (now saved as a project skill) across the codebase. Verified end state: cargo fmt --check clean, cargo clippy --all-targets -- -D warnings clean, full cargo test suite green. Independent of #61 (disjoint files; merge in any order).

Formatting: the tree was never rustfmt-formatted (360 diff hunks). This PR runs cargo fmt over everything; most of the diff is that mechanical pass.

Semantic changes:

  • No #[allow] remains in src. AdminUser dead_code allow removed outright — an #[expect] conversion flagged it as unfulfilled, i.e. the suppression was already stale (exactly what expect is for). too_many_arguments on db::create_bookmark removed properly: new db::NewBookmark params struct; all 4 production and 16 test call sites converted. unused_mut on the session-cookie builder removed by shadowing the builder under the release-only cfg instead of mutating it. while_let_on_iterator in the template parsers quoted-value reader converted to a for loop over chars.by_ref().
  • Clippy result_large_err x3 in the JSON API helpers: full Response (128+ bytes) was the Err of internal Results. New small ApiError payload struct (status + message) with IntoResponse; the {"error": ...} wire shape is byte-identical.
  • AppError now derives thiserror (Display strings unchanged); manual Display/Error impls deleted. main() returns anyhow::Result instead of Box. Four production .unwrap() calls became .expect(...) with reasons (governor config, response builder, two export header parses); the remaining non-test expects already carried reasons or are fail-fast startup. e2e_test single_match -> if let.
  • Cargo.toml: dependencies alphabetized (dev-deps too), async-trait removed (zero usages anywhere — machete-style check by grep), thiserror = 2 added, rust-version = 1.81 declared (the floor for #[expect] with reason). Cargo.lock stays gitignored per existing repo policy.

Deliberately unchanged (local convention wins over the guide): mod.rs module layout throughout; update_bookmark keeps 7 positional args (at, not over, the clippy threshold); grouped db/service layering as-is. Suggestion for later (needs workflow-edit permission the Muse app token lacks): a CI job running fmt --check + clippy -D warnings + test so the gates stay green.

@jrodal98
jrodal98 merged commit 509883c into master Oct 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant