This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new eee6486a Add usage of std::move where compiler suggested (#2099)
eee6486a is described below

commit eee6486a3227ae6c3dc49e33833a3227f535b59c
Author: Yaroslav <[email protected]>
AuthorDate: Tue Feb 13 07:16:42 2024 +0200

    Add usage of std::move where compiler suggested (#2099)
---
 src/config/config_type.h | 4 ++--
 src/storage/storage.cc   | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/config/config_type.h b/src/config/config_type.h
index e2918392..d84ce1cb 100644
--- a/src/config/config_type.h
+++ b/src/config/config_type.h
@@ -137,7 +137,7 @@ class IntegerField : public ConfigField {
   }
   Status Set(const std::string &v) override {
     auto s = ParseInt<IntegerType>(v, {min_, max_});
-    if (!s.IsOK()) return s;
+    if (!s.IsOK()) return std::move(s);
     *receiver_ = s.GetValue();
     return Status::OK();
   }
@@ -164,7 +164,7 @@ class OctalField : public ConfigField {
   }
   Status Set(const std::string &v) override {
     auto s = ParseInt<int>(v, {min_, max_}, 8);
-    if (!s.IsOK()) return s;
+    if (!s.IsOK()) return std::move(s);
     *receiver_ = *s;
     return Status::OK();
   }
diff --git a/src/storage/storage.cc b/src/storage/storage.cc
index 9d74d181..a74e49d3 100644
--- a/src/storage/storage.cc
+++ b/src/storage/storage.cc
@@ -252,7 +252,7 @@ Status Storage::CreateColumnFamilies(const rocksdb::Options 
&options) {
       return Status::OK();
     }
 
-    return res;
+    return std::move(res);
   }
 
   return Status::OK();
@@ -434,7 +434,8 @@ Status Storage::RestoreFromBackup() {
   // We must reopen the backup engine every time, as the files is changed
   rocksdb::BackupEngineOptions bk_option(config_->backup_sync_dir);
   auto bes = util::BackupEngineOpen(db_->GetEnv(), bk_option);
-  if (!bes) return bes;
+  if (!bes) return std::move(bes);
+
   backup_ = std::move(*bes);
 
   auto s = backup_->RestoreDBFromLatestBackup(config_->db_dir, 
config_->db_dir);

Reply via email to