diff options
author | Aleksey Kladov <[email protected]> | 2020-06-27 20:35:52 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-27 20:35:52 +0100 |
commit | 3c1714d76d01b513a2e31fbeae14feca438515fa (patch) | |
tree | 08dba8aca8fa2b0099a13517469720cf073771a4 | |
parent | 53787c7eba71d91811c6519a1186755787dcd204 (diff) |
Fix potential overflow
-rw-r--r-- | crates/expect/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/expect/src/lib.rs b/crates/expect/src/lib.rs index aa95a88c5..dd7b96aab 100644 --- a/crates/expect/src/lib.rs +++ b/crates/expect/src/lib.rs | |||
@@ -188,8 +188,8 @@ impl Patchwork { | |||
188 | .fold((0usize, 0usize), |(x1, y1), (x2, y2)| (x1 + x2, y1 + y2)); | 188 | .fold((0usize, 0usize), |(x1, y1), (x2, y2)| (x1 + x2, y1 + y2)); |
189 | 189 | ||
190 | for pos in &mut [&mut range.start, &mut range.end] { | 190 | for pos in &mut [&mut range.start, &mut range.end] { |
191 | **pos -= delete; | ||
191 | **pos += insert; | 192 | **pos += insert; |
192 | **pos -= delete | ||
193 | } | 193 | } |
194 | 194 | ||
195 | self.text.replace_range(range, &patch); | 195 | self.text.replace_range(range, &patch); |