use emplace where appropriate per clang-tidy
The clang-tidy warning 'modernize-use-emplace' correctly flags a
few places where emplace should be used over push.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6ca79285a87d6927e718345dc8dce0387e6b1eda
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 134ecb6..1319eca 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -259,12 +259,12 @@
parameter["DataType"] = "String";
nlohmann::json::array_t allowableValues;
- allowableValues.push_back("GracefulRestart");
- allowableValues.push_back("ForceRestart");
+ allowableValues.emplace_back("GracefulRestart");
+ allowableValues.emplace_back("ForceRestart");
parameter["AllowableValues"] = std::move(allowableValues);
nlohmann::json::array_t parameters;
- parameters.push_back(std::move(parameter));
+ parameters.emplace_back(std::move(parameter));
asyncResp->res.jsonValue["Parameters"] = std::move(parameters);
});
@@ -1992,7 +1992,7 @@
nlohmann::json::array_t managerForServers;
nlohmann::json::object_t manager;
manager["@odata.id"] = "/redfish/v1/Systems/system";
- managerForServers.push_back(std::move(manager));
+ managerForServers.emplace_back(std::move(manager));
asyncResp->res.jsonValue["Links"]["ManagerForServers"] =
std::move(managerForServers);
@@ -2026,7 +2026,7 @@
boost::urls::url chassiUrl = crow::utility::urlFromPieces(
"redfish", "v1", "Chassis", chassisId);
managerObj["@odata.id"] = chassiUrl;
- managerForChassis.push_back(std::move(managerObj));
+ managerForChassis.emplace_back(std::move(managerObj));
aRsp->res.jsonValue["Links"]["ManagerForChassis"] =
std::move(managerForChassis);
aRsp->res.jsonValue["Links"]["ManagerInChassis"]["@odata.id"] =