diff options
author | Ed Tanous <edtanous@google.com> | 2023-06-30 20:37:05 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-07-11 00:03:22 +0300 |
commit | db0d36efc8d4ddd8fc604b9e9d10963d19b1dae0 (patch) | |
tree | 4471933a4223b48e747d6a62ea61acbca4d1190e | |
parent | 0f83707d6f05640eeff012500ebe66a1b8020df5 (diff) | |
download | bmcweb-db0d36efc8d4ddd8fc604b9e9d10963d19b1dae0.tar.xz |
Add contains type tidy check
On general container usage, contains() is more descriptive than count()
> 0. We have one violation of this, fix it and enable the check.
Tested: Clang-tidy passes.
Change-Id: Ib5702ef97c6da033b6587c9cfebbe30dfbfe80b4
Signed-off-by: Ed Tanous <edtanous@google.com>
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/.clang-tidy b/.clang-tidy index 308c3f9be6..ffa6589dd1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -280,6 +280,7 @@ performance-unnecessary-value-param, readability-avoid-const-params-in-decls, readability-braces-around-statements, readability-const-return-type, +readability-container-contains, readability-container-data-pointer, readability-container-size-empty, readability-convert-member-functions-to-static, diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index b5d0127777..1fec8680c0 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -1230,7 +1230,7 @@ inline InventoryItem* findInventoryItemForSensor( { for (InventoryItem& inventoryItem : *inventoryItems) { - if (inventoryItem.sensors.count(sensorObjPath) > 0) + if (inventoryItem.sensors.contains(sensorObjPath)) { return &inventoryItem; } |