sensor: Use default member initializers for hysteresis Fix clang-tidy modernize-use-default-member-init warnings for hysteresisTrigger and hysteresisPublish in Sensor class. Initialize them using default member initializers with maxValue and minValue, and remove them from the constructor initializer list. Change-Id: I5269f51def1433b857c2061093859d3ea397bdf3 Signed-off-by: Muhammad Usama <muhammadusama@google.com>
diff --git a/src/sensor.hpp b/src/sensor.hpp index 504502b..13bf1d3 100644 --- a/src/sensor.hpp +++ b/src/sensor.hpp
@@ -77,9 +77,7 @@ configInterface(configInterfaceName(objectType)), isSensorSettable(isSettable), isValueMutable(isMutable), maxValue(max), minValue(min), thresholds(std::move(thresholdData)), - hysteresisTrigger((max - min) * 0.01), - hysteresisPublish((max - min) * 0.0001), dbusConnection(conn), - readState(readState), + dbusConnection(conn), readState(readState), instrumentation(enableInstrumentation ? std::make_unique<SensorInstrumentation>() : nullptr) @@ -109,8 +107,8 @@ double rawValue = std::numeric_limits<double>::quiet_NaN(); bool overriddenState = false; bool internalSet = false; - double hysteresisTrigger; - double hysteresisPublish; + double hysteresisTrigger = (maxValue - minValue) * 0.01; + double hysteresisPublish = (maxValue - minValue) * 0.0001; std::shared_ptr<sdbusplus::asio::connection> dbusConnection; PowerState readState; size_t errCount{0};