Skip to content

Tighten CI lint coverage: add --all-targets and fmt --check#27

Merged
iainmcgin merged 1 commit intomainfrom
ci/tighten-lint-coverage
Apr 2, 2026
Merged

Tighten CI lint coverage: add --all-targets and fmt --check#27
iainmcgin merged 1 commit intomainfrom
ci/tighten-lint-coverage

Conversation

@iainmcgin
Copy link
Copy Markdown
Collaborator

Two CI gaps surfaced during v0.3.0 prep:

  1. cargo clippy --workspace -- -D warnings lacked --all-targets — tests, benches, and examples were never lint-checked. Adding it surfaced ~37 violations across test code in buffa, buffa-types, buffa-codegen, plus 46 in buffa-test.
  2. cargo fmt --all --check was never run in CI — fmt drift from Skip synthetic oneofs in nested type collision check #20 went undetected (later fixed as a drive-by in Sanitize proto comments for rustdoc in generated code #25, so no remaining drift).

This PR adds both checks to Taskfile.yml lint and .github/workflows/ci.yml (lint-and-test + msrv-check jobs), then fixes the violations.

Fixes by category

Lint Count Resolution
field_reassign_with_default ~15 in published crates, 35 in buffa-test Converted to struct literals in published crates; #[allow] on buffa-test mod tests (the field-assignment style mirrors the documented protobuf construction pattern)
approx_constant (3.14) ~12 Changed to 2.5 in published crates (arbitrary test data, not PI); allowed in buffa-test
items_after_test_module 1 Moved impl_message.rs mod tests to end of file (~630 lines of helpers were after it) — zero net lines
identity_op (| 0, + 0) 3 #[allow] with comment — the explicit wire-type / byte-count makes the test encoding readable
Assorted (derivable_impls, unnecessary_map_or, unnecessary_cast, unnecessary_get_then_check, needless_borrows_for_generic_args, clone_on_copy, unnecessary_to_owned) ~8 Applied clippy's suggested fix

Net +34 lines across 14 files (most of the diff is the impl_message.rs block move). task lint and task test (1400 tests) both pass.

Aligns with anthropics/connect-rust#25 which made the same --all-targets change there.

Adds cargo fmt --all --check and --all-targets to clippy/check in
both Taskfile lint and CI lint-and-test/msrv-check jobs, then fixes
the violations this surfaces.

Violations were all in test code (lib targets were already clean):

- field_reassign_with_default: test fixtures using
  let mut x = T::default(); x.f = v; converted to struct literals
  in published crates (buffa, buffa-types, buffa-codegen). For the
  buffa-test crate (publish=false integration tests), allowed at the
  tests module level since the field-assignment style mirrors the
  documented protobuf message construction pattern.
- approx_constant: 3.14 test values changed to 2.5 in published
  crates (the values are arbitrary test data, not PI); allowed in
  buffa-test.
- items_after_test_module: impl_message.rs had mod tests in the
  middle of the file with ~630 lines of helper functions after it;
  moved to the end (zero net lines).
- Assorted: derivable_impls, unnecessary_map_or, unnecessary_cast,
  unnecessary_get_then_check, needless_borrows_for_generic_args,
  clone_on_copy, unnecessary_to_owned, identity_op (allowed where
  the | 0 / + 0 makes wire-format encoding explicit).

No fmt drift remained on main (#25 fixed it as a drive-by).
@iainmcgin iainmcgin marked this pull request as ready for review April 2, 2026 02:38
@iainmcgin iainmcgin requested a review from rpb-ant April 2, 2026 02:41
@iainmcgin iainmcgin enabled auto-merge (squash) April 2, 2026 02:41
@iainmcgin iainmcgin merged commit e6f97ad into main Apr 2, 2026
7 checks passed
@iainmcgin iainmcgin deleted the ci/tighten-lint-coverage branch April 2, 2026 02:41
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants