]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rgw_rest_sts: return local variable w/o std::move() 41063/head
authorKefu Chai <kchai@redhat.com>
Wed, 28 Apr 2021 12:13:48 +0000 (20:13 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 28 Apr 2021 12:16:01 +0000 (20:16 +0800)
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>
src/rgw/rgw_rest_sts.cc

index 986afefdc70e27e9836744431c24d875042e9387..790d59c360c0fc594c0787c1521821ecb787dc06 100644 (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