Explorar o código

LibRegex: Use AK::any_of in Parser::lookahead_any

Equivalent to std::ranges::any_of, which clang-tidy suggests.
Hendiadyoin1 %!s(int64=3) %!d(string=hai) anos
pai
achega
303af07df8
Modificáronse 1 ficheiros con 2 adicións e 6 borrados
  1. 2 6
      Userland/Libraries/LibRegex/RegexParser.cpp

+ 2 - 6
Userland/Libraries/LibRegex/RegexParser.cpp

@@ -7,6 +7,7 @@
 
 #include "RegexParser.h"
 #include "RegexDebug.h"
+#include <AK/AnyOf.h>
 #include <AK/CharacterTypes.h>
 #include <AK/GenericLexer.h>
 #include <AK/String.h>
@@ -138,12 +139,7 @@ ALWAYS_INLINE bool Parser::try_skip(StringView str)
 
 ALWAYS_INLINE bool Parser::lookahead_any(StringView str)
 {
-    for (auto ch : str) {
-        if (match(ch))
-            return true;
-    }
-
-    return false;
+    return AK::any_of(str, [this](auto ch) { return match(ch); });
 }
 
 ALWAYS_INLINE unsigned char Parser::skip()