From 0042c50301d2e959e9e7487f0f4ab37cef245979 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 16 Dec 2024 13:34:26 +0100 Subject: Remove unnecessary moves --- src/buildtool/execution_api/common/common_api.cpp | 2 +- .../execution_api/execution_service/execution_server.cpp | 14 +++++++------- .../execution_service/server_implementation.cpp | 2 +- src/buildtool/execution_api/utils/rehash_utils.cpp | 4 ++-- .../serve_service/serve_server_implementation.cpp | 2 +- src/buildtool/storage/local_ac.tpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/buildtool/execution_api/common/common_api.cpp b/src/buildtool/execution_api/common/common_api.cpp index 0ad1b09b..41f71a07 100644 --- a/src/buildtool/execution_api/common/common_api.cpp +++ b/src/buildtool/execution_api/common/common_api.cpp @@ -125,7 +125,7 @@ auto CommonUploadBlobTree(BlobTreePtr const& blob_tree, // transfer size. if (not UpdateContainerAndUpload( &container, - std::move(node->Blob()), + node->Blob(), /*exception_is_fatal=*/false, [&api](ArtifactBlobContainer&& blobs) -> bool { return api.Upload(std::move(blobs), diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index d199989a..6e57fdb1 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -104,7 +104,7 @@ auto ExecutionServiceImpl::ToIExecutionAction( execution_action->SetCacheFlag( action.do_not_cache() ? IExecutionAction::CacheFlag::DoNotCacheOutput : IExecutionAction::CacheFlag::CacheOutput); - return std::move(execution_action); + return execution_action; } auto ExecutionServiceImpl::ToBazelExecuteResponse( @@ -160,7 +160,7 @@ auto ExecutionServiceImpl::ToBazelExecuteResponse( // we run the action locally, so no communication issues should happen bazel_response.mutable_status()->set_code(grpc::StatusCode::OK); - return std::move(bazel_response); + return bazel_response; } void ExecutionServiceImpl::WriteResponse( @@ -332,7 +332,7 @@ namespace { (*out_dir.mutable_tree_digest()) = ArtifactDigestFactory::ToBazel(*cas_digest); } - return std::move(out_dir); + return out_dir; } [[nodiscard]] auto ToBazelOutputSymlink(std::string path, @@ -363,7 +363,7 @@ namespace { } *(out_link.mutable_target()) = *std::move(content); - return std::move(out_link); + return out_link; } [[nodiscard]] auto ToBazelOutputFile(std::string path, @@ -419,7 +419,7 @@ namespace { result_files.Add(ToBazelOutputFile(path, info)); } } - return std::move(result); + return result; } [[nodiscard]] auto ToBazelAction(ArtifactDigest const& action_digest, @@ -454,7 +454,7 @@ namespace { fmt::format("could not retrieve input root {} from cas", input_root_digest->hash())}; } - return std::move(action); + return action; } [[nodiscard]] auto ToBazelCommand(bazel_re::Action const& action, @@ -477,6 +477,6 @@ namespace { return unexpected{fmt::format("Failed to parse command from blob {}", command_digest->hash())}; } - return std::move(c); + return c; } } // namespace diff --git a/src/buildtool/execution_api/execution_service/server_implementation.cpp b/src/buildtool/execution_api/execution_service/server_implementation.cpp index bca5ab8f..d88c12a4 100644 --- a/src/buildtool/execution_api/execution_service/server_implementation.cpp +++ b/src/buildtool/execution_api/execution_service/server_implementation.cpp @@ -85,7 +85,7 @@ auto ServerImpl::Create(std::optional interface, if (pid_file) { server.pid_file_ = std::move(*pid_file); } - return std::move(server); + return server; } auto ServerImpl::Run(gsl::not_null const& local_context, diff --git a/src/buildtool/execution_api/utils/rehash_utils.cpp b/src/buildtool/execution_api/utils/rehash_utils.cpp index ec4edf99..9e64a546 100644 --- a/src/buildtool/execution_api/utils/rehash_utils.cpp +++ b/src/buildtool/execution_api/utils/rehash_utils.cpp @@ -93,8 +93,8 @@ auto ReadRehashedDigest(ArtifactDigest const& digest, } } } - return std::move(compat_obj); // not dereferenced to assist type - // deduction in variant + return compat_obj; // not dereferenced to assist type deduction in + // variant } // no mapping file found return std::optional{std::nullopt}; diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp index 985fa191..ffe78822 100644 --- a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp +++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp @@ -98,7 +98,7 @@ auto ServeServerImpl::Create(std::optional interface, if (pid_file) { server.pid_file_ = std::move(*pid_file); } - return std::move(server); + return server; } auto ServeServerImpl::Run( diff --git a/src/buildtool/storage/local_ac.tpp b/src/buildtool/storage/local_ac.tpp index 05939746..f64f0c42 100644 --- a/src/buildtool/storage/local_ac.tpp +++ b/src/buildtool/storage/local_ac.tpp @@ -191,7 +191,7 @@ auto LocalAC::ReadAction(ArtifactDigest const& cas_key) bazel_re::ActionResult action{}; if (action.ParseFromString(*action_content)) { - return std::move(action); + return action; } return std::nullopt; } -- cgit v1.2.3