From 364f8010e787270f076ed3bd07fb233f5beba55b Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sat, 19 Mar 2022 23:42:08 -0700 Subject: [PATCH] op_heads_store: remove `Result` that never fails (#111) --- lib/src/op_heads_store.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/src/op_heads_store.rs b/lib/src/op_heads_store.rs index 0f481f73b..568496cd6 100644 --- a/lib/src/op_heads_store.rs +++ b/lib/src/op_heads_store.rs @@ -166,7 +166,7 @@ impl OpHeadsStore { return Ok(op_heads.pop().unwrap()); } - let merged_repo = merge_op_heads(repo_loader, op_heads)?.leave_unpublished(); + let merged_repo = merge_op_heads(repo_loader, op_heads).leave_unpublished(); let merge_operation = merged_repo.operation().clone(); locked_op_heads.finish(&merge_operation); // TODO: Change the return type include the repo if we have it (as we do here) @@ -190,10 +190,7 @@ impl OpHeadsStore { } } -fn merge_op_heads( - repo_loader: &RepoLoader, - mut op_heads: Vec, -) -> Result { +fn merge_op_heads(repo_loader: &RepoLoader, mut op_heads: Vec) -> UnpublishedOperation { op_heads.sort_by_key(|op| op.store_operation().metadata.end_time.timestamp.clone()); let base_repo = repo_loader.load_at(&op_heads[0]); let mut tx = base_repo.start_transaction("resolve concurrent operations"); @@ -216,5 +213,5 @@ fn merge_op_heads( // TODO: We already have the resulting View in this case but Operation cannot // keep it. Teach Operation to have a cached View so the caller won't have // to re-read it from the store (by calling Operation::view())? - Ok(tx.write()) + tx.write() }