From b4dc105dd7d30a08038a4c844eb181ee1d8a7d0f Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 7 Oct 2022 23:47:37 -0700 Subject: [PATCH] cli: remove early return after merging operations This simplifies the control flow by having only one return (plus the implicit ones from `?`). --- src/cli_util.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cli_util.rs b/src/cli_util.rs index 5a68008bb..f79040560 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -234,8 +234,11 @@ jj init --git-repo=."; repo_loader.op_heads_store(), &self.global_args.at_operation, )?; - let repo = match op_heads { - OpHeads::Single(op) => repo_loader.load_at(&op), + let mut workspace_command = match op_heads { + OpHeads::Single(op) => { + let repo = repo_loader.load_at(&op); + self.for_loaded_repo(ui, workspace, repo)? + } OpHeads::Unresolved { locked_op_heads, op_heads, @@ -263,11 +266,9 @@ jj init --git-repo=."; let merged_repo = tx.write().leave_unpublished(); locked_op_heads.finish(merged_repo.operation()); workspace_command.repo = merged_repo; - workspace_command.snapshot(ui)?; - return Ok(workspace_command); + workspace_command } }; - let mut workspace_command = self.for_loaded_repo(ui, workspace, repo)?; workspace_command.snapshot(ui)?; Ok(workspace_command) }