[Repo Assist] fix(rust-guard): merge double extract_repo_info call; remove stale #[allow(dead_code)] attrs#2334
Closed
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
…ad_code attrs Fixes #2226. Change 1: response_paths.rs - merge double extract_repo_info (perf) The "get_file_contents" branch called extract_repo_info(tool_args) twice in consecutive lines, each time discarding half the returned tuple. Each call allocates three String values. Merging into one call eliminates the redundant allocation and makes this branch consistent with every other branch in the same match (list_pull_requests, list_issues, list_commits, list_releases, get_repository_tree, etc., all call extract_repo_info once). Change 2: lib.rs - remove six stale #[allow(dead_code)] annotations All six items are actively called via crate:: paths from submodules: - invoke_backend -- permissions.rs:159 - LogLevel enum -- lib.rs variant uses in log() - log_debug -- permissions.rs, labels/helpers.rs - log_info -- labels/response_items.rs, response_paths.rs, helpers.rs - log_warn -- labels/helpers.rs, labels/backend.rs - log_error -- labels/backend.rs, lib.rs The annotations were added as defensive scaffolding when the logging and backend infrastructure had no callers. Now that all label modules are wired up, the suppressions are stale noise that masks future legitimate warnings. Test Status: - cargo check --target wasm32-wasip1: clean (0 warnings, 0 errors) - WASM build (./build.sh): successful, 265 KB - Go tests: infrastructure unavailable (Go 1.25.0 toolchain not reachable) Changes are Rust-only; Go code unaffected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 22, 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.
🤖 This is an automated PR from Repo Assist.
Closes #2226.
Summary
Two small, low-risk cleanups to the Rust guard identified in issue #2226.
Change 1:
response_paths.rs— merge doubleextract_repo_infocall (perf)Task 8 – Performance: The
"get_file_contents"branch calledextract_repo_info(tool_args)twice on consecutive lines, each time discarding half the returned tuple:Each call allocates three
Stringvalues. Merging into one call eliminates the redundant allocation and makesget_file_contentsconsistent with every other branch in the samematch(list_pull_requests,list_issues,list_commits,list_releases,get_repository_tree, etc. all callextract_repo_infoexactly once).Change 2:
lib.rs— remove six stale#[allow(dead_code)]annotations (code quality)Task 10 – Take the Repository Forward: All six items are actively called via
crate::paths from submodules and therefore would never trigger the dead_code lint:pub fn invoke_backendpermissions.rs:159pub enum LogLevellog()andlog_debug/info/warn/errorfn log_debugpermissions.rs,labels/helpers.rsfn log_infolabels/response_items.rs,labels/response_paths.rs,labels/helpers.rsfn log_warnlabels/helpers.rs,labels/backend.rsfn log_errorlabels/backend.rs,lib.rsThe annotations were added as defensive scaffolding when the logging and backend infrastructure had no callers. Now that all label modules are wired up, the suppressions are stale noise that masks future legitimate dead-code warnings.
Trade-offs
Stringheap allocations on everyget_file_contentsresponse label call.Test Status
cargo check --target wasm32-wasip1./build.sh)Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.