Skip to main content

Module phantom_modules

Module phantom_modules 

Source
Expand description

Detects “phantom” module declarations — mod NAME; lines whose target is never used anywhere else in the workspace. Complements the find_dead_code_v2 file-level pass: that one flags files with no importers in the import graph, this one catches the prerequisite step (a mod line that should never have been written or that survives a deletion cascade).

Heuristic, not authoritative — pub mod declarations are still reported because re-export patterns (pub use foo::*) can keep them useful, but a private mod foo; with no use references on the parent symbol path is almost always cleanup-eligible.

Structs§

PhantomModuleEntry

Functions§

find_phantom_modules
Finds Rust mod NAME; declarations whose NAME does not appear as a path segment anywhere else in the workspace.