SensorCollection: use inline functions+bind_front

This commit changes the `/redfish/v1/Chassis/<str>/Sensors/` route
to take std::bind_front instead of lambdas. We can clearly see the
indent levels decrease. It increases the readability.

Tested:
1. trivial change; code compiles.
2. tested on my local mock environment;
URL:/redfish/v1/Chassis/fake_chassis/Sensors/
Response:
{
    "@odata.id": "/redfish/v1/Chassis/fake_chassis/Sensors",
    "@odata.type": "#SensorCollection.SensorCollection",
    "Description": "Collection of Sensors for this Chassis",
    "Members": [
        {
            "@odata.id": "/redfish/v1/Chassis/fake_chassis/Sensors/sensor0"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/fake_chassis/Sensors/sensor1"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/fake_chassis/Sensors/sensor5"
        },
        {
            "@odata.id": "/redfish/v1/Chassis/fake_chassis/Sensors/sensor6"
        }
    ],
    "Members@odata.count": 4,
    "Name": "Sensors"
}
3. Service Validator Passes
*** /redfish/v1/Chassis/fake_chassis/Sensors
	 Type (SensorCollection.SensorCollection), GET SUCCESS (time: 0:00:00.002345)
Attempt 1 of /redfish/v1/Chassis/fake_chassis/Sensors/sensor0
Response Time for GET to /redfish/v1/Chassis/fake_chassis/Sensors/sensor0: 0.006815780187025666 seconds.
Attempt 1 of /redfish/v1/Chassis/fake_chassis/Sensors/sensor1
Response Time for GET to /redfish/v1/Chassis/fake_chassis/Sensors/sensor1: 0.004200570052489638 seconds.
Attempt 1 of /redfish/v1/Chassis/fake_chassis/Sensors/sensor5
Response Time for GET to /redfish/v1/Chassis/fake_chassis/Sensors/sensor5: 0.004602659028023481 seconds.
Attempt 1 of /redfish/v1/Chassis/fake_chassis/Sensors/sensor6
Response Time for GET to /redfish/v1/Chassis/fake_chassis/Sensors/sensor6: 0.00432420102879405 seconds.
	 PASS

Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ibdebd9b5427db5b42d5047367ae8548fa981ddea
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index e1e25d5..b09b582 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -2992,6 +2992,47 @@
     BMCWEB_LOG_DEBUG << "getChassisCallback exit";
 }
 
+inline void
+    handleSensorCollectionGet(App& app, const crow::Request& req,
+                              const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+                              const std::string& chassisId)
+{
+    query_param::QueryCapabilities capabilities = {
+        .canDelegateExpandLevel = 1,
+    };
+    query_param::Query delegatedQuery;
+    if (!redfish::setUpRedfishRouteWithDelegation(app, req, aResp->res,
+                                                  delegatedQuery, capabilities))
+    {
+        return;
+    }
+
+    if (delegatedQuery.expandType != query_param::ExpandType::None)
+    {
+        // we perform efficient expand.
+        auto asyncResp = std::make_shared<SensorsAsyncResp>(
+            aResp, chassisId, sensors::dbus::sensorPaths,
+            sensors::node::sensors,
+            /*efficientExpand=*/true);
+        getChassisData(asyncResp);
+
+        BMCWEB_LOG_DEBUG
+            << "SensorCollection doGet exit via efficient expand handler";
+        return;
+    };
+
+    // if there's no efficient expand available, we use the default
+    // Query Parameters route
+    auto asyncResp = std::make_shared<SensorsAsyncResp>(
+        aResp, chassisId, sensors::dbus::sensorPaths, sensors::node::sensors);
+
+    // We get all sensors as hyperlinkes in the chassis (this
+    // implies we reply on the default query parameters handler)
+    getChassis(asyncResp,
+               std::bind_front(sensors::getChassisCallback, asyncResp));
+    BMCWEB_LOG_DEBUG << "SensorCollection doGet exit";
+}
+
 inline void handleSensorGet(App& app, const crow::Request& req,
                             const std::shared_ptr<bmcweb::AsyncResp>& aResp,
                             const std::string& chassisId,
@@ -3077,45 +3118,7 @@
     BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/Sensors/")
         .privileges(redfish::privileges::getSensorCollection)
         .methods(boost::beast::http::verb::get)(
-            [&app](const crow::Request& req,
-                   const std::shared_ptr<bmcweb::AsyncResp>& aResp,
-                   const std::string& chassisId) {
-        query_param::QueryCapabilities capabilities = {
-            .canDelegateExpandLevel = 1,
-        };
-        query_param::Query delegatedQuery;
-        if (!redfish::setUpRedfishRouteWithDelegation(
-                app, req, aResp->res, delegatedQuery, capabilities))
-        {
-            return;
-        }
-
-        if (delegatedQuery.expandType != query_param::ExpandType::None)
-        {
-            // we perform efficient expand.
-            auto asyncResp = std::make_shared<SensorsAsyncResp>(
-                aResp, chassisId, sensors::dbus::sensorPaths,
-                sensors::node::sensors,
-                /*efficientExpand=*/true);
-            getChassisData(asyncResp);
-
-            BMCWEB_LOG_DEBUG
-                << "SensorCollection doGet exit via efficient expand handler";
-            return;
-        };
-
-        // if there's no efficient expand available, we use the default
-        // Query Parameters route
-        auto asyncResp = std::make_shared<SensorsAsyncResp>(
-            aResp, chassisId, sensors::dbus::sensorPaths,
-            sensors::node::sensors);
-
-        // We get all sensors as hyperlinkes in the chassis (this
-        // implies we reply on the default query parameters handler)
-        getChassis(asyncResp,
-                   std::bind_front(sensors::getChassisCallback, asyncResp));
-        BMCWEB_LOG_DEBUG << "SensorCollection doGet exit";
-        });
+            std::bind_front(sensors::handleSensorCollectionGet, std::ref(app)));
 }
 
 inline void requestRoutesSensor(App& app)