Skip to main content

apply_fixes_to_source

Function apply_fixes_to_source 

Source
pub fn apply_fixes_to_source(
    source: &str,
    warnings: &[&LintWarning],
) -> SourceFixOutcome
Expand description

Apply every safe fix from warnings to source, returning the rewritten source plus applied/failed counts.

Each warning’s patches are applied sequentially against a running document (so routes stay valid as the source mutates). A fix counts as applied only when all of its patches land; the first conflicting patch aborts that fix and counts it as failed. Unsafe fixes and warnings without a fix are ignored. An unparseable document fails every safe fix and returns the source unchanged.