clang-tidy: Enable readability-redundant-string-cstr check
This check finds unnecessary calls to std::string::c_str() and
std::string::data().
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I4ff9cd7f1595a1cd7c6dbab4c7a80d6f7cf05ca2
diff --git a/.clang-tidy b/.clang-tidy
index d0c304e..dba1d69 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -273,6 +273,7 @@
readability-redundant-member-init,
readability-redundant-preprocessor,
readability-redundant-smartptr-get,
+readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
diff --git a/utils.cpp b/utils.cpp
index 1da9602..04488b2 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -113,7 +113,7 @@
"GetSubTreePaths");
method.append(objectPath.c_str());
method.append(0); // Depth 0 to search all
- method.append(std::vector<std::string>({interface.c_str()}));
+ method.append(std::vector<std::string>({interface}));
auto reply = bus.call(method);
reply.read(paths);