clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version.  The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index 31cd1f9..7905885 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -79,18 +79,18 @@
         [asyncResp, chassisId](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreePathsResponse& subtreePaths) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR("DBUS response error{}", ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR("DBUS response error{}", ec.value());
+                    messages::internalError(asyncResp->res);
+                }
+                return;
             }
-            return;
-        }
 
-        updatePowerSupplyList(asyncResp, chassisId, subtreePaths);
-    });
+            updatePowerSupplyList(asyncResp, chassisId, subtreePaths);
+        });
 }
 
 inline void handlePowerSupplyCollectionHead(
@@ -107,15 +107,16 @@
         asyncResp, chassisId,
         [asyncResp,
          chassisId](const std::optional<std::string>& validChassisPath) {
-        if (!validChassisPath)
-        {
-            messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
-            return;
-        }
-        asyncResp->res.addHeader(
-            boost::beast::http::field::link,
-            "</redfish/v1/JsonSchemas/PowerSupplyCollection/PowerSupplyCollection.json>; rel=describedby");
-    });
+            if (!validChassisPath)
+            {
+                messages::resourceNotFound(asyncResp->res, "Chassis",
+                                           chassisId);
+                return;
+            }
+            asyncResp->res.addHeader(
+                boost::beast::http::field::link,
+                "</redfish/v1/JsonSchemas/PowerSupplyCollection/PowerSupplyCollection.json>; rel=describedby");
+        });
 }
 
 inline void handlePowerSupplyCollectionGet(
@@ -168,38 +169,38 @@
         [asyncResp, powerSupplyId, callback{std::move(callback)}](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreePathsResponse& subtreePaths) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR(
-                    "DBUS response error for getAssociatedSubTreePaths{}",
-                    ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR(
+                        "DBUS response error for getAssociatedSubTreePaths{}",
+                        ec.value());
+                    messages::internalError(asyncResp->res);
+                    return;
+                }
+                messages::resourceNotFound(asyncResp->res, "PowerSupplies",
+                                           powerSupplyId);
                 return;
             }
-            messages::resourceNotFound(asyncResp->res, "PowerSupplies",
-                                       powerSupplyId);
-            return;
-        }
 
-        for (const std::string& path : subtreePaths)
-        {
-            if (checkPowerSupplyId(path, powerSupplyId))
+            for (const std::string& path : subtreePaths)
             {
-                callback(path);
+                if (checkPowerSupplyId(path, powerSupplyId))
+                {
+                    callback(path);
+                    return;
+                }
+            }
+
+            if (!subtreePaths.empty())
+            {
+                BMCWEB_LOG_WARNING("Power supply not found: {}", powerSupplyId);
+                messages::resourceNotFound(asyncResp->res, "PowerSupplies",
+                                           powerSupplyId);
                 return;
             }
-        }
-
-        if (!subtreePaths.empty())
-        {
-            BMCWEB_LOG_WARNING("Power supply not found: {}", powerSupplyId);
-            messages::resourceNotFound(asyncResp->res, "PowerSupplies",
-                                       powerSupplyId);
-            return;
-        }
-    });
+        });
 }
 
 inline void
@@ -210,23 +211,23 @@
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.Inventory.Item", "Present",
         [asyncResp](const boost::system::error_code& ec, const bool value) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR("DBUS response error for State {}",
-                                 ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR("DBUS response error for State {}",
+                                     ec.value());
+                    messages::internalError(asyncResp->res);
+                }
+                return;
             }
-            return;
-        }
 
-        if (!value)
-        {
-            asyncResp->res.jsonValue["Status"]["State"] =
-                resource::State::Absent;
-        }
-    });
+            if (!value)
+            {
+                asyncResp->res.jsonValue["Status"]["State"] =
+                    resource::State::Absent;
+            }
+        });
 }
 
 inline void
@@ -237,23 +238,23 @@
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
         [asyncResp](const boost::system::error_code& ec, const bool value) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR("DBUS response error for Health {}",
-                                 ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+                                     ec.value());
+                    messages::internalError(asyncResp->res);
+                }
+                return;
             }
