diff options
author | 2023-03-18 21:59:48 +0300 | |
---|---|---|
committer | 2023-03-18 22:39:56 +0300 | |
commit | 006f07637f7469b27eb45856bc960b0763b89680 (patch) | |
tree | 58cf74842b90741ba82b926a6f5dcfac65ce606c /test/queueloader.cpp | |
parent | 383dac266d7e4da153e7509a198713c73e58327f (diff) | |
download | newsboat-006f07637f7469b27eb45856bc960b0763b89680.tar.gz newsboat-006f07637f7469b27eb45856bc960b0763b89680.tar.zst newsboat-006f07637f7469b27eb45856bc960b0763b89680.zip |
Use std algorithm instead of a raw loop
This fixes a cppcheck warning.
Diffstat (limited to '')
-rw-r--r-- | test/queueloader.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/queueloader.cpp b/test/queueloader.cpp index 8160c69b..9153741f 100644 --- a/test/queueloader.cpp +++ b/test/queueloader.cpp @@ -16,12 +16,10 @@ using namespace podboat; bool contains_download_with_status(const std::vector<Download>& downloads, DlStatus status) { - for (const Download& d : downloads) { - if (d.status() == status) { - return true; - } - } - return false; + return std::any_of( + std::begin(downloads), + std::end(downloads), + [status](const Download& d) -> bool { return d.status() == status; }); } TEST_CASE("Passes the callback to Download objects", "[QueueLoader]") |