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:
parent
ad585e179f
commit
f1fc5d79ca
@ -113,12 +113,9 @@ IsValidName(const StringView s) noexcept
|
|||||||
if (s.empty() || !IsAlphaASCII(s.front()))
|
if (s.empty() || !IsAlphaASCII(s.front()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const char ch : s) {
|
return std::none_of(s.begin(), s.end(), [=](const auto &ch) {
|
||||||
if (!IsAlphaASCII(ch) && ch != '_' && ch != '-')
|
return !IsAlphaASCII(ch) && ch != '_' && ch != '-';
|
||||||
return false;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
|
@ -356,11 +356,9 @@ SendConstraints(mpd_connection *connection, const SongFilter &filter)
|
|||||||
filter.ToExpression().c_str());
|
filter.ToExpression().c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (const auto &i : filter.GetItems())
|
return std::all_of(
|
||||||
if (!SendConstraints(connection, *i))
|
filter.GetItems().begin(), filter.GetItems().end(),
|
||||||
return false;
|
[=](const auto &item) { return SendConstraints(connection, *item); });
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -896,11 +894,8 @@ IsFilterFullySupported(const SongFilter &filter,
|
|||||||
(void)connection;
|
(void)connection;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (const auto &i : filter.GetItems())
|
return std::all_of(filter.GetItems().begin(), filter.GetItems().end(),
|
||||||
if (!IsFilterSupported(*i))
|
[](const auto &item) { return IsFilterSupported(*item); });
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
|
@ -429,29 +429,27 @@ SongFilter::Match(const LightSong &song) const noexcept
|
|||||||
bool
|
bool
|
||||||
SongFilter::HasFoldCase() const noexcept
|
SongFilter::HasFoldCase() const noexcept
|
||||||
{
|
{
|
||||||
for (const auto &i : and_filter.GetItems()) {
|
return std::any_of(
|
||||||
if (auto t = dynamic_cast<const TagSongFilter *>(i.get())) {
|
and_filter.GetItems().begin(), and_filter.GetItems().end(),
|
||||||
if (t->GetFoldCase())
|
[](const auto &item) {
|
||||||
return true;
|
if (auto t = dynamic_cast<const TagSongFilter *>(item.get()))
|
||||||
} else if (auto u = dynamic_cast<const UriSongFilter *>(i.get())) {
|
return t->GetFoldCase();
|
||||||
if (u->GetFoldCase())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
if (auto u = dynamic_cast<const UriSongFilter *>(item.get()))
|
||||||
|
return u->GetFoldCase();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SongFilter::HasOtherThanBase() const noexcept
|
SongFilter::HasOtherThanBase() const noexcept
|
||||||
{
|
{
|
||||||
for (const auto &i : and_filter.GetItems()) {
|
return std::any_of(and_filter.GetItems().begin(), and_filter.GetItems().end(),
|
||||||
const auto *f = dynamic_cast<const BaseSongFilter *>(i.get());
|
[=](const auto &item) {
|
||||||
if (f == nullptr)
|
return !dynamic_cast<const BaseSongFilter *>(
|
||||||
return true;
|
item.get());
|
||||||
}
|
});
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user