-            return;
-        }
 
-        if (!value)
-        {
-            asyncResp->res.jsonValue["Status"]["Health"] =
-                resource::Health::Critical;
-        }
-    });
+            if (!value)
+            {
+                asyncResp->res.jsonValue["Status"]["Health"] =
+                    resource::Health::Critical;
+            }
+        });
 }
 
 inline void
@@ -265,60 +266,61 @@
         "xyz.openbmc_project.Inventory.Decorator.Asset",
         [asyncResp](const boost::system::error_code& ec,
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR("DBUS response error for Asset {}",
-                                 ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR("DBUS response error for Asset {}",
+                                     ec.value());
+                    messages::internalError(asyncResp->res);
+                }
+                return;
             }
-            return;
-        }
 
-        const std::string* partNumber = nullptr;
-        const std::string* serialNumber = nullptr;
-        const std::string* manufacturer = nullptr;
-        const std::string* model = nullptr;
-        const std::string* sparePartNumber = nullptr;
+            const std::string* partNumber = nullptr;
+            const std::string* serialNumber = nullptr;
+            const std::string* manufacturer = nullptr;
+            const std::string* model = nullptr;
+            const std::string* sparePartNumber = nullptr;
 
-        const bool success = sdbusplus::unpackPropertiesNoThrow(
-            dbus_utils::UnpackErrorPrinter(), propertiesList, "PartNumber",
-            partNumber, "SerialNumber", serialNumber, "Manufacturer",
-            manufacturer, "Model", model, "SparePartNumber", sparePartNumber);
+            const bool success = sdbusplus::unpackPropertiesNoThrow(
+                dbus_utils::UnpackErrorPrinter(), propertiesList, "PartNumber",
+                partNumber, "SerialNumber", serialNumber, "Manufacturer",
+                manufacturer, "Model", model, "SparePartNumber",
+                sparePartNumber);
 
-        if (!success)
-        {
-            messages::internalError(asyncResp->res);
-            return;
-        }
+            if (!success)
+            {
+                messages::internalError(asyncResp->res);
+                return;
+            }
 
-        if (partNumber != nullptr)
-        {
-            asyncResp->res.jsonValue["PartNumber"] = *partNumber;
-        }
+            if (partNumber != nullptr)
+            {
+                asyncResp->res.jsonValue["PartNumber"] = *partNumber;
+            }
 
-        if (serialNumber != nullptr)
-        {
-            asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
-        }
+            if (serialNumber != nullptr)
+            {
+                asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
+            }
 
-        if (manufacturer != nullptr)
-        {
-            asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
-        }
+            if (manufacturer != nullptr)
+            {
+                asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
+            }
 
-        if (model != nullptr)
-        {
-            asyncResp->res.jsonValue["Model"] = *model;
-        }
+            if (model != nullptr)
+            {
+                asyncResp->res.jsonValue["Model"] = *model;
+            }
 
-        // SparePartNumber is optional on D-Bus so skip if it is empty
-        if (sparePartNumber != nullptr && !sparePartNumber->empty())
-        {
-            asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
-        }
-    });
+            // SparePartNumber is optional on D-Bus so skip if it is empty
+            if (sparePartNumber != nullptr && !sparePartNumber->empty())
+            {
+                asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
+            }
+        });
 }
 
 inline void getPowerSupplyFirmwareVersion(
@@ -330,18 +332,19 @@
         "xyz.openbmc_project.Software.Version", "Version",
         [asyncResp](const boost::system::error_code& ec,
                     const std::string& value) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR("DBUS response error for FirmwareVersion {}",
-                                 ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR(
+                        "DBUS response error for FirmwareVersion {}",
+                        ec.value());
+                    messages::internalError(asyncResp->res);
+                }
+                return;
             }
-            return;
-        }
-        asyncResp->res.jsonValue["FirmwareVersion"] = value;
-    });
+            asyncResp->res.jsonValue["FirmwareVersion"] = value;
+        });
 }
 
 inline void
