diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-05-06 04:59:27 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2021-05-06 04:59:27 +0200 |
commit | 98c77a0b2d7c10fc3ef811e9346d1e3cb99f1b32 (patch) | |
tree | 07783f9b29eb7ae1fff937ba662ddf65c4016e7c /lib/modules.nix | |
parent | 1374bfa2d39eff398147265ece138e0c3151b28d (diff) |
lib/modules: Small optimization
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 6b3faa447be1f..4b02d6aee2f37 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -299,13 +299,11 @@ rec { # a module will resolve strictly the attributes used as argument but # not their values. The values are forwarding the result of the # evaluation of the option. - requiredArgs = builtins.attrNames (lib.functionArgs f); context = name: ''while evaluating the module argument `${name}' in "${key}":''; - extraArgs = builtins.listToAttrs (map (name: { - inherit name; - value = builtins.addErrorContext (context name) - (args.${name} or config._module.args.${name}); - }) requiredArgs); + extraArgs = builtins.mapAttrs (name: _: + builtins.addErrorContext (context name) + (args.${name} or config._module.args.${name}) + ) (lib.functionArgs f); # Note: we append in the opposite order such that we can add an error # context on the explicited arguments of "args" too. This update |