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,
|
||||
new_index: usize,
|
||||
) -> Result<(), D::Error> {
|
||||
if let Some((a, b, c)) = self.eq.take() {
|
||||
self.d.equal(a, b, c)?;
|
||||
}
|
||||
self.flush_eq()?;
|
||||
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));
|
||||
} else {
|
||||
self.del = Some((old_index, old_len, new_index));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue