rustfix

Function apply_suggestions

Source
pub fn apply_suggestions(
    code: &str,
    suggestions: &[Suggestion],
) -> Result<String, Error>
Expand description

Applies multiple suggestions to the given code, handling certain conflicts automatically.

If a replacement in a suggestion exactly matches a replacement of a previously applied solution, that entire suggestion will be skipped without generating an error. This is currently done to alleviate issues like rust-lang/rust#51211, although it may be removed if that’s fixed deeper in the compiler.

The intent of this design is that the overall application process should repeatedly apply non-conflicting suggestions then rëevaluate the result, looping until either there are no more suggestions to apply or some budget is exhausted.