conflicts: avoid unnecessary cloning of conflict content

This commit is contained in:
Martin von Zweigbergk 2023-06-27 02:28:47 -07:00 committed by Martin von Zweigbergk
parent 777b786c53
commit b3946be414

View file

@ -247,11 +247,11 @@ impl Conflict<Option<TreeValue>> {
}
}
MergeHunk::Conflict(ConflictHunk { removes, adds }) => {
for (i, buf) in removes.iter().enumerate() {
removed_content[i].extend_from_slice(buf);
for (i, buf) in removes.into_iter().enumerate() {
removed_content[i].extend(buf);
}
for (i, buf) in adds.iter().enumerate() {
added_content[i].extend_from_slice(buf);
for (i, buf) in adds.into_iter().enumerate() {
added_content[i].extend(buf);
}
}
}