Fix some warnings by cppcheck

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Icee0abe2e3130aa225db776efdcd47200eb38f8d
diff --git a/led-main.cpp b/led-main.cpp
index df057a5..bebe5dd 100644
--- a/led-main.cpp
+++ b/led-main.cpp
@@ -16,6 +16,7 @@
 
 #include <sdeventplus/event.hpp>
 
+#include <algorithm>
 #include <iostream>
 
 int main(void)
@@ -58,11 +59,14 @@
 #endif
 
     /** Now create so many dbus objects as there are groups */
-    for (auto& grp : systemLedMap)
-    {
-        groups.emplace_back(std::make_unique<phosphor::led::Group>(
-            bus, grp.first, manager, serialize));
-    }
+    std::ranges::transform(
+        systemLedMap, std::back_inserter(groups),
+        [&bus, &manager, &serialize](
+            const std::pair<std::string,
+                            std::set<phosphor::led::Layout::LedAction>>& grp) {
+            return std::make_unique<phosphor::led::Group>(bus, grp.first,
+                                                          manager, serialize);
+        });
 
     // Attach the bus to sd_event to service user requests
     bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);