ok/jj
1
0
Fork 0
forked from mirrors/jj

conflicts: leverage Merge::map() in materialize_merge_result()

This commit is contained in:
Martin von Zweigbergk 2023-08-31 23:36:43 -07:00 committed by Martin von Zweigbergk
parent e36237426a
commit 16c897d8b4

View file

@ -102,17 +102,8 @@ pub fn materialize_merge_result(
single_hunk: &Merge<ContentHunk>,
output: &mut dyn Write,
) -> std::io::Result<()> {
let removed_slices = single_hunk
.removes()
.iter()
.map(|hunk| hunk.0.as_slice())
.collect_vec();
let added_slices = single_hunk
.adds()
.iter()
.map(|hunk| hunk.0.as_slice())
.collect_vec();
let merge_result = files::merge(&removed_slices, &added_slices);
let slices = single_hunk.map(|content| content.0.as_slice());
let merge_result = files::merge(slices.removes(), slices.adds());
match merge_result {
MergeResult::Resolved(content) => {
output.write_all(&content.0)?;