automatic clang-tidy fixes
Apply fixes automatically generated by clang-tidy when ran with
clang-tidy-20. These appear to be optimization fixes around usage
of std::map and/or std::unordered_map.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ibe1ae1518cb98aa7dbc38cc796ec6ebd6c68743a
diff --git a/src/Thresholds.cpp b/src/Thresholds.cpp
index 68233c0..2489fc8 100644
--- a/src/Thresholds.cpp
+++ b/src/Thresholds.cpp
@@ -518,7 +518,7 @@
if (auto fileParts = splitFileName(inputPath))
{
auto& [type, nr, item] = *fileParts;
- if (map.count(item) != 0)
+ if (map.contains(item))
{
for (const auto& t : map.at(item))
{
diff --git a/src/Utils.cpp b/src/Utils.cpp
index b25bef9..52f9394 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -113,7 +113,7 @@
*/
searchVal = hwmonBaseName;
}
- if (permitSet.find(*searchVal) != permitSet.end())
+ if (permitSet.contains(*searchVal))
{
result = directory + "/" + hwmonBaseName + "_input";
}
diff --git a/src/intel-cpu/IntelCPUSensorMain.cpp b/src/intel-cpu/IntelCPUSensorMain.cpp
index 3326115..eede838 100644
--- a/src/intel-cpu/IntelCPUSensorMain.cpp
+++ b/src/intel-cpu/IntelCPUSensorMain.cpp
@@ -751,8 +751,7 @@
}
}
- if (inventoryIfaces.find(name) == inventoryIfaces.end() &&
- present)
+ if (!inventoryIfaces.contains(name) && present)
{
auto iface = objectServer.add_interface(
cpuInventoryPath + std::string("/") + name,
diff --git a/src/psu/PSUSensorMain.cpp b/src/psu/PSUSensorMain.cpp
index 55888cf..41072bf 100644
--- a/src/psu/PSUSensorMain.cpp
+++ b/src/psu/PSUSensorMain.cpp
@@ -338,7 +338,7 @@
std::getline(nameFile, pmbusName);
nameFile.close();
- if (sensorTypes.find(pmbusName) == sensorTypes.end())
+ if (!sensorTypes.contains(pmbusName))
{
// To avoid this error message, add your driver name to
// the pmbusNames vector at the top of this file.