Conversation
…tr, extract resolve_search_scope Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/27593cdd-ca89-4263-8b3b-ab102d27c749
Copilot
AI
changed the title
[WIP] Remove dead
rust-guard: remove dead Mar 24, 2026
is_owner and obsolete #[allow(dead_code)] annotationsis_owner, strip stale #[allow(dead_code)] on get_nested_str, extract resolve_search_scope
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs small maintainability cleanups in the Rust guard labeling logic by removing truly unused code/annotations and de-duplicating search-scope resolution in apply_tool_labels.
Changes:
- Added a private
resolve_search_scope()helper intool_rules.rsand used it for bothsearch_issuesandsearch_pull_requests. - Removed a stale
#[allow(dead_code)]fromget_nested_str(it’s used in non-test code) and deleted the unusedis_ownerhelper. - Updated
labels/README.mdto removeis_ownerfrom the documented helper list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Extracts and reuses search repo-scope resolution logic for consistent labeling behavior. |
| guards/github-guard/rust-guard/src/labels/helpers.rs | Removes unused is_owner and corrects dead-code annotations based on actual usage. |
| guards/github-guard/rust-guard/src/labels/README.md | Updates module documentation to match the helper set after cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4 tasks
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.
Two cleanups in the Rust guard: stale dead-code annotations and duplicated search-scope resolution logic in
tool_rules.rs.helpers.rsis_owner— zero callers anywhere in the codebase#[allow(dead_code)]fromget_nested_str— it's used in production (extract_author_login) and exported; the annotation was incorrect#[allow(dead_code)]onis_bot— only called from#[cfg(test)]code; as acdylibcrate, Rust treats it as dead in production builds and the annotation is still needed for a warning-free buildlabels/README.mdto dropis_ownerfrom the user classification listtool_rules.rsExtracted a private
resolve_search_scopehelper to eliminate the identical 12-line scope-resolution block duplicated acrosssearch_issuesandsearch_pull_requests:Both match arms now delegate to this helper; only the
descformat string differs between them.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build10436897/b333/launcher.test /tmp/go-build10436897/b333/launcher.test -test.testlogfile=/tmp/go-build10436897/b333/testlog.txt -test.paniconexit0 -test.timeout=10m0s -goversion go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build10436897/b321/importcfg -pack /tmp/go-build10436897/b321/_testmain.go go_.�� lcache/go/1.25.8/x64=/_/GOROOT rg x_amd64/vet bug/deps/rustcbn/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link bug/deps/github_-o bug/deps/github_/tmp/go-build10436897/b321/rules.test x_amd64/vet(dns block)https://api.github.com/graphql/usr/bin/gh gh issue close 2430 --comment Resolved in this PR: removed deadis_ownerfunction, stripped the stale#[allow(dead_code)]fromget_nested_str(which is used in production), and extracted aresolve_search_scopehelper to eliminate the duplicated search-scope resolution logic in ore-10e2da29e93378c1/build_script_build-10e2da29e93378c1 lib/rustlib/x86_64-REDACTED-linux-gnu/bin/rust-lld ug/build/serde-3rustc -I 64/pkg/tool/linu--edition=2021 lib/rustlib/x86_--crate-name=proc_macro2 lib/�� lib/rustlib/x86_--cap-lints=allow lib/rustlib/x86_--emit=dep-info,metadata lib/rustlib/x86_--out-dir lib/rustlib/x86_git lib/rustlib/x86_checkout lib/rustlib/x86_copilot/rust-guard-remove-dead-code lib/rustlib/x86_x86_64-REDACTED-linux-gnu(http block)invalid-host-that-does-not-exist-12345.com/tmp/go-build10436897/b318/config.test /tmp/go-build10436897/b318/config.test -test.testlogfile=/tmp/go-build10436897/b318/testlog.txt -test.paniconexit0 -test.timeout=10m0s ortc�� g_.a 64/src/crypto/ecdh/ecdh.go u/13/cc1 guard-d6a03f414d/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet nal guard-d6a03f414d-unreachable=false u/13/cc1 guar�� UuTnnb-7k guard-d6a03f414dc506a0.2cvaxrr0e-nolocalimports x_amd64/vet guard-d6a03f414d/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet guard-d6a03f414d-unsafeptr=false bug/build/serde--unreachable=false x_amd64/vet(dns block)nonexistent.local/tmp/go-build10436897/b333/launcher.test /tmp/go-build10436897/b333/launcher.test -test.testlogfile=/tmp/go-build10436897/b333/testlog.txt -test.paniconexit0 -test.timeout=10m0s -goversion go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build10436897/b321/importcfg -pack /tmp/go-build10436897/b321/_testmain.go go_.�� lcache/go/1.25.8/x64=/_/GOROOT rg x_amd64/vet bug/deps/rustcbn/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link bug/deps/github_-o bug/deps/github_/tmp/go-build10436897/b321/rules.test x_amd64/vet(dns block)slow.example.com/tmp/go-build10436897/b333/launcher.test /tmp/go-build10436897/b333/launcher.test -test.testlogfile=/tmp/go-build10436897/b333/testlog.txt -test.paniconexit0 -test.timeout=10m0s -goversion go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build10436897/b321/importcfg -pack /tmp/go-build10436897/b321/_testmain.go go_.�� lcache/go/1.25.8/x64=/_/GOROOT rg x_amd64/vet bug/deps/rustcbn/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link bug/deps/github_-o bug/deps/github_/tmp/go-build10436897/b321/rules.test x_amd64/vet(dns block)this-host-does-not-exist-12345.com/tmp/go-build10436897/b342/mcp.test /tmp/go-build10436897/b342/mcp.test -test.testlogfile=/tmp/go-build10436897/b342/testlog.txt -test.paniconexit0 -test.timeout=10m0s go_.�� 64/src/net -trimpath x_amd64/vet -p ions =0 x_amd64/vet swit�� /tmp/go-build396go1.25.8 0626853/b151/ x_amd64/vet -p crypto/internal//usr/bin/runc -lang=go1.25 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.