mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 15:17:46 +00:00
Everywhere: Make use of container version of all_of
Problem: - New `all_of` implementation takes the entire container so the user does not need to pass explicit begin/end iterators. This is unused except is in tests. Solution: - Make use of the new and more user-friendly version where possible.
This commit is contained in:
parent
2c042e3530
commit
97bd13264a
10 changed files with 10 additions and 11 deletions
|
@ -120,7 +120,7 @@ String serialize_astring(StringView string)
|
|||
auto non_atom_chars = { '(', ')', '{', ' ', '%', '*', '"', '\\', ']' };
|
||||
return AK::find(non_atom_chars.begin(), non_atom_chars.end(), x) != non_atom_chars.end();
|
||||
};
|
||||
auto is_atom = all_of(string.begin(), string.end(), [&](auto ch) { return is_ascii_control(ch) && !is_non_atom_char(ch); });
|
||||
auto is_atom = all_of(string, [&](auto ch) { return is_ascii_control(ch) && !is_non_atom_char(ch); });
|
||||
if (is_atom) {
|
||||
return string;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ OrdinaryFunctionObject::OrdinaryFunctionObject(GlobalObject& global_object, cons
|
|||
set_this_mode(ThisMode::Global);
|
||||
|
||||
// 15.1.3 Static Semantics: IsSimpleParameterList, https://tc39.es/ecma262/#sec-static-semantics-issimpleparameterlist
|
||||
set_has_simple_parameter_list(all_of(m_parameters.begin(), m_parameters.end(), [&](auto& parameter) {
|
||||
set_has_simple_parameter_list(all_of(m_parameters, [&](auto& parameter) {
|
||||
if (parameter.is_rest)
|
||||
return false;
|
||||
if (parameter.default_value)
|
||||
|
|
|
@ -53,7 +53,7 @@ static bool is_valid_bigint_value(StringView string)
|
|||
string = string.trim_whitespace();
|
||||
if (string.length() > 1 && (string[0] == '-' || string[0] == '+'))
|
||||
string = string.substring_view(1, string.length() - 1);
|
||||
return all_of(string.begin(), string.end(), [](auto ch) { return isdigit(ch); });
|
||||
return all_of(string, [](auto ch) { return isdigit(ch); });
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool both_number(const Value& lhs, const Value& rhs)
|
||||
|
|
|
@ -231,7 +231,7 @@ Optional<Core::DateTime> parse_date_time(StringView date_string)
|
|||
unsigned year = 0;
|
||||
|
||||
auto to_uint = [](StringView token, unsigned& result) {
|
||||
if (!all_of(token.begin(), token.end(), isdigit))
|
||||
if (!all_of(token, isdigit))
|
||||
return false;
|
||||
|
||||
if (auto converted = token.to_uint(); converted.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue