diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-28 10:41:04 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-03-28 10:41:04 +0000 |
commit | 0ef5980e8551e1684f4c5253ede87dcad887eac1 (patch) | |
tree | ab75a3e88c9b76629b3fcc9763c5779eb5a2e1f5 /storage | |
parent | 02b5efaa3bbc043e50e2c64b968241f842c3cffc (diff) |
Use both lvalue and rvalue specifier to avoid explicit std::move()
Diffstat (limited to 'storage')
4 files changed, 9 insertions, 12 deletions
diff --git a/storage/src/tests/distributor/externaloperationhandlertest.cpp b/storage/src/tests/distributor/externaloperationhandlertest.cpp index c7b50b69779..0e5372043ab 100644 --- a/storage/src/tests/distributor/externaloperationhandlertest.cpp +++ b/storage/src/tests/distributor/externaloperationhandlertest.cpp @@ -21,6 +21,9 @@ using document::test::makeDocumentBucket; using document::DocumentId; +using document::FieldUpdate; +using document::StringFieldValue; +using document::AssignValueUpdate; using namespace ::testing; namespace storage::distributor { @@ -594,9 +597,7 @@ TEST_F(ExternalOperationHandlerTest, non_trivial_updates_are_rejected_if_feed_is auto cmd = makeUpdateCommand("testdoctype1", "id:foo:testdoctype1::foo"); const auto* doc_type = _testDocMan.getTypeRepo().getDocumentType("testdoctype1"); - document::FieldUpdate upd(doc_type->getField("title")); - upd.addUpdate(std::make_unique<document::AssignValueUpdate>(document::StringFieldValue("new value"))); - cmd->getUpdate()->addUpdate(std::move(upd)); + cmd->getUpdate()->addUpdate(FieldUpdate(doc_type->getField("title")).addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("new value")))); ASSERT_NO_FATAL_FAILURE(start_operation_verify_rejected(std::move(cmd))); EXPECT_EQ("ReturnCode(NO_SPACE, External feed is blocked due to resource exhaustion: full disk)", diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp index df786902965..0e3ce55856b 100644 --- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp +++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp @@ -295,9 +295,7 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState, update = std::make_shared<document::DocumentUpdate>( *_repo, *_doc_type, document::DocumentId("id:ns:" + _doc_type->getName() + "::1")); - document::FieldUpdate fup(_doc_type->getField("headerval")); - fup.addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 10)); - update->addUpdate(std::move(fup)); + update->addUpdate(FieldUpdate(_doc_type->getField("headerval")).addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 10))); } else { // Create an update to a different doctype than the one returned as // part of the Get. Just a sneaky way to force an eval error. @@ -305,9 +303,7 @@ TwoPhaseUpdateOperationTest::sendUpdate(const std::string& bucketState, update = std::make_shared<document::DocumentUpdate>( *_repo, *badDocType, document::DocumentId("id:ns:" + _doc_type->getName() + "::1")); - document::FieldUpdate fup(badDocType->getField("onlyinchild")); - fup.addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 10)); - update->addUpdate(std::move(fup)); + update->addUpdate(FieldUpdate(badDocType->getField("onlyinchild")).addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 10))); } update->setCreateIfNonExistent(options._createIfNonExistent); diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp index dfb245b2a52..3812e7b85c9 100644 --- a/storage/src/tests/persistence/persistencetestutils.cpp +++ b/storage/src/tests/persistence/persistencetestutils.cpp @@ -225,7 +225,7 @@ PersistenceTestUtils::createBodyUpdate(const document::DocumentId& docId, const { const DocumentType* docType(getTypeRepo()->getDocumentType("testdoctype1")); auto update = std::make_shared<document::DocumentUpdate>(*getTypeRepo(), *docType, docId); - update->addUpdate(std::move(document::FieldUpdate(docType->getField("content")).addUpdate(std::make_unique<document::AssignValueUpdate>(updateValue)))); + update->addUpdate(document::FieldUpdate(docType->getField("content")).addUpdate(std::make_unique<document::AssignValueUpdate>(updateValue))); return update; } @@ -234,7 +234,7 @@ PersistenceTestUtils::createHeaderUpdate(const document::DocumentId& docId, cons { const DocumentType* docType(getTypeRepo()->getDocumentType("testdoctype1")); auto update = std::make_shared<document::DocumentUpdate>(*getTypeRepo(), *docType, docId); - update->addUpdate(std::move(document::FieldUpdate(docType->getField("headerval")).addUpdate(std::make_unique<document::AssignValueUpdate>(updateValue)))); + update->addUpdate(document::FieldUpdate(docType->getField("headerval")).addUpdate(std::make_unique<document::AssignValueUpdate>(updateValue))); return update; } diff --git a/storage/src/tests/persistence/testandsettest.cpp b/storage/src/tests/persistence/testandsettest.cpp index 30a9886cf44..6e5fc491941 100644 --- a/storage/src/tests/persistence/testandsettest.cpp +++ b/storage/src/tests/persistence/testandsettest.cpp @@ -159,7 +159,7 @@ std::shared_ptr<api::UpdateCommand> TestAndSetTest::conditional_update_test(bool createIfMissing, api::Timestamp updateTimestamp) { auto docUpdate = std::make_shared<document::DocumentUpdate>(_env->_testDocMan.getTypeRepo(), testDoc->getType(), testDocId); - docUpdate->addUpdate(std::move(document::FieldUpdate(testDoc->getField("content")).addUpdate(std::make_unique<document::AssignValueUpdate>(NEW_CONTENT)))); + docUpdate->addUpdate(document::FieldUpdate(testDoc->getField("content")).addUpdate(std::make_unique<document::AssignValueUpdate>(NEW_CONTENT))); docUpdate->setCreateIfNonExistent(createIfMissing); auto updateUp = std::make_unique<api::UpdateCommand>(BUCKET, docUpdate, updateTimestamp); |