clang-tidy: Enable modernize-avoid-bind check
The check finds uses of std::bind and boost::bind and replaces them
with lambdas.
Lambdas will use value-capture unless reference capture is explicitly
requested with std::ref or boost::ref.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I4491650a46eaab1588474b26efc622e89232ef02
diff --git a/fault-monitor/fru-fault-monitor.hpp b/fault-monitor/fru-fault-monitor.hpp
index e5ddc53..fc6cafa 100644
--- a/fault-monitor/fru-fault-monitor.hpp
+++ b/fault-monitor/fru-fault-monitor.hpp
@@ -47,8 +47,7 @@
Remove(sdbusplus::bus_t& bus, const std::string& path) :
inventoryPath(path),
matchRemoved(bus, match(path),
- std::bind(std::mem_fn(&Remove::removed), this,
- std::placeholders::_1))
+ [this](sdbusplus::message_t& m) { removed(m); })
{
// Do nothing
}
@@ -99,12 +98,11 @@
* @param[in] bus - The Dbus bus object
*/
explicit Add(sdbusplus::bus_t& bus) :
- matchCreated(
- bus,
- sdbusplus::bus::match::rules::interfacesAdded() +
- sdbusplus::bus::match::rules::path_namespace(
- "/xyz/openbmc_project/logging"),
- std::bind(std::mem_fn(&Add::created), this, std::placeholders::_1))
+ matchCreated(bus,
+ sdbusplus::bus::match::rules::interfacesAdded() +
+ sdbusplus::bus::match::rules::path_namespace(
+ "/xyz/openbmc_project/logging"),
+ [this](sdbusplus::message_t& m) { created(m); })
{
processExistingCallouts(bus);
}