summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-28 10:41:04 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-28 10:41:04 +0000
commit0ef5980e8551e1684f4c5253ede87dcad887eac1 (patch)
treeab75a3e88c9b76629b3fcc9763c5779eb5a2e1f5
parent02b5efaa3bbc043e50e2c64b968241f842c3cffc (diff)
Use both lvalue and rvalue specifier to avoid explicit std::move()
-rw-r--r--document/src/tests/documentselectparsertest.cpp8
-rw-r--r--document/src/tests/documentupdatetestcase.cpp144
-rw-r--r--document/src/tests/testxml.cpp16
-rw-r--r--document/src/vespa/document/update/fieldupdate.cpp9
-rw-r--r--document/src/vespa/document/update/fieldupdate.h3
-rw-r--r--persistence/src/vespa/persistence/conformancetest/conformancetest.cpp4
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_test.cpp18
-rw-r--r--searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp2
-rw-r--r--searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp2
-rw-r--r--storage/src/tests/distributor/externaloperationhandlertest.cpp7
-rw-r--r--storage/src/tests/distributor/twophaseupdateoperationtest.cpp8
-rw-r--r--storage/src/tests/persistence/persistencetestutils.cpp4
-rw-r--r--storage/src/tests/persistence/testandsettest.cpp2
-rw-r--r--storageapi/src/tests/mbusprot/storageprotocoltest.cpp10
15 files changed, 124 insertions, 117 deletions
diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp
index 14aec13ab60..a447df1044e 100644
--- a/document/src/tests/documentselectparsertest.cpp
+++ b/document/src/tests/documentselectparsertest.cpp
@@ -138,10 +138,10 @@ DocumentUpdate::SP DocumentSelectParserTest::createUpdate(
{
const DocumentType* type = _repo->getDocumentType(doctype);
auto doc = std::make_shared<DocumentUpdate>(*_repo, *type, DocumentId(id));
- doc->addUpdate(std::move(FieldUpdate(doc->getType().getField("headerval"))
- .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(hint)))));
- doc->addUpdate(std::move(FieldUpdate(doc->getType().getField("hstringval"))
- .addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue(hstr)))));
+ doc->addUpdate(FieldUpdate(doc->getType().getField("headerval"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(hint))));
+ doc->addUpdate(FieldUpdate(doc->getType().getField("hstringval"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue(hstr))));
return doc;
}
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp
index a6be72e53d4..beb94959e73 100644
--- a/document/src/tests/documentupdatetestcase.cpp
+++ b/document/src/tests/documentupdatetestcase.cpp
@@ -150,7 +150,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
{
Document updated(doc);
DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
- upd.addUpdate(std::move(FieldUpdate(docType->getField("intf")).addUpdate(std::make_unique<ClearValueUpdate>())));
+ upd.addUpdate(FieldUpdate(docType->getField("intf")).addUpdate(std::make_unique<ClearValueUpdate>()));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
EXPECT_FALSE(updated.getValue("intf"));
@@ -158,7 +158,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
{
Document updated(doc);
DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
- upd.addUpdate(std::move(FieldUpdate(docType->getField("intf")).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(15)))));
+ upd.addUpdate(FieldUpdate(docType->getField("intf")).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(15))));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
EXPECT_EQ(15, updated.getValue("intf")->getAsInt());
@@ -166,7 +166,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
{
Document updated(doc);
DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
- upd.addUpdate(std::move(FieldUpdate(docType->getField("intf")).addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 15))));
+ upd.addUpdate(FieldUpdate(docType->getField("intf")).addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 15)));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
EXPECT_EQ(20, updated.getValue("intf")->getAsInt());
@@ -174,7 +174,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
{
Document updated(doc);
DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
- upd.addUpdate(std::move(FieldUpdate(docType->getField("intarr")).addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(4)))));
+ upd.addUpdate(FieldUpdate(docType->getField("intarr")).addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(4))));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
std::unique_ptr<ArrayFieldValue> val(dynamic_cast<ArrayFieldValue*>(updated.getValue("intarr").release()));
@@ -184,7 +184,7 @@ TEST(DocumentUpdateTest, testSimpleUsage)
{
Document updated(doc);
DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
- upd.addUpdate(std::move(FieldUpdate(docType->getField("intarr")).addUpdate(std::make_unique<RemoveValueUpdate>(IntFieldValue(3)))));
+ upd.addUpdate(FieldUpdate(docType->getField("intarr")).addUpdate(std::make_unique<RemoveValueUpdate>(IntFieldValue(3))));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
std::unique_ptr<ArrayFieldValue> val(dynamic_cast<ArrayFieldValue*>(updated.getValue("intarr").release()));
@@ -194,8 +194,8 @@ TEST(DocumentUpdateTest, testSimpleUsage)
{
Document updated(doc);
DocumentUpdate upd(repo, *docType, DocumentId("id:ns:test::1"));
- upd.addUpdate(std::move(FieldUpdate(docType->getField("bytef"))
- .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 15))));
+ upd.addUpdate(FieldUpdate(docType->getField("bytef"))
+ .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 15)));
upd.applyTo(updated);
EXPECT_NE(doc, updated);
EXPECT_EQ(15, (int) updated.getValue("bytef")->getAsByte());
@@ -212,7 +212,7 @@ TEST(DocumentUpdateTest, testClearField)
// Apply an update.
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("headerval")).addUpdate(std::make_unique<AssignValueUpdate>())))
+ .addUpdate(FieldUpdate(doc->getField("headerval")).addUpdate(std::make_unique<AssignValueUpdate>()))
.applyTo(*doc);
EXPECT_FALSE(doc->getValue("headerval"));
}
@@ -227,7 +227,7 @@ TEST(DocumentUpdateTest, testUpdateApplySingleValue)
// Apply an update.
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("headerval")).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(9)))))
+ .addUpdate(FieldUpdate(doc->getField("headerval")).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(9))))
.applyTo(*doc);
EXPECT_EQ(9, doc->getValue("headerval")->getAsInt());
}
@@ -245,7 +245,7 @@ TEST(DocumentUpdateTest, testUpdateArray)
myarray.add(StringFieldValue("bar"));
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("tags")).addUpdate(std::make_unique<AssignValueUpdate>(myarray))))
+ .addUpdate(FieldUpdate(doc->getField("tags")).addUpdate(std::make_unique<AssignValueUpdate>(myarray)))
.applyTo(*doc);
auto fval1(doc->getAs<ArrayFieldValue>(doc->getField("tags")));
ASSERT_EQ((size_t) 2, fval1->size());
@@ -254,9 +254,9 @@ TEST(DocumentUpdateTest, testUpdateArray)
// Append array field
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("tags"))
+ .addUpdate(FieldUpdate(doc->getField("tags"))
.addUpdate(std::make_unique<AddValueUpdate>(StringFieldValue("another")))
- .addUpdate(std::make_unique<AddValueUpdate>(StringFieldValue("tag")))))
+ .addUpdate(std::make_unique<AddValueUpdate>(StringFieldValue("tag"))))
.applyTo(*doc);
std::unique_ptr<ArrayFieldValue>
fval2(doc->getAs<ArrayFieldValue>(doc->getField("tags")));
@@ -269,16 +269,16 @@ TEST(DocumentUpdateTest, testUpdateArray)
// Append single value.
ASSERT_THROW(
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("tags"))
- .addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("THROW MEH!")))))
+ .addUpdate(FieldUpdate(doc->getField("tags"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("THROW MEH!"))))
.applyTo(*doc),
std::exception) << "Expected exception when assigning a string value to an array field.";
// Remove array field.
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("tags"))
+ .addUpdate(FieldUpdate(doc->getField("tags"))
.addUpdate(std::make_unique<RemoveValueUpdate>(StringFieldValue("foo")))
- .addUpdate(std::make_unique<RemoveValueUpdate>(StringFieldValue("tag")))))
+ .addUpdate(std::make_unique<RemoveValueUpdate>(StringFieldValue("tag"))))
.applyTo(*doc);
auto fval3(doc->getAs<ArrayFieldValue>(doc->getField("tags")));
ASSERT_EQ((size_t) 2, fval3->size());
@@ -291,8 +291,8 @@ TEST(DocumentUpdateTest, testUpdateArray)
myarray2.add(StringFieldValue("bar"));
ASSERT_THROW(
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(doc->getField("tags"))
- .addUpdate(std::make_unique<RemoveValueUpdate>(myarray2))))
+ .addUpdate(FieldUpdate(doc->getField("tags"))
+ .addUpdate(std::make_unique<RemoveValueUpdate>(myarray2)))
.applyTo(*doc),
std::exception) << "Expected exception when removing an array from a string array.";
}
@@ -324,7 +324,7 @@ TEST(DocumentUpdateTest, testUpdateWeightedSet)
wset.add(StringFieldValue("foo"), 3);
wset.add(StringFieldValue("bar"), 14);
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field).addUpdate(std::make_unique<AssignValueUpdate>(wset))))
+ .addUpdate(FieldUpdate(field).addUpdate(std::make_unique<AssignValueUpdate>(wset)))
.applyTo(*doc);
auto fval1(doc->getAs<WeightedSetFieldValue>(field));
ASSERT_EQ((size_t) 2, fval1->size());
@@ -340,8 +340,8 @@ TEST(DocumentUpdateTest, testUpdateWeightedSet)
wset2.add(StringFieldValue("foo"), 16);
wset2.add(StringFieldValue("bar"), 24);
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field)
- .addUpdate(std::make_unique<AssignValueUpdate>(wset2))))
+ .addUpdate(FieldUpdate(field)
+ .addUpdate(std::make_unique<AssignValueUpdate>(wset2)))
.applyTo(*doc);
auto fval2(doc->getAs<WeightedSetFieldValue>(field));
ASSERT_EQ((size_t) 2, fval2->size());
@@ -354,9 +354,9 @@ TEST(DocumentUpdateTest, testUpdateWeightedSet)
// Append weighted field
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field)
+ .addUpdate(FieldUpdate(field)
.addUpdate(createAddUpdate("foo", 3))
- .addUpdate(createAddUpdate("too", 14))))
+ .addUpdate(createAddUpdate("too", 14)))
.applyTo(*doc);
std::unique_ptr<WeightedSetFieldValue>
fval3(doc->getAs<WeightedSetFieldValue>(field));
@@ -370,9 +370,9 @@ TEST(DocumentUpdateTest, testUpdateWeightedSet)
// Remove weighted field
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field)
+ .addUpdate(FieldUpdate(field)
.addUpdate(std::make_unique<RemoveValueUpdate>(StringFieldValue("foo")))
- .addUpdate(std::make_unique<RemoveValueUpdate>(StringFieldValue("too")))))
+ .addUpdate(std::make_unique<RemoveValueUpdate>(StringFieldValue("too"))))
.applyTo(*doc);
auto fval4(doc->getAs<WeightedSetFieldValue>(field));
ASSERT_EQ((size_t) 1, fval4->size());
@@ -418,9 +418,9 @@ WeightedSetAutoCreateFixture::WeightedSetAutoCreateFixture()
field(docType->getField("strwset")),
update(repo, *docType, DocumentId("id:ns:test::1"))
{
- update.addUpdate(std::move(FieldUpdate(field)
+ update.addUpdate(FieldUpdate(field)
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("foo"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 1)))));
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 1))));
}
} // anon ns
@@ -456,9 +456,9 @@ TEST(DocumentUpdateTest, testIncrementExistingWSetField)
TEST(DocumentUpdateTest, testIncrementWithZeroResultWeightIsRemoved)
{
WeightedSetAutoCreateFixture fixture;
- fixture.update.addUpdate(std::move(FieldUpdate(fixture.field)
+ fixture.update.addUpdate(FieldUpdate(fixture.field)
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("baz"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 0)))));
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 0))));
fixture.applyUpdateToDocument();
@@ -538,21 +538,21 @@ TEST(DocumentUpdateTest, testGenerateSerializedFile)
const DocumentType *type(repo.getDocumentType("serializetest"));
DocumentUpdate upd(repo, *type, DocumentId("id:ns:serializetest::update"));
- upd.addUpdate(std::move(FieldUpdate(type->getField("intfield"))
- .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(4)))));
- upd.addUpdate(std::move(FieldUpdate(type->getField("floatfield"))
- .addUpdate(std::make_unique<AssignValueUpdate>(FloatFieldValue(1.00f)))));
- upd.addUpdate(std::move(FieldUpdate(type->getField("arrayoffloatfield"))
+ upd.addUpdate(FieldUpdate(type->getField("intfield"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(4))));
+ upd.addUpdate(FieldUpdate(type->getField("floatfield"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(FloatFieldValue(1.00f))));
+ upd.addUpdate(FieldUpdate(type->getField("arrayoffloatfield"))
.addUpdate(std::make_unique<AddValueUpdate>(FloatFieldValue(5.00f)))
.addUpdate(std::make_unique<AddValueUpdate>(FloatFieldValue(4.23f)))
- .addUpdate(std::make_unique<AddValueUpdate>(FloatFieldValue(-1.00f)))));
- upd.addUpdate(std::move(FieldUpdate(type->getField("intfield"))
- .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 3))));
- upd.addUpdate(std::move(FieldUpdate(type->getField("wsfield"))
+ .addUpdate(std::make_unique<AddValueUpdate>(FloatFieldValue(-1.00f))));
+ upd.addUpdate(FieldUpdate(type->getField("intfield"))
+ .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 3)));
+ upd.addUpdate(FieldUpdate(type->getField("wsfield"))
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("foo"),
std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 2)))
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("foo"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Mul, 2)))));
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Mul, 2))));
nbostream buf(serializeHEAD(upd));
writeBufferToFile(buf, "data/serializeupdatecpp.dat");
}
@@ -568,8 +568,8 @@ TEST(DocumentUpdateTest, testSetBadFieldTypes)
// Assign a float value to an int field.
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
ASSERT_THROW(
- update.addUpdate(std::move(FieldUpdate(doc->getField("headerval"))
- .addUpdate(std::make_unique<AssignValueUpdate>(FloatFieldValue(4.00f))))),
+ update.addUpdate(FieldUpdate(doc->getField("headerval"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(FloatFieldValue(4.00f)))),
std::exception) << "Expected exception when adding a float to an int field.";
update.applyTo(*doc);
@@ -586,7 +586,7 @@ TEST(DocumentUpdateTest, testUpdateApplyNoParams)
EXPECT_EQ((document::FieldValue*)nullptr, doc->getValue(doc->getField("tags")).get());
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
- update.addUpdate(std::move(FieldUpdate(doc->getField("tags")).addUpdate(std::make_unique<AssignValueUpdate>())));
+ update.addUpdate(FieldUpdate(doc->getField("tags")).addUpdate(std::make_unique<AssignValueUpdate>()));
update.applyTo(*doc);
@@ -603,8 +603,8 @@ TEST(DocumentUpdateTest, testUpdateApplyNoArrayValues)
// Assign array field with no array values = empty array
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
- update.addUpdate(std::move(FieldUpdate(field)
- .addUpdate(std::make_unique<AssignValueUpdate>(ArrayFieldValue(field.getDataType())))));
+ update.addUpdate(FieldUpdate(field)
+ .addUpdate(std::make_unique<AssignValueUpdate>(ArrayFieldValue(field.getDataType()))));
update.applyTo(*doc);
@@ -624,7 +624,7 @@ TEST(DocumentUpdateTest, testUpdateArrayEmptyParamValue)
// Assign array field with no array values = empty array.
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
- update.addUpdate(std::move(FieldUpdate(field).addUpdate(std::make_unique<AssignValueUpdate>(ArrayFieldValue(field.getDataType())))));
+ update.addUpdate(FieldUpdate(field).addUpdate(std::make_unique<AssignValueUpdate>(ArrayFieldValue(field.getDataType()))));
update.applyTo(*doc);
// Verify that the field was set in the document.
@@ -634,7 +634,7 @@ TEST(DocumentUpdateTest, testUpdateArrayEmptyParamValue)
// Remove array field.
DocumentUpdate update2(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
- update2.addUpdate(std::move(FieldUpdate(field).addUpdate(std::make_unique<ClearValueUpdate>())));
+ update2.addUpdate(FieldUpdate(field).addUpdate(std::make_unique<ClearValueUpdate>()));
update2.applyTo(*doc);
// Verify that the field was cleared in the document.
@@ -652,7 +652,7 @@ TEST(DocumentUpdateTest, testUpdateWeightedSetEmptyParamValue)
// Assign weighted set with no items = empty set.
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
- update.addUpdate(std::move(FieldUpdate(field).addUpdate(std::make_unique<AssignValueUpdate>(WeightedSetFieldValue(field.getDataType())))));
+ update.addUpdate(FieldUpdate(field).addUpdate(std::make_unique<AssignValueUpdate>(WeightedSetFieldValue(field.getDataType()))));
update.applyTo(*doc);
// Verify that the field was set in the document.
@@ -662,7 +662,7 @@ TEST(DocumentUpdateTest, testUpdateWeightedSetEmptyParamValue)
// Remove weighted set field.
DocumentUpdate update2(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
- update2.addUpdate(std::move(FieldUpdate(field).addUpdate(std::make_unique<ClearValueUpdate>())));
+ update2.addUpdate(FieldUpdate(field).addUpdate(std::make_unique<ClearValueUpdate>()));
update2.applyTo(*doc);
// Verify that the field was cleared in the document.
@@ -681,9 +681,9 @@ TEST(DocumentUpdateTest, testUpdateArrayWrongSubtype)
// Assign int values to string array.
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
ASSERT_THROW(
- update.addUpdate(std::move(FieldUpdate(field)
+ update.addUpdate(FieldUpdate(field)
.addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(123)))
- .addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(456))))),
+ .addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(456)))),
std::exception) << "Expected exception when adding wrong type.";
// Apply update
@@ -705,9 +705,9 @@ TEST(DocumentUpdateTest, testUpdateWeightedSetWrongSubtype)
// Assign int values to string array.
DocumentUpdate update(docMan.getTypeRepo(), *doc->getDataType(), doc->getId());
ASSERT_THROW(
- update.addUpdate(std::move(FieldUpdate(field)
+ update.addUpdate(FieldUpdate(field)
.addUpdate(createAddUpdate(123, 1000))
- .addUpdate(createAddUpdate(456, 2000)))),
+ .addUpdate(createAddUpdate(456, 2000))),
std::exception) << "Expected exception when adding wrong type.";
// Apply update
@@ -731,29 +731,29 @@ TEST(DocumentUpdateTest, testMapValueUpdate)
doc->setValue(field2, wsval2);
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field1)
+ .addUpdate(FieldUpdate(field1)
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("banana"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 1.0)))))
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 1.0))))
.applyTo(*doc);
std::unique_ptr<WeightedSetFieldValue> fv1 =
doc->getAs<WeightedSetFieldValue>(field1);
EXPECT_EQ(0, fv1->size());
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field2)
+ .addUpdate(FieldUpdate(field2)
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("banana"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 1.0)))))
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 1.0))))
.applyTo(*doc);
auto fv2 = doc->getAs<WeightedSetFieldValue>(field2);
EXPECT_EQ(1, fv2->size());
EXPECT_EQ(fv1->find(StringFieldValue("apple")), fv1->end());
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field1).addUpdate(std::make_unique<ClearValueUpdate>())))
+ .addUpdate(FieldUpdate(field1).addUpdate(std::make_unique<ClearValueUpdate>()))
.applyTo(*doc);
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field1).addUpdate(createAddUpdate("apple", 1))))
+ .addUpdate(FieldUpdate(field1).addUpdate(createAddUpdate("apple", 1)))
.applyTo(*doc);
auto fval3(doc->getAs<WeightedSetFieldValue>(field1));
@@ -761,7 +761,7 @@ TEST(DocumentUpdateTest, testMapValueUpdate)
EXPECT_EQ(1, fval3->get(StringFieldValue("apple")));
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field2).addUpdate(createAddUpdate("apple", 1))))
+ .addUpdate(FieldUpdate(field2).addUpdate(createAddUpdate("apple", 1)))
.applyTo(*doc);
auto fval3b(doc->getAs<WeightedSetFieldValue>(field2));
@@ -769,9 +769,9 @@ TEST(DocumentUpdateTest, testMapValueUpdate)
EXPECT_EQ(1, fval3b->get(StringFieldValue("apple")));
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field1)
+ .addUpdate(FieldUpdate(field1)
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("apple"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Sub, 1.0)))))
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Sub, 1.0))))
.applyTo(*doc);
auto fv3 = doc->getAs<WeightedSetFieldValue>(field1);
@@ -779,9 +779,9 @@ TEST(DocumentUpdateTest, testMapValueUpdate)
EXPECT_EQ(0, fv3->get(StringFieldValue("apple")));
DocumentUpdate(docMan.getTypeRepo(), *doc->getDataType(), doc->getId())
- .addUpdate(std::move(FieldUpdate(field2)
+ .addUpdate(FieldUpdate(field2)
.addUpdate(std::make_unique<MapValueUpdate>(StringFieldValue("apple"),
- std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Sub, 1.0)))))
+ std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Sub, 1.0))))
.applyTo(*doc);
auto fv4 = doc->getAs<WeightedSetFieldValue>(field2);
@@ -867,7 +867,7 @@ struct TensorUpdateFixture {
void applyUpdate(std::unique_ptr<ValueUpdate> update) {
DocumentUpdate docUpdate(docMan.getTypeRepo(), *emptyDoc->getDataType(), emptyDoc->getId());
- docUpdate.addUpdate(std::move(FieldUpdate(docUpdate.getType().getField(fieldName)).addUpdate(std::move(update))));
+ docUpdate.addUpdate(FieldUpdate(docUpdate.getType().getField(fieldName)).addUpdate(std::move(update)));
docUpdate.applyTo(updatedDoc);
}
@@ -1161,14 +1161,14 @@ struct TensorUpdateSerializeFixture {
auto result = std::make_unique<DocumentUpdate>
(*repo, docType, DocumentId("id:test:test::0"));
- result->addUpdate(std::move(FieldUpdate(getField("sparse_tensor"))
+ result->addUpdate(FieldUpdate(getField("sparse_tensor"))
.addUpdate(std::make_unique<AssignValueUpdate>(*makeTensor()))
.addUpdate(std::make_unique<TensorAddUpdate>(makeTensor()))
- .addUpdate(std::make_unique<TensorRemoveUpdate>(makeTensor()))));
- result->addUpdate(std::move(FieldUpdate(getField("dense_tensor"))
+ .addUpdate(std::make_unique<TensorRemoveUpdate>(makeTensor())));
+ result->addUpdate(FieldUpdate(getField("dense_tensor"))
.addUpdate(std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operation::REPLACE, makeTensor()))
.addUpdate(std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operation::ADD, makeTensor()))
- .addUpdate(std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operation::MULTIPLY, makeTensor()))));
+ .addUpdate(std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operation::MULTIPLY, makeTensor())));
return result;
}
@@ -1249,8 +1249,8 @@ CreateIfNonExistentFixture::CreateIfNonExistentFixture()
document(docMan.createDocument()),
update(std::make_unique<DocumentUpdate>(docMan.getTypeRepo(), *document->getDataType(), document->getId()))
{
- update->addUpdate(std::move(FieldUpdate(document->getField("headerval"))
- .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(1)))));
+ update->addUpdate(FieldUpdate(document->getField("headerval"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(1))));
update->setCreateIfNonExistent(true);
}
@@ -1281,9 +1281,9 @@ ArrayUpdateFixture::ArrayUpdateFixture()
array_field(doc->getType().getField("tags")) // of type array<string>
{
update = std::make_unique<DocumentUpdate>(doc_man.getTypeRepo(), *doc->getDataType(), doc->getId());
- update->addUpdate(std::move(FieldUpdate(array_field)
+ update->addUpdate(FieldUpdate(array_field)
.addUpdate(std::make_unique<MapValueUpdate>(IntFieldValue(1),
- std::make_unique<AssignValueUpdate>(StringFieldValue("bar"))))));
+ std::make_unique<AssignValueUpdate>(StringFieldValue("bar")))));
}
ArrayUpdateFixture::~ArrayUpdateFixture() = default;
diff --git a/document/src/tests/testxml.cpp b/document/src/tests/testxml.cpp
index 71f7d0e3c38..978ab572214 100644
--- a/document/src/tests/testxml.cpp
+++ b/document/src/tests/testxml.cpp
@@ -59,17 +59,17 @@ createTestDocumentUpdate(const DocumentTypeRepo& repo)
DocumentId id("id:ns:testdoc::crawler/http://www.ntnu.no/");
auto up = std::make_unique<DocumentUpdate>(repo, *type, id);
- up->addUpdate(std::move(FieldUpdate(type->getField("intattr"))
- .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(7)))));
- up->addUpdate(std::move(FieldUpdate(type->getField("stringattr"))
- .addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("New value")))));
- up->addUpdate(std::move(FieldUpdate(type->getField("arrayattr"))
+ up->addUpdate(FieldUpdate(type->getField("intattr"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(7))));
+ up->addUpdate(FieldUpdate(type->getField("stringattr"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("New value"))));
+ up->addUpdate(FieldUpdate(type->getField("arrayattr"))
.addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(123)))
- .addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(456)))));
- up->addUpdate(std::move(FieldUpdate(type->getField("arrayattr"))
+ .addUpdate(std::make_unique<AddValueUpdate>(IntFieldValue(456))));
+ up->addUpdate(FieldUpdate(type->getField("arrayattr"))
.addUpdate(std::make_unique<RemoveValueUpdate>(IntFieldValue(123)))
.addUpdate(std::make_unique<RemoveValueUpdate>(IntFieldValue(456)))
- .addUpdate(std::make_unique<RemoveValueUpdate>(IntFieldValue(789)))));
+ .addUpdate(std::make_unique<RemoveValueUpdate>(IntFieldValue(789))));
return up;
}
diff --git a/document/src/vespa/document/update/fieldupdate.cpp b/document/src/vespa/document/update/fieldupdate.cpp
index 54d0a572bc4..9858107fc01 100644
--- a/document/src/vespa/document/update/fieldupdate.cpp
+++ b/document/src/vespa/document/update/fieldupdate.cpp
@@ -54,12 +54,19 @@ FieldUpdate::operator==(const FieldUpdate& other) const
FieldUpdate&
-FieldUpdate::addUpdate(std::unique_ptr<ValueUpdate> update) {
+FieldUpdate::addUpdate(std::unique_ptr<ValueUpdate> update) & {
update->checkCompatibility(_field); // May throw exception.
_updates.push_back(std::move(update));
return *this;
}
+FieldUpdate&&
+FieldUpdate::addUpdate(std::unique_ptr<ValueUpdate> update) && {
+ update->checkCompatibility(_field); // May throw exception.
+ _updates.push_back(std::move(update));
+ return std::move(*this);
+}
+
void
FieldUpdate::printXml(XmlOutputStream& xos) const
{
diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h
index f5902c39216..e8e83ab3e48 100644
--- a/document/src/vespa/document/update/fieldupdate.h
+++ b/document/src/vespa/document/update/fieldupdate.h
@@ -53,7 +53,8 @@ public:
* @param update A pointer to the value update to add to this.
* @return A pointer to this.
*/
- FieldUpdate& addUpdate(std::unique_ptr<ValueUpdate> update);
+ FieldUpdate& addUpdate(std::unique_ptr<ValueUpdate> update) &;
+ FieldUpdate&& addUpdate(std::unique_ptr<ValueUpdate> update) &&;
const ValueUpdate& operator[](int index) const { return *_updates[index]; }
ValueUpdate& operator[](int index) { return *_updates[index]; }
diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
index f46bdaf19f0..2a5b4b48cfa 100644
--- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
+++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
@@ -910,9 +910,7 @@ TEST_F(ConformanceTest, testUpdate)
const document::DocumentType *docType(
testDocMan.getTypeRepo().getDocumentType("testdoctype1"));
document::DocumentUpdate::SP update(new DocumentUpdate(testDocMan.getTypeRepo(), *docType, doc1->getId()));
- document::FieldUpdate fieldUpdate(docType->getField("headerval"));
- fieldUpdate.addUpdate(std::make_unique<document::AssignValueUpdate>(document::IntFieldValue(42)));
- update->addUpdate(std::move(fieldUpdate));
+ update->addUpdate(document::FieldUpdate(docType->getField("headerval")).addUpdate(std::make_unique<document::AssignValueUpdate>(document::IntFieldValue(42))));
{
UpdateResult result = spi->update(bucket, Timestamp(3), update, context);
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp
index e64045853d4..51bc60d3783 100644
--- a/searchcore/src/tests/proton/attribute/attribute_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp
@@ -482,10 +482,10 @@ TEST_F(AttributeWriterTest, handles_update)
DocBuilder idb(schema);
const document::DocumentType &dt(idb.getDocumentType());
DocumentUpdate upd(*idb.getDocumentTypeRepo(), dt, DocumentId("id:ns:searchdocument::1"));
- upd.addUpdate(std::move(FieldUpdate(upd.getType().getField("a1"))
- .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 5))));
- upd.addUpdate(std::move(FieldUpdate(upd.getType().getField("a2"))
- .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 10))));
+ upd.addUpdate(FieldUpdate(upd.getType().getField("a1"))
+ .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 5)));
+ upd.addUpdate(FieldUpdate(upd.getType().getField("a2"))
+ .addUpdate(std::make_unique<ArithmeticValueUpdate>(ArithmeticValueUpdate::Add, 10)));
DummyFieldUpdateCallback onUpdate;
update(2, upd, 1, onUpdate);
@@ -527,8 +527,8 @@ TEST_F(AttributeWriterTest, handles_predicate_update)
const document::DocumentType &dt(idb.getDocumentType());
DocumentUpdate upd(*idb.getDocumentTypeRepo(), dt, DocumentId("id:ns:searchdocument::1"));
PredicateFieldValue new_value(builder.feature("foo").value("bar").build());
- upd.addUpdate(std::move(FieldUpdate(upd.getType().getField("a1"))
- .addUpdate(std::make_unique<AssignValueUpdate>(new_value))));
+ upd.addUpdate(FieldUpdate(upd.getType().getField("a1"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(new_value)));
PredicateIndex &index = static_cast<PredicateAttribute &>(*a1).getIndex();
EXPECT_EQ(1u, index.getZeroConstraintDocs().size());
@@ -728,8 +728,8 @@ TEST_F(AttributeWriterTest, handles_tensor_assign_update)
TensorDataType xySparseTensorDataType(vespalib::eval::ValueType::from_spec(sparse_tensor));
TensorFieldValue new_value(xySparseTensorDataType);
new_value = SimpleValue::from_value(*new_tensor);
- upd.addUpdate(std::move(FieldUpdate(upd.getType().getField("a1"))
- .addUpdate(std::make_unique<AssignValueUpdate>(new_value))));
+ upd.addUpdate(FieldUpdate(upd.getType().getField("a1"))
+ .addUpdate(std::make_unique<AssignValueUpdate>(new_value)));
DummyFieldUpdateCallback onUpdate;
update(2, upd, 1, onUpdate);
EXPECT_EQ(2u, a1->getNumDocs());
@@ -938,7 +938,7 @@ public:
TensorDataType tensor_type(vespalib::eval::ValueType::from_spec(dense_tensor));
TensorFieldValue tensor_value(tensor_type);
tensor_value= SimpleValue::from_value(*tensor);
- upd->addUpdate(std::move(FieldUpdate(upd->getType().getField("a1")).addUpdate(std::make_unique<AssignValueUpdate>(tensor_value))));
+ upd->addUpdate(FieldUpdate(upd->getType().getField("a1")).addUpdate(std::make_unique<AssignValueUpdate>(tensor_value)));
return upd;
}
void expect_shared_executor_tasks(size_t exp_accepted_tasks) {
diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
index 8affdde8562..6cd92dea516 100644
--- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp
@@ -345,7 +345,7 @@ struct UpdateContext {
} else {
fieldValue->assign(document::StringFieldValue("new value"));
}
- update->addUpdate(std::move(document::FieldUpdate(field).addUpdate(std::make_unique<document::AssignValueUpdate>(*fieldValue))));
+ update->addUpdate(document::FieldUpdate(field).addUpdate(std::make_unique<document::AssignValueUpdate>(*fieldValue)));
}
};
diff --git a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
index 36920f52254..40332157a8d 100644
--- a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
+++ b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp
@@ -121,8 +121,8 @@ public:
auto makeUpdate() {
auto upd(std::make_shared<DocumentUpdate>(*_repo, _docType, docId));
- upd->addUpdate(std::move(FieldUpdate(upd->getType().getField("string")).
- addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("newval")))));
+ upd->addUpdate(FieldUpdate(upd->getType().getField("string")).
+ addUpdate(std::make_unique<AssignValueUpdate>(StringFieldValue("newval"))));
return upd;
}
auto makeDoc() {
diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp
index c8a7f3336e0..2dcf18f9da6 100644
--- a/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp
+++ b/searchcore/src/vespa/searchcore/bmcluster/bm_feed.cpp
@@ -71,7 +71,7 @@ BmFeed::make_document_update(uint32_t n, uint32_t i) const
{
auto id = make_document_id(n, i);
auto document_update = std::make_unique<DocumentUpdate>(*_repo, *_document_type, id);
- document_update->addUpdate(std::move(FieldUpdate(_field).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(15)))));
+ document_update->addUpdate(FieldUpdate(_field).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(15))));
return document_update;
}
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);
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
index 88e827dcd5f..40969455d68 100644
--- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
+++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp
@@ -34,6 +34,11 @@ using document::Document;
using document::DocumentId;
using document::DocumentType;
using document::DocumentTypeRepo;
+using document::FieldUpdate;
+using document::FieldPathUpdate;
+using document::AssignValueUpdate;
+using document::IntFieldValue;
+using document::RemoveFieldPathUpdate;
using document::test::makeDocumentBucket;
using document::test::makeBucketSpace;
using storage::lib::ClusterState;
@@ -245,10 +250,9 @@ TEST_P(StorageProtocolTest, response_metadata_is_propagated) {
TEST_P(StorageProtocolTest, update) {
auto update = std::make_shared<document::DocumentUpdate>(
_docMan.getTypeRepo(), *_testDoc->getDataType(), _testDoc->getId());
- update->addUpdate(std::move(document::FieldUpdate(_testDoc->getField("headerval")).addUpdate(std::make_unique<document::AssignValueUpdate>(document::IntFieldValue(17)))));
+ update->addUpdate(FieldUpdate(_testDoc->getField("headerval")).addUpdate(std::make_unique<AssignValueUpdate>(IntFieldValue(17))));
- update->addFieldPathUpdate(document::FieldPathUpdate::CP(
- new document::RemoveFieldPathUpdate("headerval", "testdoctype1.headerval > 0")));
+ update->addFieldPathUpdate(FieldPathUpdate::CP(new RemoveFieldPathUpdate("headerval", "testdoctype1.headerval > 0")));
auto cmd = std::make_shared<UpdateCommand>(_bucket, update, 14);
EXPECT_EQ(Timestamp(0), cmd->getOldTimestamp());