mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-08 21:55:47 +00:00
conflicts: use an early return to reduce indentation
Thanks to @ilyagr for the suggestion.
This commit is contained in:
parent
f4499aa65e
commit
9907cccf37
1 changed files with 74 additions and 69 deletions
|
@ -464,7 +464,15 @@ pub fn update_conflict_from_content(
|
|||
// further down.
|
||||
let mut removed_content = vec![vec![]; conflict.removes().len()];
|
||||
let mut added_content = vec![vec![]; conflict.adds().len()];
|
||||
if let Some(hunks) = parse_conflict(content, conflict.removes().len(), conflict.adds().len()) {
|
||||
// TODO: Change to let-else once our MSRV is above 1.65
|
||||
let hunks = if let Some(hunks) =
|
||||
parse_conflict(content, conflict.removes().len(), conflict.adds().len())
|
||||
{
|
||||
hunks
|
||||
} else {
|
||||
// Either there are no conflict markers of they don't have the expected arity
|
||||
return Ok(None);
|
||||
};
|
||||
for hunk in hunks {
|
||||
match hunk {
|
||||
MergeHunk::Resolved(slice) => {
|
||||
|
@ -532,9 +540,6 @@ pub fn update_conflict_from_content(
|
|||
}
|
||||
let new_conflict_id = store.write_conflict(path, &conflict.to_backend_conflict())?;
|
||||
Ok(Some(new_conflict_id))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue