Clang-tidy-14 fixes
Do as the robot commands. All changes made automatically by tidy.
Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 0f5e721..ff0ffaa 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -386,7 +386,7 @@
{
bool inverted =
std::get<std::string>(findPolarity->second) == "Low";
- if (auto pinName =
+ if (const auto* pinName =
std::get_if<std::string>(&findPinName->second))
{
presenceSensor = std::make_unique<PresenceSensor>(
@@ -409,8 +409,9 @@
auto findPower = baseConfiguration->second.find("PowerState");
if (findPower != baseConfiguration->second.end())
{
- auto ptrPower = std::get_if<std::string>(&(findPower->second));
- if (ptrPower)
+ const auto* ptrPower =
+ std::get_if<std::string>(&(findPower->second));
+ if (ptrPower != nullptr)
{
setReadState(*ptrPower, powerState);
}
@@ -466,9 +467,9 @@
auto findMutable = connector->second.find("Mutable");
if (findMutable != connector->second.end())
{
- auto ptrMutable =
+ const auto* ptrMutable =
std::get_if<bool>(&(findMutable->second));
- if (ptrMutable)
+ if (ptrMutable != nullptr)
{
isValueMutable = *ptrMutable;
}
@@ -483,7 +484,8 @@
auto findLED = connector->second.find("LED");
if (findLED != connector->second.end())
{
- auto ledName = std::get_if<std::string>(&(findLED->second));
+ const auto* ledName =
+ std::get_if<std::string>(&(findLED->second));
if (ledName == nullptr)
{
std::cerr << "Wrong format for LED of " << sensorName
@@ -504,7 +506,7 @@
led);
if (!pwmPath.empty() && fs::exists(pwmPath) &&
- !pwmSensors.count(pwmPath))
+ (pwmSensors.count(pwmPath) == 0U))
{
pwmSensors[pwmPath] = std::make_unique<PwmSensor>(
pwmName, pwmPath, dbusConnection, objectServer,