summaryrefslogtreecommitdiff
path: root/src/command
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-10-14 15:21:56 -0700
committerRosen Penev <rosenp@gmail.com>2020-10-28 15:51:21 -0700
commitf1fc5d79ca7fef36f726a350bb571e5bee45c6da (patch)
treed3d5623d99f01eba55589c288cb797834454972c /src/command
parentad585e179f900ce1038c8a026182a8201d19474c (diff)
clang-tidy: convert to all/any_of
Found with readability-use-anyofallof Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/command')
-rw-r--r--src/command/FileCommands.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx
index 814289321..df097924a 100644
--- a/src/command/FileCommands.cxx
+++ b/src/command/FileCommands.cxx
@@ -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