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/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp
index 9120336..3066ab7 100644
--- a/test/dbus_passive_unittest.cpp
+++ b/test/dbus_passive_unittest.cpp
@@ -67,8 +67,7 @@
{
protected:
DbusPassiveTestObj() :
- sdbus_mock(),
- bus_mock(std::move(sdbusplus::get_mocked_new(&sdbus_mock))),
+ sdbus_mock(), bus_mock(sdbusplus::get_mocked_new(&sdbus_mock)),
helper(std::make_unique<DbusHelperMock>())
{
EXPECT_CALL(*helper, getService(StrEq(SensorIntf), StrEq(path)))
@@ -609,8 +608,7 @@
{
protected:
DbusPassiveTestUnaSensorNotAsFailedObj() :
- sdbus_mock(),
- bus_mock(std::move(sdbusplus::get_mocked_new(&sdbus_mock))),
+ sdbus_mock(), bus_mock(sdbusplus::get_mocked_new(&sdbus_mock)),
helper(std::make_unique<DbusHelperMock>())
{
EXPECT_CALL(*helper, getService(StrEq(SensorIntf), StrEq(path)))
@@ -829,8 +827,7 @@
{
protected:
DbusPassiveTest3kMaxObj() :
- sdbus_mock(),
- bus_mock(std::move(sdbusplus::get_mocked_new(&sdbus_mock))),
+ sdbus_mock(), bus_mock(sdbusplus::get_mocked_new(&sdbus_mock)),
helper(std::make_unique<DbusHelperMock>())
{
EXPECT_CALL(*helper, getService(StrEq(SensorIntf), StrEq(path)))
@@ -873,8 +870,7 @@
{
protected:
DbusPassiveTest3kMaxIgnoredObj() :
- sdbus_mock(),
- bus_mock(std::move(sdbusplus::get_mocked_new(&sdbus_mock))),
+ sdbus_mock(), bus_mock(sdbusplus::get_mocked_new(&sdbus_mock)),
helper(std::make_unique<DbusHelperMock>())
{
EXPECT_CALL(*helper, getService(StrEq(SensorIntf), StrEq(path)))