Repository navigation
refactor: remove the dead code hidden behind allow(dead_code) - #798
Merged
Merged
Conversation
This was referenced Nov 17, 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.
What
All
#[allow(dead_code)]attributes and the module-wide#[allow(dead_code, unused)]ofsrc/index/ast.rsare removed, and the compiler's answer is applied (checked on the default build, on the test targets, and with--no-default-features):read_config,write_configand the YAML agent-config path (ConfigFormat::Yaml, the YAML helpers, the install and validate branches),find_fn_generic,find_pattern_in_file,is_inside_git_repo,is_hook_installed,extract_edges,store_kg_edges,clear_kg_edges_for_file,KgEdge,McpConfig, five error variants that were never created (LlmJsonRepair,DiffTooLarge,ScannerError,HookError,Timeout), the unusedIssueTypeenum with its tests, theEdgeKind::ChildOfvariant, a no-op"declaration"arm and a leftoveredge_kindvariable in the AST extractors, and the unused re-exports ofindex::graph.#[cfg(test)]: for examplerun_rules,parse_and_run_rules,SCHEMA_VERSIONand several index helpers.extract_callsstays as the regex fallback, now compiled only without thetree-sitterfeature (it is whatextract_allcalls there).cora install --yesstays accepted (scripts may pass it) but has no effect, as before; the internal field that was never read is gone and the help anddocs/cli-reference.mdsay so.#[allow(dead_code)]pointing to decide: wire in or remove code that is written but not used (bundling engine, AstNode.parent, context stats) #792 (the file bundling engine,AstNode.parent, context stats); the one Ruby bug the removal uncovered keeps a targeted#[allow(unreachable_patterns)]pointing to fix(index): Ruby methods in modules and classes nested in modules are not indexed #791.Why
The attributes silenced the compiler, so dead code stayed, went stale and misleads readers; 524 lines are gone and the compiler reports unused code again. Removing the module-wide allow also surfaced three real problems, each in its own issue: methods inside a Ruby module are not indexed (#791), a documented but unwired bundling engine (#792), and
--no-default-featuresalready did not compile ondevelop(#793). Closes #790.Testing
cargo checkis warning-free on the default build and on the test targets;cargo test --features tree-sitter: 1543 passed, 0 failed (13 tests of the deletedIssueTypewent with it);cargo fmt --all -- --checkand clippy with-D warningsclean.cargo check --no-default-featuresfails with the same two errors as ondevelopbefore this change (build: cargo build --no-default-features does not compile, and CI does not check it #793), nothing new.index-breaking-changeuntil fix(rules): ignore callers that the same diff deletes in index-breaking-change #795 made the rule ignore callers deleted in the same diff; this PR is the real case that measured that fix.