lib/modules: Short-circuit unmatchedDefns when configs is empty

This commit is contained in:
Robert Hensing 2021-10-31 19:10:13 +01:00
parent e544ee88fa
commit d6ebd537e5

View File

@ -430,10 +430,16 @@ rec {
# an attrset 'name' => list of unmatched definitions for 'name' # an attrset 'name' => list of unmatched definitions for 'name'
unmatchedDefnsByName = unmatchedDefnsByName =
# Propagate all unmatched definitions from nested option sets if configs == []
mapAttrs (n: v: v.unmatchedDefns) resultsByName then
# Plus the definitions for the current prefix that don't have a matching option # When no config values exist, there can be no unmatched config, so
// removeAttrs defnsByName' (attrNames matchedOptions); # we short circuit and avoid evaluating more _options_ than necessary.
{}
else
# Propagate all unmatched definitions from nested option sets
mapAttrs (n: v: v.unmatchedDefns) resultsByName
# Plus the definitions for the current prefix that don't have a matching option
// removeAttrs defnsByName' (attrNames matchedOptions);
in { in {
inherit matchedOptions; inherit matchedOptions;