clang-tidy: Enable readability-string-compare check
This check finds string comparisons using the compare method.
A common mistake is to use the string’s compare method instead of
using the equality or inequality operators.
Change-Id: I261afa51d6af1db5afb94a127f45df7544911af9
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index 9ece14b..3856aa5 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -247,6 +247,7 @@
readability-redundant-preprocessor,
readability-simplify-subscript-expr,
readability-static-definition-in-anonymous-namespace,
+readability-string-compare,
readability-suspicious-call-argument,
readability-uniqueptr-delete-release,
readability-uppercase-literal-suffix'
diff --git a/item_updater.cpp b/item_updater.cpp
index 43c4c8b..fd51adb 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -685,7 +685,7 @@
{
for (auto iter = assocs.begin(); iter != assocs.end();)
{
- if ((std::get<2>(*iter)).compare(path) == 0)
+ if (std::get<2>(*iter) == path)
{
iter = assocs.erase(iter);
associations(assocs);