From 5baab75fd2ae62b6f6407991922fe234f9e73c88 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 26 Sep 2024 14:20:16 +0200 Subject: Fix redundant std::optional conversions ...proposed by clang-tidy. Enable bugprone-optional-value-conversion check. --- src/other_tools/git_operations/git_operations.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/other_tools/git_operations/git_operations.cpp') diff --git a/src/other_tools/git_operations/git_operations.cpp b/src/other_tools/git_operations/git_operations.cpp index 5135743f..be6d9ce1 100644 --- a/src/other_tools/git_operations/git_operations.cpp +++ b/src/other_tools/git_operations/git_operations.cpp @@ -63,7 +63,7 @@ auto CriticalGitOps::GitInitialCommit(GitOpParams const& crit_op_params, return {.git_cas = nullptr, .result = std::nullopt}; } // success - return {.git_cas = git_repo->GetGitCAS(), .result = commit_hash.value()}; + return {.git_cas = git_repo->GetGitCAS(), .result = std::move(commit_hash)}; } auto CriticalGitOps::GitEnsureInit(GitOpParams const& crit_op_params, @@ -132,7 +132,7 @@ auto CriticalGitOps::GitKeepTag(GitOpParams const& crit_op_params, return {.git_cas = nullptr, .result = std::nullopt}; } // success - return {.git_cas = git_repo->GetGitCAS(), .result = *tag_result}; + return {.git_cas = git_repo->GetGitCAS(), .result = std::move(tag_result)}; } auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params, @@ -165,7 +165,7 @@ auto CriticalGitOps::GitGetHeadId(GitOpParams const& crit_op_params, return {.git_cas = nullptr, .result = std::nullopt}; } // success - return {.git_cas = git_repo->GetGitCAS(), .result = *head_commit}; + return {.git_cas = git_repo->GetGitCAS(), .result = std::move(head_commit)}; } auto CriticalGitOps::GitKeepTree(GitOpParams const& crit_op_params, @@ -208,5 +208,5 @@ auto CriticalGitOps::GitKeepTree(GitOpParams const& crit_op_params, return {.git_cas = nullptr, .result = std::nullopt}; } // success - return {.git_cas = git_repo->GetGitCAS(), .result = *tag_result}; + return {.git_cas = git_repo->GetGitCAS(), .result = std::move(tag_result)}; } -- cgit v1.2.3