Skip to main content

detect_dead_code

Function detect_dead_code 

Source
pub fn detect_dead_code(
    workspace_index: &WorkspaceIndex,
    document_uri: &str,
    source_text: &str,
    line_index: &LineStartsCache,
) -> Vec<Diagnostic>
Expand description

Detect dead code using workspace-wide symbol analysis

Identifies unused symbols (subroutines, variables, constants, packages) that have no references in the workspace. Returns diagnostics for symbols in the specified document.

§Arguments

  • workspace_index - Workspace-wide symbol index
  • document_uri - URI of the document to generate diagnostics for
  • source_text - The source text of the document (for position conversion)
  • line_index - Line index helper for position conversion

§Returns

Dead code diagnostics for symbols in the specified document