@@ -353,19 +356,19 @@
         "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
         [asyncResp](const boost::system::error_code& ec,
                     const std::string& value) {
-        if (ec)
-        {
-            if (ec.value() != EBADR)
+            if (ec)
             {
-                BMCWEB_LOG_ERROR("DBUS response error for Location {}",
-                                 ec.value());
-                messages::internalError(asyncResp->res);
+                if (ec.value() != EBADR)
+                {
+                    BMCWEB_LOG_ERROR("DBUS response error for Location {}",
+                                     ec.value());
+                    messages::internalError(asyncResp->res);
+                }
+                return;
             }
-            return;
-        }
-        asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
-            value;
-    });
+            asyncResp->res
+                .jsonValue["Location"]["PartLocation"]["ServiceLabel"] = value;
+        });
 }
 
 inline void handleGetEfficiencyResponse(
@@ -433,8 +436,8 @@
         *crow::connections::systemBus, service, path,
         "xyz.openbmc_project.Control.PowerSupplyAttributes", "DeratingFactor",
         [asyncResp](const boost::system::error_code& ec1, uint32_t value) {
-        handleGetEfficiencyResponse(asyncResp, ec1, value);
-    });
+            handleGetEfficiencyResponse(asyncResp, ec1, value);
+        });
 }
 
 inline void
@@ -447,15 +450,14 @@
         "/xyz/openbmc_project", 0, efficiencyIntf,
         [asyncResp](const boost::system::error_code& ec,
                     const dbus::utility::MapperGetSubTreeResponse& subtree) {
-        handlePowerSupplyAttributesSubTreeResponse(asyncResp, ec, subtree);
-    });
+            handlePowerSupplyAttributesSubTreeResponse(asyncResp, ec, subtree);
+        });
 }
 
-inline void
-    doPowerSupplyGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                     const std::string& chassisId,
-                     const std::string& powerSupplyId,
-                     const std::optional<std::string>& validChassisPath)
+inline void doPowerSupplyGet(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& chassisId, const std::string& powerSupplyId,
+    const std::optional<std::string>& validChassisPath)
 {
     if (!validChassisPath)
     {
@@ -464,55 +466,56 @@
     }
 
     // Get the correct Path and Service that match the input parameters
-    getValidPowerSupplyPath(asyncResp, *validChassisPath, powerSupplyId,
-                            [asyncResp, chassisId, powerSupplyId](
-                                const std::string& powerSupplyPath) {
-        asyncResp->res.addHeader(
-            boost::beast::http::field::link,
-            "</redfish/v1/JsonSchemas/PowerSupply/PowerSupply.json>; rel=describedby");
-        asyncResp->res.jsonValue["@odata.type"] =
-            "#PowerSupply.v1_5_0.PowerSupply";
-        asyncResp->res.jsonValue["Name"] = "Power Supply";
-        asyncResp->res.jsonValue["Id"] = powerSupplyId;
-        asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
-            "/redfish/v1/Chassis/{}/PowerSubsystem/PowerSupplies/{}", chassisId,
-            powerSupplyId);
+    getValidPowerSupplyPath(
+        asyncResp, *validChassisPath, powerSupplyId,
+        [asyncResp, chassisId,
+         powerSupplyId](const std::string& powerSupplyPath) {
+            asyncResp->res.addHeader(
+                boost::beast::http::field::link,
+                "</redfish/v1/JsonSchemas/PowerSupply/PowerSupply.json>; rel=describedby");
+            asyncResp->res.jsonValue["@odata.type"] =
+                "#PowerSupply.v1_5_0.PowerSupply";
+            asyncResp->res.jsonValue["Name"] = "Power Supply";
+            asyncResp->res.jsonValue["Id"] = powerSupplyId;
+            asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+                "/redfish/v1/Chassis/{}/PowerSubsystem/PowerSupplies/{}",
+                chassisId, powerSupplyId);
 
-        asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
-        asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
+            asyncResp->res.jsonValue["Status"]["State"] =
+                resource::State::Enabled;
+            asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
 
-        dbus::utility::getDbusObject(
-            powerSupplyPath, powerSupplyInterface,
-            [asyncResp,
-             powerSupplyPath](const boost::system::error_code& ec,
-                              const dbus::utility::MapperGetObject& object) {
-            if (ec || object.empty())
-            {
-                messages::internalError(asyncResp->res);
-                return;
-            }
+            dbus::utility::getDbusObject(
+                powerSupplyPath, powerSupplyInterface,
+                [asyncResp, powerSupplyPath](
+                    const boost::system::error_code& ec,
+                    const dbus::utility::MapperGetObject& object) {
+                    if (ec || object.empty())
+                    {
+                        messages::internalError(asyncResp->res);
+                        return;
+                    }
 
-            getPowerSupplyState(asyncResp, object.begin()->first,
-                                powerSupplyPath);
-            getPowerSupplyHealth(asyncResp, object.begin()->first,
-                                 powerSupplyPath);
-            getPowerSupplyAsset(asyncResp, object.begin()->first,
-                                powerSupplyPath);
-            getPowerSupplyFirmwareVersion(asyncResp, object.begin()->first,
-                                          powerSupplyPath);
-            getPowerSupplyLocation(asyncResp, object.begin()->first,
-                                   powerSupplyPath);
+                    getPowerSupplyState(asyncResp, object.begin()->first,
+                                        powerSupplyPath);
+                    getPowerSupplyHealth(asyncResp, object.begin()->first,
+                                         powerSupplyPath);
+                    getPowerSupplyAsset(asyncResp, object.begin()->first,
+                                        powerSupplyPath);
+                    getPowerSupplyFirmwareVersion(
+                        asyncResp, object.begin()->first, powerSupplyPath);
+                    getPowerSupplyLocation(asyncResp, object.begin()->first,
+                                           powerSupplyPath);
+                });
+
+            getEfficiencyPercent(asyncResp);
         });
-
-        getEfficiencyPercent(asyncResp);
-    });
 }
 
