mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
lib.customisation: Don't allocate intermediate list for missing args
This commit is contained in:
parent
7903613b0b
commit
8d162ec7b8
1 changed files with 3 additions and 3 deletions
|
@ -160,7 +160,7 @@ rec {
|
||||||
|
|
||||||
# a list of argument names that the function requires, but
|
# a list of argument names that the function requires, but
|
||||||
# wouldn't be passed to it
|
# wouldn't be passed to it
|
||||||
missingArgs = attrNames
|
missingArgs =
|
||||||
# Filter out arguments that have a default value
|
# Filter out arguments that have a default value
|
||||||
(filterAttrs (name: value: ! value)
|
(filterAttrs (name: value: ! value)
|
||||||
# Filter out arguments that would be passed
|
# Filter out arguments that would be passed
|
||||||
|
@ -198,9 +198,9 @@ rec {
|
||||||
+ "${loc'}${prettySuggestions (getSuggestions arg)}";
|
+ "${loc'}${prettySuggestions (getSuggestions arg)}";
|
||||||
|
|
||||||
# Only show the error for the first missing argument
|
# Only show the error for the first missing argument
|
||||||
error = errorForArg (head missingArgs);
|
error = errorForArg missingArgs.${head (attrNames missingArgs)};
|
||||||
|
|
||||||
in if missingArgs == [] then makeOverridable f allArgs else abort error;
|
in if missingArgs == {} then makeOverridable f allArgs else abort error;
|
||||||
|
|
||||||
|
|
||||||
/* Like callPackage, but for a function that returns an attribute
|
/* Like callPackage, but for a function that returns an attribute
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue