Tighten CI lint coverage: add --all-targets and fmt --check#27
Merged
Tighten CI lint coverage: add --all-targets and fmt --check#27
Conversation
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).
rpb-ant
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two CI gaps surfaced during v0.3.0 prep:
cargo clippy --workspace -- -D warningslacked--all-targets— tests, benches, and examples were never lint-checked. Adding it surfaced ~37 violations across test code inbuffa,buffa-types,buffa-codegen, plus 46 inbuffa-test.cargo fmt --all --checkwas 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.ymllintand.github/workflows/ci.yml(lint-and-test + msrv-check jobs), then fixes the violations.Fixes by category
field_reassign_with_defaultbuffa-test#[allow]onbuffa-testmod tests(the field-assignment style mirrors the documented protobuf construction pattern)approx_constant(3.14)2.5in published crates (arbitrary test data, not PI); allowed inbuffa-testitems_after_test_moduleimpl_message.rsmod teststo end of file (~630 lines of helpers were after it) — zero net linesidentity_op(| 0,+ 0)#[allow]with comment — the explicit wire-type / byte-count makes the test encoding readablederivable_impls,unnecessary_map_or,unnecessary_cast,unnecessary_get_then_check,needless_borrows_for_generic_args,clone_on_copy,unnecessary_to_owned)Net +34 lines across 14 files (most of the diff is the
impl_message.rsblock move).task lintandtask test(1400 tests) both pass.Aligns with anthropics/connect-rust#25 which made the same
--all-targetschange there.