cleanup: transition to emplace_back where possible
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I41ea0bcabe0dd71111fa96b5e1baf12d3e79d129
diff --git a/bmc/test/firmware_handler_unittest.cpp b/bmc/test/firmware_handler_unittest.cpp
index b886a01..50d6b80 100644
--- a/bmc/test/firmware_handler_unittest.cpp
+++ b/bmc/test/firmware_handler_unittest.cpp
@@ -31,10 +31,8 @@
ImageHandlerMock imageMock;
std::vector<HandlerPack> blobs;
- blobs.push_back(std::move(
- HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
- blobs.push_back(
- std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
+ blobs.emplace_back(hashBlobId, std::make_unique<ImageHandlerMock>());
+ blobs.emplace_back("asdf", std::make_unique<ImageHandlerMock>());
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
std::move(blobs), std::move(std::vector<DataHandlerPack>()),
@@ -50,10 +48,8 @@
data.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);
std::vector<HandlerPack> blobs;
- blobs.push_back(
- std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
- blobs.push_back(std::move(
- HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
+ blobs.emplace_back("asdf", std::make_unique<ImageHandlerMock>());
+ blobs.emplace_back(hashBlobId, std::make_unique<ImageHandlerMock>());
ActionMap emptyMap;
@@ -73,8 +69,7 @@
* -- tested in a different test.
*/
std::vector<HandlerPack> blobs;
- blobs.push_back(std::move(
- HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
+ blobs.emplace_back(hashBlobId, std::make_unique<ImageHandlerMock>());
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
std::move(blobs), std::move(data), std::move(CreateActionMap("asdf")));
@@ -82,10 +77,8 @@
/* Add second firmware and it'll now work. */
std::vector<HandlerPack> blobs2;
- blobs2.push_back(std::move(
- HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
- blobs2.push_back(
- std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
+ blobs2.emplace_back(hashBlobId, std::make_unique<ImageHandlerMock>());
+ blobs2.emplace_back("asdf", std::make_unique<ImageHandlerMock>());
std::vector<DataHandlerPack> data2;
data2.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);
@@ -105,18 +98,15 @@
/* This works fine only if you also pass in the hash handler. */
std::vector<HandlerPack> blobs;
- blobs.push_back(
- std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
+ blobs.emplace_back("asdf", std::make_unique<ImageHandlerMock>());
auto handler = FirmwareBlobHandler::CreateFirmwareBlobHandler(
std::move(blobs), std::move(data), std::move(CreateActionMap("asdf")));
EXPECT_EQ(handler, nullptr);
std::vector<HandlerPack> blobs2;
- blobs2.push_back(
- std::move(HandlerPack("asdf", std::make_unique<ImageHandlerMock>())));
- blobs2.push_back(std::move(
- HandlerPack(hashBlobId, std::make_unique<ImageHandlerMock>())));
+ blobs2.emplace_back("asdf", std::make_unique<ImageHandlerMock>());
+ blobs2.emplace_back(hashBlobId, std::make_unique<ImageHandlerMock>());
std::vector<DataHandlerPack> data2;
data2.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);