From 20506699226b0dac5d423c6f6249f3cb15565169 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 1 Mar 2022 10:45:46 +0100 Subject: [PATCH] lib.modules: Inline a private function This should save about four calls per module. --- lib/types.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/types.nix b/lib/types.nix index 73f271103fc4f..d2c109cabe813 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -566,14 +566,14 @@ rec { then value: value else value: { config = value; }; - coerce = unify: value: if isFunction value - then setFunctionArgs (args: unify (value args)) (functionArgs value) - else unify (shorthandToModule value); - allModules = defs: imap1 (n: { value, file }: - if isAttrs value || isFunction value then - # Annotate the value with the location of its definition for better error messages - coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value + if isFunction value + then setFunctionArgs + (args: lib.modules.unifyModuleSyntax file "${toString file}-${toString n}" (value args)) + (functionArgs value) + else if isAttrs value + then + lib.modules.unifyModuleSyntax file "${toString file}-${toString n}" (shorthandToModule value) else value ) defs;