chore: make the workspace clippy-clean, and add the job that keeps it so - #21
Conversation
📝 WalkthroughWalkthroughThe pull request adds a workspace-wide Clippy CI job and applies idiomatic Rust updates across cryptography, protocol serialization, TLV/LDS handling, MRZ/PAN parsing, documentation, lint annotations, and test helpers. ChangesWorkspace Clippy cleanup
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
All reported issues were addressed across 32 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Valid, pre-existing, and not from this PR — raised as #22 rather than folded in here. This PR's only change to I checked how far it actually reaches before filing. The two status arms are mostly covered by the call path: The third arm is the sharp one. A response with status Not fixed here deliberately. Tightening it changes behaviour on real hardware: if any chip in the field answers a protected exchange with a bare |
Seventy-four diagnostics had accumulated across dmrtd, mrz-parser, aamva and
aadhaar-offline-kyc, because nothing ran clippy. Most were mechanical and are
fixed as suggested. Three were worth more than the lint:
- A stray `();` in the BAC session's Completed arm, left over from a guard.
- Two tests asserting against `"IZ3".replace('3', "3")` — a no-op expressing
"3 has no look-alike letter". Now the literal, with the reason in words.
- `string_extensions`' header was `///` rather than `//!`, so the module
description was documenting the first function instead of the module.
Seven remain allowed at the site, each with its reason: boxing an enum that
exists once per session buys nothing, renaming a public module or a state
machine's `next` breaks a published API to satisfy a naming convention, and an
MRZ has as many fields as it has.
The CI job runs on stable so a toolchain bump surfaces new lints immediately,
rather than letting them pile up into another cleanup like this one.
ed40c15 to
425b3b1
Compare
Nothing in CI ran clippy, so seventy-four diagnostics had accumulated across
dmrtd,mrz-parser,aamvaandaadhaar-offline-kyc. This clears them and adds the job, so the next one shows up as a failure rather than as a backlog.Three that were more than style
A stray
();inBacSession'sCompletedarm — dead, left over from the guard above it.Two tests asserting against
"IZ3".replace('3', "3"). The no-op was expressing "3has no look-alike letter, so it passes through". That's worth saying, but not in code that reads as a mistake — it's now the literal with the reason written out.string_extensions.rsopened with///where it meant//!, so the module description was attached to the first function rather than to the module.Seven allowed at the site
Each with its reason in a comment, because a silenced lint with no explanation is indistinguishable from one nobody looked at:
large_enum_variant×2module_inception×2df1::df1andiso7816::iso7816hold the application constants distinct from the files beside them. Renaming changes a public path in a published crate.should_implement_trait×2nexthere is a fallible protocol step driving an APDU exchange, ending inDonerather thanNone. It could not beIterator::next.too_many_argumentsThe rest
Mechanical, applied as suggested —
div_ceil,is_multiple_of, redundant closures,starts_with, index loops replaced with iterators, and nine over-indented doc continuations that rustdoc was reading as nested content.Verification
cargo clippy --workspace --all-targets -- -D warningsclean,cargo fmt --all --checkclean, 907 tests pass.Worth knowing: the job runs on
stable, not a pinned toolchain. That is the deliberate choice — a toolchain bump introducing new lints will fail this job. The alternative, pinning, trades a visible failure for a silent backlog, which is what produced this PR.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by cubic
Made the workspace clippy-clean across
dmrtd,mrz-parser,aamva, andaadhaar-offline-kyc, and added a CI job on stable to keep it that way.New Features
clippyjob to CI onstablethat runscargo clippy --workspace --all-targets -- -D warnings.#[allow]ed in place with comments (e.g.,module_inception,should_implement_trait,large_enum_variant,too_many_arguments) to avoid breaking public APIs or adding allocations.Bug Fixes
();inBacSession’sCompletedarm."IZ3".replace('3', "3"); now assert the literal and document why3passes through.string_extensions.rsheader to//!so the module docs attach to the module, not the first function.Written for commit 425b3b1. Summary will update on new commits.