clang-tidy: Enable performance-faster-string-find check
This check optimizes the calls to std::string::find() when the
input passed is a single character string literal. The character
literal overload is more efficient.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I72ae6f1506d2298a067e6463bd3718d64d23fdb2
diff --git a/.clang-tidy b/.clang-tidy
index 22c21b1..4ae3f8f 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -211,6 +211,7 @@
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
misc-unused-using-decls,
+performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
diff --git a/src/item_updater.cpp b/src/item_updater.cpp
index 03b4add..254b18f 100644
--- a/src/item_updater.cpp
+++ b/src/item_updater.cpp
@@ -81,7 +81,7 @@
}
// Version id is the last item in the path
- auto pos = path.rfind("/");
+ auto pos = path.rfind('/');
if (pos == std::string::npos)
{
log<level::ERR>("No version id found in object path",