Use std::count_if to count non-leaf partition children.
diff --git a/verible/common/formatting/token-partition-tree.cc b/verible/common/formatting/token-partition-tree.cc
index 2d63430..0c96ef2 100644
--- a/verible/common/formatting/token-partition-tree.cc
+++ b/verible/common/formatting/token-partition-tree.cc
@@ -790,11 +790,11 @@
 // Only merge leading *leaf* fragments. Nested argument lists (non-leaves)
 // are flattened only when another non-leaf (the real port list) follows.
 static int CountNonLeafChildren(const TokenPartitionTree &node) {
-  int n = 0;
-  for (const auto &child : node.Children()) {
-    if (!is_leaf(child)) ++n;
-  }
-  return n;
+  const auto &children = node.Children();
+  return std::count_if(children.begin(), children.end(),
+                       [](const TokenPartitionTree &child) {
+                         return !is_leaf(child);
+                       });
 }
 
 static void CollapseHeaderFragmentsBeforeArgs(TokenPartitionTree *node) {