Skip to content

ci(rust): lint every target and the cli feature with clippy - #1152

Merged
thekevinscott merged 3 commits into
mainfrom
claude/1148-clippy-all-targets
Sep 18, 2026
Merged

thekevinscott merged 3 commits into
mainfrom
claude/1148-clippy-all-targets

Conversation

@thekevinbot

Copy link
Copy Markdown
Collaborator

Fixes #1148

dirsql-rust-ci.yml ran cargo clippy --workspace -- -D warnings, which lints the library under default features and nothing else: every #[cfg(test)] module, everything under packages/rust/tests/, and the whole cli feature went unlinted.

This widens the invocation to cargo clippy --workspace --all-targets --features cli -- -D warnings and fixes the 12 violations that surfaces. Both halves have to land together — widening alone turns the job red, fixing alone leaves nothing preventing a regression.

Fixes

All mechanical, taking clippy's own suggestion: expect_err (3), io::Error::other, needless borrows in format! (2), redundant use rusqlite;, redundant closure, elided lifetime, let_and_return, collapsible if (a let-chain, edition 2024).

The one that is not a style nit is tests/async_sdk.rs:289, a MutexGuard held across an .await. The test already called drop(state) before db.ready().await, but the binding's lexical scope still spanned the await point, which is what clippy models. The guard's acquisition, the timed_out assertion, state.released = true and cvar.notify_all() are now wrapped in a block, so the guard drops at exactly the point drop(state) dropped it and the await sits outside its scope. No assertion changed, no test added, removed, or weakened. No #[allow] was added anywhere in this PR.

Cost

The wider invocation adds the test targets, the napi/py-ext crates' test targets, and the cli feature to the check. Locally, on a warm target dir, the widened run finishes in ~2s versus ~1s narrow; cold, it is dominated by the dependency build the job already pays for (clap is the only feature-gated addition). Not enough to matter for the job's runtime.

Verification

  • cargo clippy --workspace --all-targets --features cli -- -D warnings — exit 0
  • cargo test --workspace --features cli — all suites pass, 0 failed
  • just preflight — 0 failing pairs, 3 skipped

E2E Verification

N/A - CI/config only

The e2e-verify gate still demands receipts (any packages/rust/src diff scopes both bindings), so both were written:

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass (37 passed)
  • TypeScript SDK e2e: pass (17 passed)
  • Rust core e2e: pass (cargo test --workspace --features cli)
  • packages/python/e2e-attestations/claude-1148-clippy-all-targets.json receipt written
  • packages/ts/e2e-attestations/claude-1148-clippy-all-targets.json receipt written
  • Command(s) run: just e2e-attest-python, just e2e-attest-ts, cargo test --workspace --features cli
  • Result summary: all green

Changelog / Migrations

  • skip-changelog on the implementation commit: lint fixes in test code plus a CI invocation change, no observable behavior change
  • Migration fragment not required — no API or behavior change

The clippy step ran `cargo clippy --workspace`, which skipped every
`#[cfg(test)]` module, everything under `packages/rust/tests/`, and the
whole `cli` feature. Widen it to `--all-targets --features cli` and fix
the 12 violations that surfaces, including a `MutexGuard` held across an
await in `tests/async_sdk.rs`.

skip-changelog: lint fixes in test code plus a CI invocation change; no observable behavior change

Fixes #1148
@thekevinscott
thekevinscott merged commit 2b1f0f7 into main Sep 18, 2026
77 checks passed
@thekevinscott
thekevinscott deleted the claude/1148-clippy-all-targets branch September 18, 2026 17:34
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.

ci: rust clippy skips every test target and the cli feature

2 participants