-inline void
-    handlePowerSupplyHead(App& app, const crow::Request& req,
-                          const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                          const std::string& chassisId,
-                          const std::string& powerSupplyId)
+inline void handlePowerSupplyHead(
+    App& app, const crow::Request& req,
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& chassisId, const std::string& powerSupplyId)
 {
     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
     {
@@ -523,27 +526,28 @@
         asyncResp, chassisId,
         [asyncResp, chassisId,
          powerSupplyId](const std::optional<std::string>& validChassisPath) {
-        if (!validChassisPath)
-        {
-            messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
-            return;
-        }
+            if (!validChassisPath)
+            {
+                messages::resourceNotFound(asyncResp->res, "Chassis",
+                                           chassisId);
+                return;
+            }
 
-        // Get the correct Path and Service that match the input parameters
-        getValidPowerSupplyPath(asyncResp, *validChassisPath, powerSupplyId,
-                                [asyncResp](const std::string&) {
-            asyncResp->res.addHeader(
-                boost::beast::http::field::link,
-                "</redfish/v1/JsonSchemas/PowerSupply/PowerSupply.json>; rel=describedby");
+            // Get the correct Path and Service that match the input parameters
+            getValidPowerSupplyPath(
+                asyncResp, *validChassisPath, powerSupplyId,
+                [asyncResp](const std::string&) {
+                    asyncResp->res.addHeader(
+                        boost::beast::http::field::link,
+                        "</redfish/v1/JsonSchemas/PowerSupply/PowerSupply.json>; rel=describedby");
+                });
         });
-    });
 }
 
-inline void
-    handlePowerSupplyGet(App& app, const crow::Request& req,
-                         const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                         const std::string& chassisId,
-                         const std::string& powerSupplyId)
+inline void handlePowerSupplyGet(
+    App& app, const crow::Request& req,
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& chassisId, const std::string& powerSupplyId)
 {
     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
     {