Fix clippy/compiler warnings in github-guard rust-guard - #9655
Merged
Conversation
Resolve all warnings surfaced when building the github-guard Rust crate
(`make test` in guards/github-guard):
- Gate the `project_github_label` re-export behind `#[cfg(test)]` since it is
only used by test code, removing the unused-import warning in lib builds.
- Collapse two `else { if let .. }` blocks into `else if let` in
response_paths.rs (collapsible_else_if).
- Remove two needless borrows passed to `short_sha` and `make_item_path`
(needless_borrow).
- Replace `assert_eq!(.., true/false)` with `assert!` / `assert!(!..)` in the
get_bool_or test (bool_assert_comparison).
- Add `#[allow(clippy::too_many_arguments)]` to two internal helper functions
whose argument lists are intentional.
All 595 unit tests pass; `cargo clippy --all-targets` is warning-free.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Eliminates Rust compiler and Clippy warnings without changing guard behavior.
Changes:
- Gates a test-only re-export and modernizes boolean assertions.
- Applies Clippy-recommended control-flow and borrowing simplifications.
- Documents intentional high-arity helpers with targeted lint allowances.
Show a summary per file
| File | Description |
|---|---|
labels/tool_rules.rs |
Allows intentional helper argument counts. |
labels/response_paths.rs |
Simplifies conditionals and removes redundant borrows. |
labels/mod.rs |
Gates test-only export and improves assertions. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Medium
This was referenced Jul 19, 2026
This was referenced Jul 20, 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 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.
Summary
Running
make testinguards/github-guardbuilt the Rust guard crate cleanly on tests (595 passing) but emitted a compiler warning, andcargo clippysurfaced several more. This PR resolves all warnings and errors so the crate builds warning-free.Changes
labels/mod.rs):project_github_labelis only referenced from#[cfg(test)]code, so its re-export is now gated behind#[cfg(test)], eliminating theunused_importswarning in non-test lib builds while keeping tests compiling.labels/response_paths.rs): collapsed twoelse { if let .. }blocks intoelse if let(issue and pull-request list/read paths).labels/response_paths.rs): dropped two redundant&borrows passed toshort_shaandmake_item_path.labels/mod.rs): replacedassert_eq!(.., true)/assert_eq!(.., false)withassert!/assert!(!..)in theget_bool_ortest.labels/tool_rules.rs): added#[allow(clippy::too_many_arguments)]to two internal helper functions (resolve_author_integrity,apply_issue_read_enrichment) whose argument lists are intentional.The
ld: ... was built for newer 'macOS' versionmessages emitted during the build are toolchain/linker noise unrelated to this repo and are not addressed here.Verification
make test→ 595 passed; 0 failed; WASM build verified.cargo clippy --all-targets→ warning-free.The change set is intentionally minimal — no unrelated rustfmt reflow was included (the crate already carries pre-existing rustfmt drift on
main, which this PR leaves untouched).