Skip to main content

neighbourhood_agrees

Function neighbourhood_agrees 

Source
fn neighbourhood_agrees<'a>(
    anchor: &ReviewAnchor,
    line_idx: usize,
    len: usize,
    line_at: impl Fn(usize) -> Option<&'a str>,
) -> bool
Expand description

Whether the code around line_idx still looks like where the comment was left. Each side the candidate has neighbours on must carry one of the anchor’s recorded lines within CONTEXT_RADIUS, in any order. A line on its own matches far too easily - a closing brace, a short call - so a neighbour has to agree. One implementation over any line-addressable slice, so the hunk resolver and the seat-tree one cannot drift.