From 60daa3893565c6bd69ec373c2d29e3a959ea6702 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 28 Apr 2021 20:13:48 +0800 Subject: [PATCH] rgw/rgw_rest_sts: return local variable w/o std::move() in C++17, the C++ standard ensures that the return value in this case can be optimized with copy elision, adding std::move() is not necessary, and prevents copy elision from happening. this change also silences the warning of: ../src/rgw/rgw_rest_sts.cc: In member function 'std::unique_ptr rgw::auth::sts::WebTokenEngine::get_provider(const DoutPrefixProvider*, const string&, const string&) const': ../src/rgw/rgw_rest_sts.cc:92:19: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] 92 | return std::move(provider); | ~~~~~~~~~^~~~~~~~~~ ../src/rgw/rgw_rest_sts.cc:92:19: note: remove 'std::move' call Signed-off-by: Kefu Chai --- src/rgw/rgw_rest_sts.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rgw/rgw_rest_sts.cc b/src/rgw/rgw_rest_sts.cc index 986afefdc70e..790d59c360c0 100644 --- a/src/rgw/rgw_rest_sts.cc +++ b/src/rgw/rgw_rest_sts.cc @@ -89,7 +89,7 @@ WebTokenEngine::get_provider(const DoutPrefixProvider *dpp, const string& role_a if (ret < 0) { return nullptr; } - return std::move(provider); + return provider; } bool -- 2.47.3