clang-tidy: Remove unused lambda captures
The following errors were reported during clang-tidy enablement due
to unused lambda captures.
'''
cold-redundancy/cold_redundancy.cpp:50:23: error: lambda capture 'objectServer' is not used [-Werror
cold-redundancy/cold_redundancy.cpp:59:44: error: lambda capture 'io' is not used [-Werror
cold-redundancy/cold_redundancy.cpp:59:49: error: lambda capture 'objectServer' is not used [-Werror
cold-redundancy/cold_redundancy.cpp:50:18: error: lambda capture 'io' is not used [-Werror
'''
The fix involves removing these unused lambda captures.
Tested: Build and unit testing verified.
Change-Id: If18b25f6ab09f3c369899777ba313400604a24ec
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/cold-redundancy/cold_redundancy.cpp b/cold-redundancy/cold_redundancy.cpp
index c1ebc44..c912ed2 100644
--- a/cold-redundancy/cold_redundancy.cpp
+++ b/cold-redundancy/cold_redundancy.cpp
@@ -42,32 +42,31 @@
} // namespace
ColdRedundancy::ColdRedundancy(
- boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
+ boost::asio::io_service& io,
std::shared_ptr<sdbusplus::asio::connection>& systemBus) :
filterTimer(io), systemBus(systemBus)
{
- post(io,
- [this, &io, &objectServer, &systemBus]() { createPSU(systemBus); });
+ post(io, [this, &systemBus]() { createPSU(systemBus); });
std::function<void(sdbusplus::message_t&)> eventHandler =
- [this, &io, &objectServer, &systemBus](sdbusplus::message_t& message) {
+ [this, &systemBus](sdbusplus::message_t& message) {
if (message.is_method_error())
{
std::cerr << "callback method error\n";
return;
}
filterTimer.expires_after(std::chrono::seconds(1));
- filterTimer.async_wait([this, &io, &objectServer, &systemBus](
- const boost::system::error_code& ec) {
- if (ec == boost::asio::error::operation_aborted)
- {
- return;
- }
- else if (ec)
- {
- std::cerr << "timer error\n";
- }
- createPSU(systemBus);
- });
+ filterTimer.async_wait(
+ [this, &systemBus](const boost::system::error_code& ec) {
+ if (ec == boost::asio::error::operation_aborted)
+ {
+ return;
+ }
+ else if (ec)
+ {
+ std::cerr << "timer error\n";
+ }
+ createPSU(systemBus);
+ });
};
std::function<void(sdbusplus::message_t&)> eventCollect =
diff --git a/cold-redundancy/cold_redundancy.hpp b/cold-redundancy/cold_redundancy.hpp
index a66705a..d814c53 100644
--- a/cold-redundancy/cold_redundancy.hpp
+++ b/cold-redundancy/cold_redundancy.hpp
@@ -29,12 +29,10 @@
* Constructor
*
* @param[in] io - boost asio context
- * @param[in] objectServer - D-Bus object
* @param[in] dbusConnection - D-Bus connection
*/
ColdRedundancy(
boost::asio::io_service& io,
- sdbusplus::asio::object_server& objectServer,
std::shared_ptr<sdbusplus::asio::connection>& dbusConnection);
/**
diff --git a/cold-redundancy/redundancy_main.cpp b/cold-redundancy/redundancy_main.cpp
index d8572e5..aa9a29d 100644
--- a/cold-redundancy/redundancy_main.cpp
+++ b/cold-redundancy/redundancy_main.cpp
@@ -23,9 +23,8 @@
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
systemBus->request_name("xyz.openbmc_project.PSURedundancy");
- sdbusplus::asio::object_server objectServer(systemBus);
- ColdRedundancy coldRedundancy(io, objectServer, systemBus);
+ ColdRedundancy coldRedundancy(io, systemBus);
io.run();