Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

docs(dead-code): give the Rust unused_internal skip its real reason (#2390)

Raghav Chamadiya02579f30403b
diff --git a/docs/layers/DEAD_CODE.md b/docs/layers/DEAD_CODE.md
index c915aaf5b..47bc4547f 100644
--- a/docs/layers/DEAD_CODE.md
+++ b/docs/layers/DEAD_CODE.md
@@ -78,8 +78,9 @@ default `min_confidence`, so a capped finding still appears as a review
candidate and only stops claiming to be deletion-ready.
Two caveats on the numbers. `unused_internal` is disabled entirely for Rust,
-where the graph does not yet emit intra-file call edges, so a private Rust helper
-is never flagged. And the `lines` count on file and package findings is an
+because rustc's own `dead_code` lint already reports unused private items with
+macro expansion and type information this analysis cannot match, so a private
+Rust helper is never flagged here. And the `lines` count on file and package findings is an
estimate (symbol count times ten), not a real line count, so treat the
"reclaimable lines" roll-up as an order of magnitude rather than a figure.
diff --git a/packages/core/src/repowise/core/analysis/dead_code/analyzer.py b/packages/core/src/repowise/core/analysis/dead_code/analyzer.py
index 2aa5a6352..e3fd1d0c8 100644
--- a/packages/core/src/repowise/core/analysis/dead_code/analyzer.py
+++ b/packages/core/src/repowise/core/analysis/dead_code/analyzer.py
@@ -1562,9 +1562,9 @@ class DeadCodeAnalyzer:
for node, node_data in self.graph.nodes(data=True):
if node_data.get("node_type") != "symbol":
continue
- # Rust: the graph builder does not yet emit intra-file call
- # edges, so every private Rust function appears "uncalled".
- # Skip the entire language until call-edge support lands.
+ # Rust: rustc's own `dead_code` lint already reports unused
+ # private items, with the macro expansion and type information a
+ # static graph cannot match. Nothing here it would not find first.
if node_data.get("language") == "rust":
continue
# Go's call resolver now resolves same-package (sibling-file) and
diff --git a/tests/unit/analysis/test_rust_dead_code_regression.py b/tests/unit/analysis/test_rust_dead_code_regression.py
index 14264ffaf..2ff588216 100644
--- a/tests/unit/analysis/test_rust_dead_code_regression.py
+++ b/tests/unit/analysis/test_rust_dead_code_regression.py
@@ -188,9 +188,9 @@ def _build_graph(
class TestRustUnusedInternalsSkipped:
"""Private Rust symbols must not be flagged by unused_internals.
- The graph builder does not emit intra-file call edges for Rust,
- so every private function would appear 'uncalled'. Fix 1 skips
- all Rust symbols in _detect_unused_internals.
+ rustc's own `dead_code` lint already reports unused private items,
+ with macro expansion and type information this analysis cannot
+ match, so _detect_unused_internals skips all Rust symbols.
"""
def test_rust_private_function_not_flagged(self):