clang-tidy: convert to all/any_of

Found with readability-use-anyofallof

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2020-10-14 15:21:56 -07:00
parent ad585e179f
commit f1fc5d79ca
3 changed files with 23 additions and 33 deletions

View File

@@ -113,12 +113,9 @@ IsValidName(const StringView s) noexcept
if (s.empty() || !IsAlphaASCII(s.front()))
return false;
for (const char ch : s) {
if (!IsAlphaASCII(ch) && ch != '_' && ch != '-')
return false;
}
return true;
return std::none_of(s.begin(), s.end(), [=](const auto &ch) {
return !IsAlphaASCII(ch) && ch != '_' && ch != '-';
});
}
gcc_pure