pub struct Fix {
pub range: Range<usize>,
pub replacement: String,
pub additional_edits: Vec<Fix>,
}Expand description
One atomic fix attached to a LintWarning.
range/replacement describe the primary edit. additional_edits
carries any paired edits that must apply together with the primary one
for the result to be a valid document — for example, MD054’s conversion
of an inline link to a reference style produces the in-place link rewrite
and a reference-definition append at end-of-file; applying only one
half would leave a dangling reference.
All fix consumers (the LSP code-action layer, CLI counters, the
apply_warning_fixes helper) treat the primary edit and the
additional_edits as a single unit. The field is empty by default so
rules that only need a single-location fix can keep using
Fix::new(range, replacement); only rules that need multi-location
atomicity populate it via Fix::with_additional_edits(...).
additional_edits is intentionally a flat Vec<Fix> — nesting beyond
one level isn’t needed today and would complicate the apply contract.
Apply order is “primary first, then additional in their declared order”
when offsets are non-overlapping; consumers that batch multiple fixes
across warnings still sort by range.start descending so earlier offsets
remain valid as later edits mutate the buffer.
Fields§
§range: Range<usize>§replacement: String§additional_edits: Vec<Fix>Edits applied atomically with the primary range/replacement pair.
Empty for the common single-edit case. See struct docs for semantics.