diff options
author | 2022-07-01 11:10:13 +0000 | |
---|---|---|
committer | 2022-07-01 14:20:32 +0000 | |
commit | 74e0b53a425ca3643db7dd43a39b57075853b21d (patch) | |
tree | 52c986d7bc95b7d82af902bdad5a70b34ac63c8c | |
parent | 930706936fdacc5d270c2bb174d47abe11939b8d (diff) |
Fix performance-faster-string-find clang-tidy issues
Test: m tidy-art
Bug: 213953102
Change-Id: Iff8edbd2568a085a49650bbd5e9c5826d306b2a8
-rw-r--r-- | build/Android.bp | 2 | ||||
-rw-r--r-- | cmdline/detail/cmdline_parse_argument_detail.h | 2 | ||||
-rw-r--r-- | tools/hiddenapi/hiddenapi_test.cc | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/build/Android.bp b/build/Android.bp index 389cb426d9..2d6fe04250 100644 --- a/build/Android.bp +++ b/build/Android.bp @@ -35,6 +35,7 @@ art_clang_tidy_errors = [ "bugprone-unused-raii", // Protect scoped things like MutexLock. "bugprone-virtual-near-miss", "modernize-use-bool-literals", + "performance-faster-string-find", "performance-for-range-copy", "performance-implicit-conversion-in-loop", "performance-unnecessary-copy-initialization", @@ -49,7 +50,6 @@ art_clang_tidy_allowed = [ "misc-unused-using-decls", "modernize-use-nullptr", "modernize-use-using", // TODO: move to art_clang_tidy_errors after b/236243696 is done - "performance-faster-string-find", "performance-noexcept-move-constructor", ] diff --git a/cmdline/detail/cmdline_parse_argument_detail.h b/cmdline/detail/cmdline_parse_argument_detail.h index de0a588b96..936d290ab6 100644 --- a/cmdline/detail/cmdline_parse_argument_detail.h +++ b/cmdline/detail/cmdline_parse_argument_detail.h @@ -150,7 +150,7 @@ struct CmdlineParserArgumentInfo { for (auto cname : names_) { std::string_view name = cname; if (using_blanks_) { - name = name.substr(0, name.find("_")); + name = name.substr(0, name.find('_')); } auto& os = vios.Stream(); auto print_once = [&]() { diff --git a/tools/hiddenapi/hiddenapi_test.cc b/tools/hiddenapi/hiddenapi_test.cc index 3a0e62586d..f408c6663b 100644 --- a/tools/hiddenapi/hiddenapi_test.cc +++ b/tools/hiddenapi/hiddenapi_test.cc @@ -143,7 +143,7 @@ class HiddenApiTest : public CommonRuntimeTest { std::map<std::string, std::string> flags; for (std::string line; std::getline(ifs, line);) { - std::size_t comma = line.find(","); + std::size_t comma = line.find(','); if (comma == std::string::npos) { flags.emplace(line, ""); } else { |