Improve perf
This commit is contained in:
parent
10e2f1a3b9
commit
ef629e7883
1 changed files with 9 additions and 6 deletions
|
|
@ -61,14 +61,17 @@ where
|
||||||
);
|
);
|
||||||
|
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
(RawOperation::Insert(self_tokens), RawOperation::Insert(other_tokens)) => {
|
(RawOperation::Insert(mut tokens1), RawOperation::Insert(tokens2)) => {
|
||||||
RawOperation::Insert(self_tokens.into_iter().chain(other_tokens).collect())
|
tokens1.extend(tokens2);
|
||||||
|
RawOperation::Insert(tokens1)
|
||||||
}
|
}
|
||||||
(RawOperation::Delete(tokens1), RawOperation::Delete(tokens2)) => {
|
(RawOperation::Delete(mut tokens1), RawOperation::Delete(tokens2)) => {
|
||||||
RawOperation::Delete(tokens1.into_iter().chain(tokens2).collect())
|
tokens1.extend(tokens2);
|
||||||
|
RawOperation::Delete(tokens1)
|
||||||
}
|
}
|
||||||
(RawOperation::Equal(tokens1), RawOperation::Equal(tokens2)) => {
|
(RawOperation::Equal(mut tokens1), RawOperation::Equal(tokens2)) => {
|
||||||
RawOperation::Equal(tokens1.into_iter().chain(tokens2).collect())
|
tokens1.extend(tokens2);
|
||||||
|
RawOperation::Equal(tokens1)
|
||||||
}
|
}
|
||||||
_ => unreachable!("Only operations of the same type can be extended"),
|
_ => unreachable!("Only operations of the same type can be extended"),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue