Skip to content

[Repo Assist] fix(rust-guard): remove stale #[allow(dead_code)] from backend.rs#2382

Merged
lpcox merged 1 commit intomainfrom
repo-assist/fix-issue-2369-remove-stale-dead-code-backend-21a6ac15957c0dff
Mar 24, 2026
Merged

[Repo Assist] fix(rust-guard): remove stale #[allow(dead_code)] from backend.rs#2382
lpcox merged 1 commit intomainfrom
repo-assist/fix-issue-2369-remove-stale-dead-code-backend-21a6ac15957c0dff

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Fixes #2369 (Improvement 1).

Summary

Three #[allow(dead_code)] attributes in guards/github-guard/rust-guard/src/labels/backend.rs were suppressing compiler warnings for functions that are actively used in production. These annotations were stale — the functions were wired up but the suppressions were never removed.

Removed annotations

Function Production call sites
is_repo_private 10 sites across helpers.rs, response_items.rs, response_paths.rs, tool_rules.rs
get_issue_author_association_with_callback Called by get_issue_author_association (below)
get_issue_author_association helpers.rs:1172

Retained annotation

The #[allow(dead_code)] on is_forked_pull_request_with_callback (line 221) is intentionally kept — that function has zero production call sites and is exercised only by tests. It is dead code, and the annotation correctly signals that. Removing it is a separate, larger refactoring (Improvement 2 in #2369).

Root cause

The annotations were added when these functions were first introduced (before they were wired up to callers) and never cleaned up.

Impact

  • No behaviour change at runtime
  • The compiler can now enforce that these functions remain used; accidental removal would cause a compile error rather than a silent warning

Test Status

cargo check runs clean in this environment:

Checking github-guard v0.1.0 (...)
Finished `dev` profile [optimized + debuginfo] target(s) in 4.21s

No warnings. The Rust build is fully validated locally. The CI pipeline will run the full test suite.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

Remove three stale dead_code suppressions from functions that are
actively called in production:

- is_repo_private: called at 10 production sites across helpers.rs,
  response_items.rs, response_paths.rs, and tool_rules.rs
- get_issue_author_association_with_callback: called by
  get_issue_author_association (which is itself a production-used wrapper)
- get_issue_author_association: called at helpers.rs:1172

The remaining #[allow(dead_code)] on is_forked_pull_request_with_callback
(line 221) is left intentionally — that function has zero production
call sites and is test-only.

Addresses #2369 (Improvement 1).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review March 24, 2026 00:14
Copilot AI review requested due to automatic review settings March 24, 2026 00:14
@lpcox lpcox merged commit e64e824 into main Mar 24, 2026
4 checks passed
@lpcox lpcox deleted the repo-assist/fix-issue-2369-remove-stale-dead-code-backend-21a6ac15957c0dff branch March 24, 2026 00:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR cleans up stale Rust lint suppressions in rust-guard by removing #[allow(dead_code)] attributes from backend helpers that are now actively used, so the compiler can warn if they become unused again.

Changes:

  • Removed #[allow(dead_code)] from is_repo_private.
  • Removed #[allow(dead_code)] from get_issue_author_association_with_callback.
  • Removed #[allow(dead_code)] from get_issue_author_association.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: Remove stale #[allow(dead_code)] in backend.rs and eliminate superseded is_forked_pull_request_with_callback

2 participants