0

Use base::ranges::transform() instead std::transform in //components and //content

1. Use base::ranges::transform() instead std::transform in //components and //content.

2. Simplify some code.

Bug: 1368812
Change-Id: If11aebc2a25e38b8f7398e05631e3266cbc283c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5151747
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1244128}
This commit is contained in:
Binoy Kumar Sutradhar
2024-01-08 17:40:38 +00:00
committed by Chromium LUCI CQ
parent bd606706e7
commit ed18e17887
3 changed files with 9 additions and 6 deletions
components
allocation_recorder
safe_search_api
content/public/test

@ -17,6 +17,7 @@
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/safe_search_api/fake_url_checker_client.h"
@ -55,8 +56,8 @@ ClientClassification ToAPIClassification(Classification classification,
auto Recorded(const std::map<CacheAccessStatus, int>& expected) {
std::vector<base::Bucket> buckets_array;
std::transform(
expected.begin(), expected.end(), std::back_inserter(buckets_array),
base::ranges::transform(
expected, std::back_inserter(buckets_array),
[](auto& entry) { return base::Bucket(entry.first, entry.second); });
return base::BucketsInclude(buckets_array);
}