tree: make conflict_term_to_conflict() take a TreeValue

The function only needs the `TreeValue` so it makes more sense this
way, I think. That will also let the caller keep the rest of the
`Conflict` value owned (though there is nothing but the `value` field
in it right now).
This commit is contained in:
Martin von Zweigbergk 2023-02-17 15:24:38 -08:00 committed by Martin von Zweigbergk
parent cf672de792
commit 92f9fe5a1b

View file

@ -739,12 +739,12 @@ fn try_resolve_file_conflict(
} }
} }
fn conflict_term_to_conflict( fn tree_value_to_conflict(
store: &Store, store: &Store,
path: &RepoPath, path: &RepoPath,
term: ConflictTerm, value: TreeValue,
) -> Result<Conflict, BackendError> { ) -> Result<Conflict, BackendError> {
match term.value { match value {
TreeValue::Conflict(id) => { TreeValue::Conflict(id) => {
let conflict = store.read_conflict(path, &id)?; let conflict = store.read_conflict(path, &id)?;
Ok(conflict) Ok(conflict)
@ -798,7 +798,7 @@ fn simplify_conflict(
for term in conflict.adds { for term in conflict.adds {
match term.value { match term.value {
TreeValue::Conflict(_) => { TreeValue::Conflict(_) => {
let conflict = conflict_term_to_conflict(store, path, term)?; let conflict = tree_value_to_conflict(store, path, term.value)?;
new_removes.extend_from_slice(&conflict.removes); new_removes.extend_from_slice(&conflict.removes);
new_adds.extend_from_slice(&conflict.adds); new_adds.extend_from_slice(&conflict.adds);
} }
@ -810,7 +810,7 @@ fn simplify_conflict(
for term in conflict.removes { for term in conflict.removes {
match term.value { match term.value {
TreeValue::Conflict(_) => { TreeValue::Conflict(_) => {
let conflict = conflict_term_to_conflict(store, path, term)?; let conflict = tree_value_to_conflict(store, path, term.value)?;
new_removes.extend_from_slice(&conflict.adds); new_removes.extend_from_slice(&conflict.adds);
new_adds.extend_from_slice(&conflict.removes); new_adds.extend_from_slice(&conflict.removes);
} }