clang-tidy: Fix Move Prevents Copy Elision
The following errors were reported during clang-tidy enablement due
to moving temporary objects, which prevents copy elision. This fix
addresses the issue by removing unnecessary std::move calls call,
allowing the compiler to optimize the code through copy elision,
resolving the error.
'''
test/dbus_passive_unittest.cpp:613:18: error: moving a temporary object prevents copy elision [-Werror
test/dbus_passive_unittest.cpp:71:18: error: moving a temporary object prevents copy elision [-Werror
test/dbus_passive_unittest.cpp:833:18: error: moving a temporary object prevents copy elision [-Werror
test/dbus_passive_unittest.cpp:877:18: error: moving a temporary object prevents copy elision [-Werror
dbus/dbuspassiveredundancy.cpp:52:11: error: moving a temporary object prevents copy elision [-Werror
'''
Tested: Build and unit tests passed successfully.
Change-Id: I320f048807085c3bbac0171a28c8505474aaf24a
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/dbus/dbuspassiveredundancy.cpp b/dbus/dbuspassiveredundancy.cpp
index fa8ce58..1ec2872 100644
--- a/dbus/dbuspassiveredundancy.cpp
+++ b/dbus/dbuspassiveredundancy.cpp
@@ -49,7 +49,8 @@
match(bus,
"type='signal',member='PropertiesChanged',arg0namespace='" +
std::string(redundancy::interface) + "'",
- std::move([this](sdbusplus::message_t& message) {
+
+ [this](sdbusplus::message_t& message) {
std::string objectName;
std::unordered_map<
std::string,
@@ -100,7 +101,7 @@
failed.erase(d);
}
}
- })),
+ }),
passiveBus(bus)
{
populateFailures();