style: clear clippy warning backlog for the clippy CI job (#193) - #229
Merged
Conversation
Clears the clippy lint backlog in pg-core, pg-pkg, pg-cli and pg-ffi so the workspace is clean under `-D warnings`, in support of adding a clippy CI job (#193). All changes are semantics-preserving: - remove needless borrows (`&x` where the ref is immediately dereferenced, incl. `.chain(&arr)` -> `.chain(arr)` in stream signing/verification) - drop redundant `pub(self)`, unused test imports, and `.clone()` on the `Copy` type `SecretKey` - move `gg_read_key_pair` above the `#[cfg(test)]` module (items-after-test) - use `ptr::slice_from_raw_parts_mut` for the `Box::from_raw` cast in pg-ffi - add `# Safety` sections to the exported `pg_seal`/`pg_free` unsafe fns Verified: cargo clippy -D warnings (all 4 manifests), cargo test (core, pkg, cli, ffi), cargo fmt --all --check, cargo build --profile edge --bin pg-pkg (Docker 1.90 parity). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
There was a problem hiding this comment.
✅ Rules Dobby 2 sign-off — no findings (approve).
Verdict is APPROVE — posted as
COMMENTonly because GitHub blocks approving your own PR (dobby-coder[bot]authored this). Treat as a clean sign-off.
Reviewed the full diff plus Review Dobby 2's report (0 findings, tests green). This is a pure clippy-backlog cleanup (#193) — every change is semantics-preserving:
- needless-borrow removals in tests (
&pk→pk,&usk→usk,&pub_sign_key→pub_sign_key) — target fns take the same effective type. pub(self)→ private onstream_mode_checked(redundant visibility).- stream sign/verify
.chain(&counter.to_be_bytes())→.chain(counter.to_be_bytes())/.chain(&[0x00])→.chain([0x00])—chaintakesimpl AsRef<[u8]>; byte-identical signing input, no crypto behaviour change. - pg-ffi: added
# Safetydocs (missing_safety_doc) andslice::from_raw_parts_mut→std::ptr::slice_from_raw_parts_mut— avoids materialising an intermediate reference to the raw buffer, strictly safer. - pg-pkg:
Data::new(ibe_sk.clone())→Data::new(ibe_sk)(redundant_clone; compiles ⇒ genuine last use) and dropped unusedApp, HttpResponsetest imports. - pg-pkg/util.rs:
gg_read_key_pairrelocated above the tests module (pure move).
cargo clippy --all-targets -- -D warnings, cargo fmt --check, and the full test suite all pass. Flipping to ready-for-review.
Merged
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #193 — CI: add cargo clippy lint job to build.yml.
What this PR does
Adds a
clippyjob to.github/workflows/build.ymland clears the clippywarning backlog across the workspace so the job passes under
-D warningsfrom day one.
Originally this PR shipped only the pushable half (the backlog cleanup),
because the
dobby-coderGitHub App lacks theworkflows: writepermissionand the remote rejects any App push touching
.github/workflows/*.yml. Theworkflow job has now been added directly by a maintainer, so both halves land
together.
The clippy job
Placed alongside
format:inbuild.yml:Note vs. the issue's draft:
pg-coreuses the sametest,rust,streamfeatureset as the
test:job rather than--all-features(its features are mutuallyconstraining). Because the backlog below is cleared, the job goes straight to
-D warnings— no warn-only interim step needed. (CI'sstableclippy maydiffer from the local
1.96.1used here and surface new lints later; if thathappens, the warn-only fallback from the issue still applies.)
Backlog cleanup
Cleared every clippy warning across the four linted crates. All changes are
semantics-preserving:
&ximmediately dereferenced, including.chain(&counter.to_be_bytes())→.chain(counter.to_be_bytes())in thestream signing/verification paths (
pg-core)pub(self), unused test imports (App,HttpResponse),and
.clone()on theCopytypeSecretKey(pg-core,pg-pkg)gg_read_key_pairabove the#[cfg(test)]module (items-after-test,pg-pkg)Box::from_raw(ptr::slice_from_raw_parts_mut(..))instead of casting a&mut [u8]— avoids materialising an intermediate reference (pg-ffi)# Safetydoc sections to the exportedpg_seal/pg_freeunsafefunctions (
pg-ffi)Verification
cargo clippy --all-targets ... -- -D warnings— clean on all 4 manifestscargo test— core (test,rust,stream), pkg (43), cli (7), ffi (1) all passcargo fmt --all -- --check— cleancargo build --profile edge --bin pg-pkg— compiles (Docker Rust 1.90 parity)