clang-tidy: Enable performance-faster-string-find check
Optimize calls to std::string::find() and friends when the needle
passed is a single character string literal. The character literal
overload is more efficient.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I7cfc50410d6b6c9057995df8db47084445119d7b
diff --git a/.clang-tidy b/.clang-tidy
index 190d32f..8a30c2a 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -227,6 +227,7 @@
modernize-use-transparent-functors,
modernize-use-uncaught-exceptions,
modernize-use-using,
+performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index 6cb5b8a..cf64862 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -91,7 +91,7 @@
return;
}
- auto pos = path.rfind("/");
+ auto pos = path.rfind('/');
if (pos == std::string::npos)
{
using namespace xyz::openbmc_project::Common;