Fix clang warnings regarding unnecessary std::move

main
Zhipeng Jia 9 years ago
parent 06c05495e8
commit 73b175a773
  1. 2
      db/db_log_iter_test.cc
  2. 4
      db/wal_manager.cc
  3. 4
      db/wal_manager_test.cc
  4. 8
      utilities/backupable/backupable_db.cc
  5. 4
      utilities/document/json_document.cc
  6. 2
      utilities/flashcache/flashcache.cc

@ -27,7 +27,7 @@ class DBTestXactLogIterator : public DBTestBase {
Status status = dbfull()->GetUpdatesSince(seq, &iter); Status status = dbfull()->GetUpdatesSince(seq, &iter);
EXPECT_OK(status); EXPECT_OK(status);
EXPECT_TRUE(iter->Valid()); EXPECT_TRUE(iter->Valid());
return std::move(iter); return iter;
} }
}; };

@ -329,8 +329,8 @@ Status WalManager::GetSortedWalsOfType(const std::string& path,
return s; return s;
} }
log_files.push_back(std::move(std::unique_ptr<LogFile>( log_files.push_back(std::unique_ptr<LogFile>(
new LogFileImpl(number, log_type, sequence, size_bytes)))); new LogFileImpl(number, log_type, sequence, size_bytes)));
} }
} }
CompareLogByPointer compare_log_files; CompareLogByPointer compare_log_files;

@ -95,7 +95,7 @@ class WalManagerTest : public testing::Test {
Status status = wal_manager_->GetUpdatesSince( Status status = wal_manager_->GetUpdatesSince(
seq, &iter, TransactionLogIterator::ReadOptions(), versions_.get()); seq, &iter, TransactionLogIterator::ReadOptions(), versions_.get());
EXPECT_OK(status); EXPECT_OK(status);
return std::move(iter); return iter;
} }
std::unique_ptr<MockEnv> env_; std::unique_ptr<MockEnv> env_;
@ -184,7 +184,7 @@ std::vector<std::uint64_t> ListSpecificFiles(
} }
} }
} }
return std::move(file_numbers); return file_numbers;
} }
int CountRecords(TransactionLogIterator* iter) { int CountRecords(TransactionLogIterator* iter) {

@ -521,10 +521,10 @@ Status BackupEngineImpl::Initialize() {
continue; continue;
} }
assert(backups_.find(backup_id) == backups_.end()); assert(backups_.find(backup_id) == backups_.end());
backups_.insert(std::move( backups_.insert(
std::make_pair(backup_id, unique_ptr<BackupMeta>(new BackupMeta( std::make_pair(backup_id, unique_ptr<BackupMeta>(new BackupMeta(
GetBackupMetaFile(backup_id), GetBackupMetaFile(backup_id),
&backuped_file_infos_, backup_env_))))); &backuped_file_infos_, backup_env_))));
} }
latest_backup_id_ = 0; latest_backup_id_ = 0;
@ -619,10 +619,10 @@ Status BackupEngineImpl::CreateNewBackup(
BackupID new_backup_id = latest_backup_id_ + 1; BackupID new_backup_id = latest_backup_id_ + 1;
assert(backups_.find(new_backup_id) == backups_.end()); assert(backups_.find(new_backup_id) == backups_.end());
auto ret = backups_.insert(std::move( auto ret = backups_.insert(
std::make_pair(new_backup_id, unique_ptr<BackupMeta>(new BackupMeta( std::make_pair(new_backup_id, unique_ptr<BackupMeta>(new BackupMeta(
GetBackupMetaFile(new_backup_id), GetBackupMetaFile(new_backup_id),
&backuped_file_infos_, backup_env_))))); &backuped_file_infos_, backup_env_))));
assert(ret.second == true); assert(ret.second == true);
auto& new_backup = ret.first->second; auto& new_backup = ret.first->second;
new_backup->RecordTimestamp(); new_backup->RecordTimestamp();

@ -307,7 +307,7 @@ JSONDocument JSONDocument::operator[](const std::string& key) const {
assert(foundValue != nullptr); assert(foundValue != nullptr);
// No need to save paths in const objects // No need to save paths in const objects
JSONDocument ans(foundValue, false); JSONDocument ans(foundValue, false);
return std::move(ans); return ans;
} }
size_t JSONDocument::Count() const { size_t JSONDocument::Count() const {
@ -330,7 +330,7 @@ JSONDocument JSONDocument::operator[](size_t i) const {
auto arrayVal = reinterpret_cast<fbson::ArrayVal*>(value_); auto arrayVal = reinterpret_cast<fbson::ArrayVal*>(value_);
auto foundValue = arrayVal->get(static_cast<int>(i)); auto foundValue = arrayVal->get(static_cast<int>(i));
JSONDocument ans(foundValue, false); JSONDocument ans(foundValue, false);
return std::move(ans); return ans;
} }
bool JSONDocument::IsNull() const { bool JSONDocument::IsNull() const {

@ -103,7 +103,7 @@ class FlashcacheAwareEnv : public EnvWrapper {
std::unique_ptr<Env> NewFlashcacheAwareEnv(Env* base, std::unique_ptr<Env> NewFlashcacheAwareEnv(Env* base,
const int cachedev_fd) { const int cachedev_fd) {
std::unique_ptr<Env> ret(new FlashcacheAwareEnv(base, cachedev_fd)); std::unique_ptr<Env> ret(new FlashcacheAwareEnv(base, cachedev_fd));
return std::move(ret); return ret;
} }
int FlashcacheBlacklistCurrentThread(Env* flashcache_aware_env) { int FlashcacheBlacklistCurrentThread(Env* flashcache_aware_env) {

Loading…
Cancel
Save