cleanup: transition to emplace_back where possible

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I41ea0bcabe0dd71111fa96b5e1baf12d3e79d129
diff --git a/bmc/main.cpp b/bmc/main.cpp
index 5282831..031871f 100644
--- a/bmc/main.cpp
+++ b/bmc/main.cpp
@@ -136,8 +136,8 @@
 
     for (auto& config : configsFromJson)
     {
-        supportedFirmware.push_back(
-            std::move(HandlerPack(config.blobId, std::move(config.handler))));
+        supportedFirmware.emplace_back(config.blobId,
+                                       std::move(config.handler));
         actionPacks[config.blobId] = std::move(config.actions);
 
         std::fprintf(stderr, "config loaded: %s\n", config.blobId.c_str());
diff --git a/bmc/test/firmware_canhandle_unittest.cpp b/bmc/test/firmware_canhandle_unittest.cpp
index 861503c..7df4bb8 100644
--- a/bmc/test/firmware_canhandle_unittest.cpp
+++ b/bmc/test/firmware_canhandle_unittest.cpp
@@ -25,12 +25,9 @@
     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.push_back(
-        std::move(HandlerPack("bcdf", std::make_unique<ImageHandlerMock>())));
+    blobs.emplace_back(hashBlobId, std::make_unique<ImageHandlerMock>());
+    blobs.emplace_back("asdf", std::make_unique<ImageHandlerMock>());
+    blobs.emplace_back("bcdf", std::make_unique<ImageHandlerMock>());
 
     std::vector<DataHandlerPack> data;
     data.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);
diff --git a/bmc/test/firmware_commit_unittest.cpp b/bmc/test/firmware_commit_unittest.cpp
index 846aa4f..e1635e9 100644
--- a/bmc/test/firmware_commit_unittest.cpp
+++ b/bmc/test/firmware_commit_unittest.cpp
@@ -33,11 +33,11 @@
         std::unique_ptr<ImageHandlerInterface> image =
             std::make_unique<ImageHandlerMock>();
         imageMock1 = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+        blobs.emplace_back(hashBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         imageMock2 = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack("asdf", std::move(image))));
+        blobs.emplace_back("asdf", std::move(image));
 
         data.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);
     }
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);
diff --git a/bmc/test/firmware_multiplebundle_unittest.cpp b/bmc/test/firmware_multiplebundle_unittest.cpp
index ae7924f..20c63a9 100644
--- a/bmc/test/firmware_multiplebundle_unittest.cpp
+++ b/bmc/test/firmware_multiplebundle_unittest.cpp
@@ -33,16 +33,15 @@
         std::unique_ptr<ImageHandlerInterface> image =
             std::make_unique<ImageHandlerMock>();
         hashImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+        blobs.emplace_back(hashBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         staticImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(
-            std::move(HandlerPack(staticLayoutBlobId, std::move(image))));
+        blobs.emplace_back(staticLayoutBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         biosImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(biosBlobId, std::move(image))));
+        blobs.emplace_back(biosBlobId, std::move(image));
 
         std::unique_ptr<TriggerableActionInterface> bmcPrepareMock =
             std::make_unique<TriggerMock>();
diff --git a/bmc/test/firmware_open_unittest.cpp b/bmc/test/firmware_open_unittest.cpp
index ba0ac87..1eff8d3 100644
--- a/bmc/test/firmware_open_unittest.cpp
+++ b/bmc/test/firmware_open_unittest.cpp
@@ -26,10 +26,8 @@
     data.emplace_back(FirmwareFlags::UpdateFlags::lpc, nullptr);
 
     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(data), std::move(CreateActionMap("asdf")));
diff --git a/bmc/test/firmware_stat_unittest.cpp b/bmc/test/firmware_stat_unittest.cpp
index 86075bb..567472d 100644
--- a/bmc/test/firmware_stat_unittest.cpp
+++ b/bmc/test/firmware_stat_unittest.cpp
@@ -26,10 +26,8 @@
      */
 
     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>());
 
     std::vector<DataHandlerPack> data;
     data.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);
diff --git a/bmc/test/firmware_state_notyetstarted_tarball_unittest.cpp b/bmc/test/firmware_state_notyetstarted_tarball_unittest.cpp
index 32e05ef..e666395 100644
--- a/bmc/test/firmware_state_notyetstarted_tarball_unittest.cpp
+++ b/bmc/test/firmware_state_notyetstarted_tarball_unittest.cpp
@@ -26,12 +26,11 @@
         std::unique_ptr<ImageHandlerInterface> image =
             std::make_unique<ImageHandlerMock>();
         hashImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+        blobs.emplace_back(hashBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         imageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(
-            std::move(HandlerPack(ubiTarballBlobId, std::move(image))));
+        blobs.emplace_back(ubiTarballBlobId, std::move(image));
 
         std::unique_ptr<TriggerableActionInterface> verifyMock =
             std::make_unique<TriggerMock>();
diff --git a/bmc/test/firmware_unittest.hpp b/bmc/test/firmware_unittest.hpp
index 2b97d01..de41cd4 100644
--- a/bmc/test/firmware_unittest.hpp
+++ b/bmc/test/firmware_unittest.hpp
@@ -32,12 +32,11 @@
         std::unique_ptr<ImageHandlerInterface> image =
             std::make_unique<ImageHandlerMock>();
         hashImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+        blobs.emplace_back(hashBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         imageMock2 = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(
-            std::move(HandlerPack(staticLayoutBlobId, std::move(image))));
+        blobs.emplace_back(staticLayoutBlobId, std::move(image));
 
         std::unique_ptr<TriggerableActionInterface> prepareMock =
             std::make_unique<TriggerMock>();
@@ -205,11 +204,11 @@
         std::unique_ptr<ImageHandlerInterface> image =
             std::make_unique<ImageHandlerMock>();
         hashImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+        blobs.emplace_back(hashBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         imageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack("asdf", std::move(image))));
+        blobs.emplace_back("asdf", std::move(image));
 
         std::vector<DataHandlerPack> data;
         data.emplace_back(FirmwareFlags::UpdateFlags::ipmi, nullptr);
@@ -233,11 +232,11 @@
         std::unique_ptr<ImageHandlerInterface> image =
             std::make_unique<ImageHandlerMock>();
         hashImageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack(hashBlobId, std::move(image))));
+        blobs.emplace_back(hashBlobId, std::move(image));
 
         image = std::make_unique<ImageHandlerMock>();
         imageMock = reinterpret_cast<ImageHandlerMock*>(image.get());
-        blobs.push_back(std::move(HandlerPack("asdf", std::move(image))));
+        blobs.emplace_back("asdf", std::move(image));
 
         auto dataMockInstance = std::make_unique<DataHandlerMock>();
         dataMock = dataMockInstance.get();