Skip to content

Commit 8e9da21

Browse files
[clang-tidy] Use StringRef::consume_back (NFC) (#139412)
1 parent fd98612 commit 8e9da21

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ namespace {
1919

2020
StringRef removeFirstSuffix(StringRef Str, ArrayRef<const char *> Suffixes) {
2121
for (StringRef Suffix : Suffixes) {
22-
if (Str.ends_with(Suffix)) {
23-
return Str.substr(0, Str.size() - Suffix.size());
24-
}
22+
if (Str.consume_back(Suffix))
23+
return Str;
2524
}
2625
return Str;
2726
}

0 commit comments

Comments
 (0)