Add doc comments

pull/905/head
Wilfred Hughes 2025-10-13 09:39:08 +07:00
parent b666424bbd
commit aca32ba1ac
2 changed files with 8 additions and 0 deletions

@ -7,6 +7,9 @@ use crate::{
#[derive(PartialEq, Eq, Clone, Copy)]
pub(crate) enum ChangeKind<'a> {
/// This node is shallowly unchanged. For lists, this means that
/// the delimiters match, but there may still be some differences
/// in the children between LHS and RHS.
Unchanged(&'a Syntax<'a>),
ReplacedComment(&'a Syntax<'a>, &'a Syntax<'a>),
ReplacedString(&'a Syntax<'a>, &'a Syntax<'a>),

@ -130,6 +130,11 @@ fn extract_lines(hunk: &Hunk) -> Vec<(Option<LineNumber>, Option<LineNumber>)> {
relevant
}
/// If any hunks are sufficiently close that they have overlapping
/// lines, merge them.
///
/// For example, given a hunk from lines 8-10 and a hunk from lines
/// 12-15 with 5 context lines, combine the two hunks.
pub(crate) fn merge_adjacent(
hunks: &[Hunk],
opposite_to_lhs: &DftHashMap<LineNumber, DftHashSet<LineNumber>>,