Skip to content

Commit 3c1714d

Browse files
committed
Fix potential overflow
1 parent 53787c7 commit 3c1714d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/expect/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ impl Patchwork {
188188
.fold((0usize, 0usize), |(x1, y1), (x2, y2)| (x1 + x2, y1 + y2));
189189

190190
for pos in &mut [&mut range.start, &mut range.end] {
191+
**pos -= delete;
191192
**pos += insert;
192-
**pos -= delete
193193
}
194194

195195
self.text.replace_range(range, &patch);

0 commit comments

Comments
 (0)