[clang-tools-extra] [clang-tidy] Add new modernize-string-find-startswith check (PR #72385)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 15 05:43:10 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 2060bfcdc7eb704647c64bf925cdceb94c1f535f 5e5a2bac0f7373e6b1830fddc609e97dc61df9d4 -- clang-tools-extra/clang-tidy/modernize/StringFindStartswithCheck.cpp clang-tools-extra/clang-tidy/modernize/StringFindStartswithCheck.h clang-tools-extra/test/clang-tidy/checkers/modernize/string-find-startswith.cpp clang-tools-extra/clang-tidy/abseil/StringFindStartswithCheck.h clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp clang-tools-extra/test/clang-tidy/checkers/abseil/string-find-startswith.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-tidy/modernize/StringFindStartswithCheck.cpp b/clang-tools-extra/clang-tidy/modernize/StringFindStartswithCheck.cpp
index 7b992d77d0..74f59b9fce 100644
--- a/clang-tools-extra/clang-tidy/modernize/StringFindStartswithCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/StringFindStartswithCheck.cpp
@@ -92,7 +92,7 @@ void StringFindStartswithCheck::check(const MatchFinder::MatchResult &Result) {
       Context.getLangOpts());
 
   const auto ReplacementCode = (Neg ? "!" : "") + HaystackExprCode +
-                           ".starts_with(" + NeedleExprCode + ")";
+                               ".starts_with(" + NeedleExprCode + ")";
 
   diag(ComparisonExpr->getBeginLoc(),
        "use starts_with "

``````````

</details>


https://github.com/llvm/llvm-project/pull/72385


More information about the cfe-commits mailing list