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/chassis.hpp b/redfish-core/lib/chassis.hpp
index d6438d0..35bed99 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -62,32 +62,32 @@
         (path / "storage").str, "xyz.openbmc_project.Association", "endpoints",
         [asyncResp](const boost::system::error_code& ec,
                     const std::vector<std::string>& storageList) {
-        if (ec)
-        {
-            BMCWEB_LOG_DEBUG("getStorageLink got DBUS response error");
-            return;
-        }
-
-        nlohmann::json::array_t storages;
-        for (const std::string& storagePath : storageList)
-        {
-            std::string id =
-                sdbusplus::message::object_path(storagePath).filename();
-            if (id.empty())
+            if (ec)
             {
-                continue;
+                BMCWEB_LOG_DEBUG("getStorageLink got DBUS response error");
+                return;
             }
 
-            nlohmann::json::object_t storage;
-            storage["@odata.id"] =
-                boost::urls::format("/redfish/v1/Systems/{}/Storage/{}",
-                                    BMCWEB_REDFISH_SYSTEM_URI_NAME, id);
-            storages.emplace_back(std::move(storage));
-        }
-        asyncResp->res.jsonValue["Links"]["Storage@odata.count"] =
-            storages.size();
-        asyncResp->res.jsonValue["Links"]["Storage"] = std::move(storages);
-    });
+            nlohmann::json::array_t storages;
+            for (const std::string& storagePath : storageList)
+            {
+                std::string id =
+                    sdbusplus::message::object_path(storagePath).filename();
+                if (id.empty())
+                {
+                    continue;
+                }
+
+                nlohmann::json::object_t storage;
+                storage["@odata.id"] =
+                    boost::urls::format("/redfish/v1/Systems/{}/Storage/{}",
+                                        BMCWEB_REDFISH_SYSTEM_URI_NAME, id);
+                storages.emplace_back(std::move(storage));
+            }
+            asyncResp->res.jsonValue["Links"]["Storage@odata.count"] =
+                storages.size();
+            asyncResp->res.jsonValue["Links"]["Storage"] = std::move(storages);
+        });
 }
 
 /**
@@ -106,36 +106,39 @@
         "xyz.openbmc_project.State.Chassis", "CurrentPowerState",
         [asyncResp{std::move(asyncResp)}](const boost::system::error_code& ec,
                                           const std::string& chassisState) {
-        if (ec)
-        {
-            if (ec == boost::system::errc::host_unreachable)
+            if (ec)
             {
-                // Service not available, no error, just don't return
-                // chassis state info
-                BMCWEB_LOG_DEBUG("Service not available {}", ec);
+                if (ec == boost::system::errc::host_unreachable)
+                {
+                    // Service not available, no error, just don't return
+                    // chassis state info
+                    BMCWEB_LOG_DEBUG("Service not available {}", ec);
+                    return;
+                }
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
+                messages::internalError(asyncResp->res);
                 return;
             }
-            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
-            messages::internalError(asyncResp->res);
-            return;
-        }
 
-        BMCWEB_LOG_DEBUG("Chassis state: {}", chassisState);
-        // Verify Chassis State
-        if (chassisState == "xyz.openbmc_project.State.Chassis.PowerState.On")
-        {
-            asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On;
-            asyncResp->res.jsonValue["Status"]["State"] =
-                resource::State::Enabled;
-        }
-        else if (chassisState ==
-                 "xyz.openbmc_project.State.Chassis.PowerState.Off")
-        {
-            asyncResp->res.jsonValue["PowerState"] = resource::PowerState::Off;
-            asyncResp->res.jsonValue["Status"]["State"] =
-                resource::State::StandbyOffline;
-        }
-    });
+            BMCWEB_LOG_DEBUG("Chassis state: {}", chassisState);
+            // Verify Chassis State
+            if (chassisState ==
+                "xyz.openbmc_project.State.Chassis.PowerState.On")
+            {
+                asyncResp->res.jsonValue["PowerState"] =
+                    resource::PowerState::On;
+                asyncResp->res.jsonValue["Status"]["State"] =
+                    resource::State::Enabled;
+            }
+            else if (chassisState ==
+                     "xyz.openbmc_project.State.Chassis.PowerState.Off")
+            {
+                asyncResp->res.jsonValue["PowerState"] =
+                    resource::PowerState::Off;
+                asyncResp->res.jsonValue["Status"]["State"] =
+                    resource::State::StandbyOffline;
+            }
+        });
 }
 
 /**
@@ -167,19 +170,20 @@
                 "xyz.openbmc_project.Chassis.Intrusion", "Status",
                 [asyncResp](const boost::system::error_code& ec1,
                             const std::string& value) {
-                if (ec1)
-                {
-                    // do not add err msg in redfish response, because this is
-                    // not
-                    //     mandatory property
-                    BMCWEB_LOG_ERROR("DBUS response error {}", ec1);
-                    return;
-                }
-                asyncResp->res
-                    .jsonValue["PhysicalSecurity"]["IntrusionSensorNumber"] = 1;
-                asyncResp->res
-                    .jsonValue["PhysicalSecurity"]["IntrusionSensor"] = value;
-            });
+                    if (ec1)
+                    {
+                        // do not add err msg in redfish response, because this
+                        // is not
+                        //     mandatory property
+                        BMCWEB_LOG_ERROR("DBUS response error {}", ec1);
+                        return;
+                    }
+                    asyncResp->res.jsonValue["PhysicalSecurity"]
+                                            ["IntrusionSensorNumber"] = 1;
+                    asyncResp->res
+                        .jsonValue["PhysicalSecurity"]["IntrusionSensor"] =
+                        value;
+                });
 
             return;
         }
@@ -281,17 +285,16 @@
             continue;
         }
         nlohmann::json link;
-        link["@odata.id"] = boost::urls::format("/redfish/v1/Chassis/{}",
-                                                downstreamChassis);
+        link["@odata.id"] =
+            boost::urls::format("/redfish/v1/Chassis/{}", downstreamChassis);
         jValue.push_back(std::move(link));
     }
     asyncResp->res.jsonValue["Links"]["Contains@odata.count"] = jValue.size();
 }
 
-inline void
-    getChassisConnectivity(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                           const std::string& chassisId,
-                           const std::string& chassisPath)
+inline void getChassisConnectivity(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& chassisId, const std::string& chassisPath)
 {
     BMCWEB_LOG_DEBUG("Get chassis connectivity");
 
@@ -323,26 +326,26 @@
             std::bind_front(handleChassisCollectionGet, std::ref(app)));
 }
 
-inline void
-    getChassisLocationCode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                           const std::string& connectionName,
-                           const std::string& path)
+inline void getChassisLocationCode(
+    const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+    const std::string& connectionName, const std::string& path)
 {
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, connectionName, path,
         "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
         [asyncResp](const boost::system::error_code& ec,
                     const std::string& property) {
-        if (ec)
-        {
-            BMCWEB_LOG_ERROR("DBUS response error for Location");
-            messages::internalError(asyncResp->res);
-            return;
-        }
+            if (ec)
+            {
+                BMCWEB_LOG_ERROR("DBUS response error for Location");
+                messages::internalError(asyncResp->res);
+                return;
+            }
 
-        asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
-            property;
-    });
+            asyncResp->res
+                .jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
+                property;
+        });
 }
 
 inline void getChassisUUID(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -354,14 +357,14 @@
         "xyz.openbmc_project.Common.UUID", "UUID",
         [asyncResp](const boost::system::error_code& ec,
                     const std::string& chassisUUID) {
-        if (ec)
-        {
-            BMCWEB_LOG_ERROR("DBUS response error for UUID");
-            messages::internalError(asyncResp->res);
-            return;
-        }
-        asyncResp->res.jsonValue["UUID"] = chassisUUID;
-    });
+            if (ec)
+            {
+                BMCWEB_LOG_ERROR("DBUS response error for UUID");
+                messages::internalError(asyncResp->res);
+                return;
+            }
+            asyncResp->res.jsonValue["UUID"] = chassisUUID;
+        });
 }
 
 inline void handleDecoratorAssetProperties(
@@ -444,8 +447,8 @@
 
     nlohmann::json::array_t computerSystems;
     nlohmann::json::object_t system;
-    system["@odata.id"] = std::format("/redfish/v1/Systems/{}",
-                                      BMCWEB_REDFISH_SYSTEM_URI_NAME);
+    system["@odata.id"] =
+        std::format("/redfish/v1/Systems/{}", BMCWEB_REDFISH_SYSTEM_URI_NAME);
     computerSystems.emplace_back(std::move(system));
     asyncResp->res.jsonValue["Links"]["ComputerSystems"] =
         std::move(computerSystems);
@@ -512,16 +515,16 @@
             path + "/drive",
             [asyncResp, chassisId](const boost::system::error_code& ec3,
                                    const dbus::utility::MapperEndPoints& resp) {
-            if (ec3 || resp.empty())
-            {
-                return; // no drives = no failures
-            }
+                if (ec3 || resp.empty())
+                {
+                    return; // no drives = no failures
+                }
 
-            nlohmann::json reference;
-            reference["@odata.id"] =
-                boost::urls::format("/redfish/v1/Chassis/{}/Drives", chassisId);
-            asyncResp->res.jsonValue["Drives"] = std::move(reference);
-        });
+                nlohmann::json reference;
+                reference["@odata.id"] = boost::urls::format(
+                    "/redfish/v1/Chassis/{}/Drives", chassisId);
+                asyncResp->res.jsonValue["Drives"] = std::move(reference);
+            });
 
         const std::string& connectionName = connectionNames[0].first;
 
@@ -546,15 +549,15 @@
                     assetTagInterface, "AssetTag",
                     [asyncResp, chassisId](const boost::system::error_code& ec2,
                                            const std::string& property) {
-                    if (ec2)
-                    {
-                        BMCWEB_LOG_ERROR("DBus response error for AssetTag: {}",
-                                         ec2);
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    asyncResp->res.jsonValue["AssetTag"] = property;
-                });
+                        if (ec2)
+                        {
+                            BMCWEB_LOG_ERROR(
+                                "DBus response error for AssetTag: {}", ec2);
+                            messages::internalError(asyncResp->res);
+                            return;
+                        }
+                        asyncResp->res.jsonValue["AssetTag"] = property;
+                    });
             }
             else if (interface == replaceableInterface)
             {
@@ -563,15 +566,16 @@
                     replaceableInterface, "HotPluggable",
                     [asyncResp, chassisId](const boost::system::error_code& ec2,
                                            const bool property) {
-                    if (ec2)
-                    {
-                        BMCWEB_LOG_ERROR(
-                            "DBus response error for HotPluggable: {}", ec2);
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    asyncResp->res.jsonValue["HotPluggable"] = property;
-                });
+                        if (ec2)
+                        {
+                            BMCWEB_LOG_ERROR(
+                                "DBus response error for HotPluggable: {}",
+                                ec2);
+                            messages::internalError(asyncResp->res);
+                            return;
+                        }
+                        asyncResp->res.jsonValue["HotPluggable"] = property;
+                    });
             }
             else if (interface == revisionInterface)
             {
@@ -580,15 +584,15 @@
                     revisionInterface, "Version",
                     [asyncResp, chassisId](const boost::system::error_code& ec2,
                                            const std::string& property) {
-                    if (ec2)
-                    {
-                        BMCWEB_LOG_ERROR("DBus response error for Version: {}",
-                                         ec2);
-                        messages::internalError(asyncResp->res);
-                        return;
-                    }
-                    asyncResp->res.jsonValue["Version"] = property;
-                });
+                        if (ec2)
+                        {
+                            BMCWEB_LOG_ERROR(
+                                "DBus response error for Version: {}", ec2);
+                            messages::internalError(asyncResp->res);
+                            return;
+                        }
+                        asyncResp->res.jsonValue["Version"] = property;
+                    });
             }
         }
 
@@ -608,9 +612,9 @@
             [asyncResp, chassisId,
              path](const boost::system::error_code&,
                    const dbus::utility::DBusPropertiesMap& propertiesList) {
-            handleDecoratorAssetProperties(asyncResp, chassisId, path,
-                                           propertiesList);
-        });
+                handleDecoratorAssetProperties(asyncResp, chassisId, path,
+                                               propertiesList);
+            });
 
         for (const auto& interface : interfaces2)
         {
@@ -704,81 +708,83 @@
         [asyncResp, chassisId, locationIndicatorActive,
          indicatorLed](const boost::system::error_code& ec,
                        const dbus::utility::MapperGetSubTreeResponse& subtree) {
-        if (ec)
-        {
-            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
-            messages::internalError(asyncResp->res);
-            return;
-        }
-
-        // Iterate over all retrieved ObjectPaths.
-        for (const std::pair<
-                 std::string,
-                 std::vector<std::pair<std::string, std::vector<std::string>>>>&
-                 object : subtree)
-        {
-            const std::string& path = object.first;
-            const std::vector<std::pair<std::string, std::vector<std::string>>>&
-                connectionNames = object.second;
-
-            sdbusplus::message::object_path objPath(path);
-            if (objPath.filename() != chassisId)
+            if (ec)
             {
-                continue;
+                BMCWEB_LOG_ERROR("DBUS response error {}", ec);
+                messages::internalError(asyncResp->res);
+                return;
             }
 
-            if (connectionNames.empty())
+            // Iterate over all retrieved ObjectPaths.
+            for (const std::pair<std::string,
+                                 std::vector<std::pair<
+                                     std::string, std::vector<std::string>>>>&
+                     object : subtree)
             {
-                BMCWEB_LOG_ERROR("Got 0 Connection names");
-                continue;
+                const std::string& path = object.first;
+                const std::vector<
+                    std::pair<std::string, std::vector<std::string>>>&
+                    connectionNames = object.second;
+
+                sdbusplus::message::object_path objPath(path);
+                if (objPath.filename() != chassisId)
+                {
+                    continue;
+                }
+
+                if (connectionNames.empty())
+                {
+                    BMCWEB_LOG_ERROR("Got 0 Connection names");
+                    continue;
+                }
+
+                const std::vector<std::string>& interfaces3 =
+                    connectionNames[0].second;
+
+                const std::array<const char*, 3> hasIndicatorLed = {
+                    "xyz.openbmc_project.Inventory.Item.Chassis",
+                    "xyz.openbmc_project.Inventory.Item.Panel",
+                    "xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
+                bool indicatorChassis = false;
+                for (const char* interface : hasIndicatorLed)
+                {
+                    if (std::ranges::find(interfaces3, interface) !=
+                        interfaces3.end())
+                    {
+                        indicatorChassis = true;
+                        break;
+                    }
+                }
+                if (locationIndicatorActive)
+                {
+                    if (indicatorChassis)
+                    {
+                        setSystemLocationIndicatorActive(
+                            asyncResp, *locationIndicatorActive);
+                    }
+                    else
+                    {
+                        messages::propertyUnknown(asyncResp->res,
+                                                  "LocationIndicatorActive");
+                    }
+                }
+                if (indicatorLed)
+                {
+                    if (indicatorChassis)
+                    {
+                        setIndicatorLedState(asyncResp, *indicatorLed);
+                    }
+                    else
+                    {
+                        messages::propertyUnknown(asyncResp->res,
+                                                  "IndicatorLED");
+                    }
+                }
+                return;
             }
 
-            const std::vector<std::string>& interfaces3 =
-                connectionNames[0].second;
-
-            const std::array<const char*, 3> hasIndicatorLed = {
-                "xyz.openbmc_project.Inventory.Item.Chassis",
-                "xyz.openbmc_project.Inventory.Item.Panel",
-                "xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
-            bool indicatorChassis = false;
-            for (const char* interface : hasIndicatorLed)
-            {
-                if (std::ranges::find(interfaces3, interface) !=
-                    interfaces3.end())
-                {
-                    indicatorChassis = true;
-                    break;
-                }
-            }
-            if (locationIndicatorActive)
-            {
-                if (indicatorChassis)
-                {
-                    setSystemLocationIndicatorActive(asyncResp,
-                                                     *locationIndicatorActive);
-                }
-                else
-                {
-                    messages::propertyUnknown(asyncResp->res,
-                                              "LocationIndicatorActive");
-                }
-            }
-            if (indicatorLed)
-            {
-                if (indicatorChassis)
-                {
-                    setIndicatorLedState(asyncResp, *indicatorLed);
-                }
-                else
-                {
-                    messages::propertyUnknown(asyncResp->res, "IndicatorLED");
-                }
-            }
-            return;
-        }
-
-        messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
-    });
+            messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
+        });
 }
 
 /**
@@ -810,32 +816,34 @@
         [asyncResp](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreePathsResponse& chassisList) {
-        if (ec)
-        {
-            BMCWEB_LOG_ERROR("[mapper] Bad D-Bus request error: {}", ec);
-            messages::internalError(asyncResp->res);
-            return;
-        }
+            if (ec)
+            {
+                BMCWEB_LOG_ERROR("[mapper] Bad D-Bus request error: {}", ec);
+                messages::internalError(asyncResp->res);
+                return;
+            }
 
-        const char* processName = "xyz.openbmc_project.State.Chassis";
-        const char* interfaceName = "xyz.openbmc_project.State.Chassis";
-        const char* destProperty = "RequestedPowerTransition";
-        const std::string propertyValue =
-            "xyz.openbmc_project.State.Chassis.Transition.PowerCycle";
-        std::string objectPath = "/xyz/openbmc_project/state/chassis_system0";
+            const char* processName = "xyz.openbmc_project.State.Chassis";
+            const char* interfaceName = "xyz.openbmc_project.State.Chassis";
+            const char* destProperty = "RequestedPowerTransition";
+            const std::string propertyValue =
+                "xyz.openbmc_project.State.Chassis.Transition.PowerCycle";
+            std::string objectPath =
+                "/xyz/openbmc_project/state/chassis_system0";
 
-        /* Look for system reset chassis path */
-        if ((std::ranges::find(chassisList, objectPath)) == chassisList.end())
-        {
-            /* We prefer to reset the full chassis_system, but if it doesn't
-             * exist on some platforms, fall back to a host-only power reset
-             */
-            objectPath = "/xyz/openbmc_project/state/chassis0";
-        }
+            /* Look for system reset chassis path */
+            if ((std::ranges::find(chassisList, objectPath)) ==
+                chassisList.end())
+            {
+                /* We prefer to reset the full chassis_system, but if it doesn't
+                 * exist on some platforms, fall back to a host-only power reset
+                 */
+                objectPath = "/xyz/openbmc_project/state/chassis0";
+            }
 
-        setDbusProperty(asyncResp, "ResetType", processName, objectPath,
-                        interfaceName, destProperty, propertyValue);
-    });
+            setDbusProperty(asyncResp, "ResetType", processName, objectPath,
+                            interfaceName, destProperty, propertyValue);
+        });
 }
 
 inline void handleChassisResetActionInfoPost(