Skip to content

Fix clippy/compiler warnings in github-guard rust-guard - #9655

Merged
lpcox merged 1 commit into
mainfrom
fix-github-guard-warnings
Jul 19, 2026
Merged

Fix clippy/compiler warnings in github-guard rust-guard#9655
lpcox merged 1 commit into
mainfrom
fix-github-guard-warnings

Conversation

@lpcox

@lpcox lpcox commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Running make test in guards/github-guard built the Rust guard crate cleanly on tests (595 passing) but emitted a compiler warning, and cargo clippy surfaced several more. This PR resolves all warnings and errors so the crate builds warning-free.

Changes

  • Unused import (labels/mod.rs): project_github_label is only referenced from #[cfg(test)] code, so its re-export is now gated behind #[cfg(test)], eliminating the unused_imports warning in non-test lib builds while keeping tests compiling.
  • collapsible_else_if (labels/response_paths.rs): collapsed two else { if let .. } blocks into else if let (issue and pull-request list/read paths).
  • needless_borrow (labels/response_paths.rs): dropped two redundant & borrows passed to short_sha and make_item_path.
  • bool_assert_comparison (labels/mod.rs): replaced assert_eq!(.., true) / assert_eq!(.., false) with assert! / assert!(!..) in the get_bool_or test.
  • too_many_arguments (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' version messages 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).

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>
Copilot AI review requested due to automatic review settings July 19, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants