Skip to content

Commit f20e7c7

Browse files
committed
fix remaining hunks in tidy_iter too
1 parent 29f82f6 commit f20e7c7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cpp-linter/src/clang_tools/clang_format.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,8 @@ fn three_way_diff(ranges: &[RangeInclusive<u32>], tidy_diff: Diff) -> Vec<RangeI
302302
for tidy_hunk in tidy_iter {
303303
maybe_push_range(
304304
&mut joint_ranges,
305-
tidy_hunk.after.start,
306-
tidy_hunk.after.end.saturating_sub(1),
305+
tidy_hunk.after.start.saturating_add(1), // convert to 1-based line numbers
306+
tidy_hunk.after.end, // exclusive end is inclusive for 1-based line numbers
307307
);
308308
}
309309

@@ -371,7 +371,7 @@ mod tests {
371371
println!("tidy diff: {tidy_diff:#?}\ncompared to og ranges: {ranges:?}");
372372
let joint_ranges = three_way_diff(&ranges, tidy_diff);
373373
println!("joint ranges: {joint_ranges:#?}");
374-
assert_eq!(joint_ranges, vec![4..=7, 9..=10]);
374+
assert_eq!(joint_ranges, vec![4..=7, 10..=11]);
375375
}
376376

377377
#[cfg(feature = "bin")]

0 commit comments

Comments
 (0)