Small refactoring in replace
This commit is contained in:
parent
1ae2f081b5
commit
8089e56f07
1 changed files with 2 additions and 4 deletions
|
|
@ -87,11 +87,9 @@ impl<D: DiffHook> DiffHook for Replace<D> {
|
||||||
old_len: usize,
|
old_len: usize,
|
||||||
new_index: usize,
|
new_index: usize,
|
||||||
) -> Result<(), D::Error> {
|
) -> Result<(), D::Error> {
|
||||||
if let Some((a, b, c)) = self.eq.take() {
|
self.flush_eq()?;
|
||||||
self.d.equal(a, b, c)?;
|
|
||||||
}
|
|
||||||
if let Some((del_old_index, del_old_len, del_new_index)) = self.del.take() {
|
if let Some((del_old_index, del_old_len, del_new_index)) = self.del.take() {
|
||||||
assert_eq!(old_index, del_old_index + del_old_len);
|
debug_assert_eq!(old_index, del_old_index + del_old_len);
|
||||||
self.del = Some((del_old_index, del_old_len + old_len, del_new_index));
|
self.del = Some((del_old_index, del_old_len + old_len, del_new_index));
|
||||||
} else {
|
} else {
|
||||||
self.del = Some((old_index, old_len, new_index));
|
self.del = Some((old_index, old_len, new_index));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue