Skip to content

build: lint-check-rust omits --all-targets, so clippy has never run over any test target #474

Description

@justin13888

What is wrong

lint-check-rust — the clippy gate every branch must pass, and part of check-rust — is:

[tasks.lint-check-rust]
run = "cargo clippy --workspace -- $CLIPPY_FLAGS"

mise.toml:135-136. There is no --all-targets, so cargo lints lib and bin targets only. Every integration test, every #[cfg(test)] mod tests, every bench and every example in the workspace is invisible to clippy and to the -D warnings in CLIPPY_FLAGS (mise.toml:40).

This is a gate hole rather than a nit: the test tree is a large and growing share of the workspace (capsule-core alone carries 783 tests, capsule-e2e is entirely test code), and none of it is linted. Defects of this class accumulate unseen and nothing ever reports them.

Evidence

One instance found while working on an unrelated change: capsule-core/src/library/receipts.rs:96 imports HybridSignature and HybridVerifyingKey into its test module and uses neither.

warning: unused imports: `HybridSignature` and `HybridVerifyingKey`
  --> capsule-core/src/library/receipts.rs:96:31

It has been there since f508bf1a. mise run lint-check-rust passes on it; cargo check --workspace --all-targets reports it.

Size of the backlog this will surface

Measured on test/e2e-cases-409 at acaf9c11, running the gate's own CLIPPY_FLAGS with --all-targets added (and -D warnings dropped so the run does not stop at the first crate):

  • 111 warnings across 32 files — 70 in capsule-core, 8 in capsule-server, 1 in capsule-sdk, the rest in test binaries.
  • The largest groups are cosmetic and mechanically fixable: 26 × unreadable_literal (timestamps like 1720000000), 6 × large_stack_arrays, 4 × case_sensitive_file_extension_comparisons, 3 × unnecessary_lazy_evaluations, 3 × needless_update, plus one-offs (unused_imports, dead_code, unreachable_pub, float_cmp, useless_vec, assertions_on_constants, …).
  • clippy::unwrap_used and expect_used are not part of the backlog: clippy.toml:6-7 already sets allow-unwrap-in-tests / allow-expect-in-tests, so the flag costs nothing there. Verified — a run with -D clippy::unwrap_used --all-targets reports zero unwrap() denials.

Why this is its own piece of work

Adding --all-targets to the task turns 111 currently-invisible warnings into a red gate on every branch at once. Doing it inside an unrelated pull request would bury that PR's own delta under a cross-workspace cleanup, so it needs to be a change of its own: fix the backlog and flip the flag in one commit series, ideally crate by crate.

Two things to decide while doing it:

  1. Whether to also widen the two --features ffi clippy invocations (mise.toml:314-315), which have the same omission.
  2. Whether some pedantic lints should be relaxed for test targets specifically (e.g. large_stack_arrays on a fixture buffer is not the same defect it is in library code). clippy.toml already takes that position for unwrap/expect; the same reasoning may apply to one or two others rather than editing fixtures to please a lint.

Reproduce

mise run lint-check-rust           # passes
cargo check --workspace --all-targets   # reports capsule-core/src/library/receipts.rs:96

Found by the W-E2E lane of the #409 run; referenced from PR #463's ## Unresolved review notes, which deliberately did not fix it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions