Use std::ranges::all_of in parse_tree_unittest
This patch addresses a TODO comment by replacing `std::all_of` with the
more modern C++20 `std::ranges::all_of`.
This change was previously blocked by CI/CQ infrastructure not yet
supporting the feature. Now that it is supported, this refactoring
improves code readability and modernizes the codebase.
Bug: 433861937
Change-Id: If51865ba87575e1ab4ee7b9337660c7981d5b7ba
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/19520
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@google.com>
diff --git a/src/gn/parse_tree_unittest.cc b/src/gn/parse_tree_unittest.cc
index d72e579..c5bfa82 100644
--- a/src/gn/parse_tree_unittest.cc
+++ b/src/gn/parse_tree_unittest.cc
@@ -197,12 +197,10 @@
auto all_elements_are_literal_nodes =
[](base::span<const std::unique_ptr<const ParseNode>> container) -> bool {
- // TODO(thestig): Switch to std::ranges::all_of() when the CI/CQ bots all
- // support it.
- return std::all_of(container.begin(), container.end(),
- [](const std::unique_ptr<const ParseNode>& element) {
- return element->AsLiteral();
- });
+ return std::ranges::all_of(
+ container, [](const std::unique_ptr<const ParseNode>& element) {
+ return element->AsLiteral();
+ });
};
auto get_literal_value = [](const ParseNode& node) {