Skip to main content

retain_introduced_dead_code

Function retain_introduced_dead_code 

Source
pub fn retain_introduced_dead_code(
    results: &mut AnalysisResults,
    root: &Path,
    base: Option<&FxHashSet<String>>,
)
Expand description

Retain only findings whose audit key was NOT present in base (i.e. was introduced on the current branch).

When base is None (no baseline), all findings are kept.

This destructure is deliberately exhaustive: adding a field to AnalysisResults must fail compilation here so the author decides explicitly whether the new finding type needs an introduced-retain (add a retain block) or has no key representation today (bind with underscore and document why).

Sibling exhaustive sites: fallow_engine::changed_files::filter_results_by_changed_files, dead_code_keys, retain_introduced_dead_code. Non-exhaustive siblings the compiler will NOT flag (wire manually when a finding type is added): annotate_dead_code_json (same key formats, this file) and the per-collection severity branches in crates/cli/src/check/rules.rs (apply_rules, has_error_severity_issues). TypeScript mirror: editors/vscode/scripts/codegen-contracts.mjs derives backwards-compatible aliases from fallow schema ts_alias rows.