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::sal::RGWOIDCProvider> 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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-04-28 20:13:48 +08:00
parent f7294bca9d
commit 60daa38935

View File

@ -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