From aca32ba1acc01048a0b13ecce726b5e00db669a5 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Mon, 13 Oct 2025 09:39:08 +0100 Subject: [PATCH] Add doc comments --- src/diff/changes.rs | 3 +++ src/display/hunks.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/diff/changes.rs b/src/diff/changes.rs index dd6028079..6d8a7d2f3 100644 --- a/src/diff/changes.rs +++ b/src/diff/changes.rs @@ -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>), diff --git a/src/display/hunks.rs b/src/display/hunks.rs index 22addc117..7841f922c 100644 --- a/src/display/hunks.rs +++ b/src/display/hunks.rs @@ -130,6 +130,11 @@ fn extract_lines(hunk: &Hunk) -> Vec<(Option, Option)> { 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>,