From 331c4cf6997c480aee2575a8fd3c6333def3a6d5 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Thu, 30 Jul 2026 23:49:08 +0900 Subject: [PATCH] lib: improve implementation of `foldAttrs` --- lib/attrsets.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/attrsets.nix b/lib/attrsets.nix index d006ed79a2ae..14b1e014509b 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -832,9 +832,7 @@ rec { */ foldAttrs = op: nul: list_of_attrs: - foldr ( - n: a: foldr (name: o: o // { ${name} = op n.${name} (a.${name} or nul); }) a (attrNames n) - ) { } list_of_attrs; + mapAttrs (name: foldr op nul) (zipAttrs list_of_attrs); /** Recursively collect sets that verify a given predicate named `pred`