Skip to main content

locate_replacement

Function locate_replacement 

Source
pub(crate) fn locate_replacement(
    source: &str,
    primary_range: &Range<usize>,
    needle: &str,
) -> Range<usize>
Expand description

Find the byte range of needle to replace.

Prefer the primary annotation range when its content matches needle; otherwise fall back to a whole-word search of the source so the patch still lands somewhere reasonable for variants whose locator returned a less specific span.