lib/modules: Minor performance optimisation

Co-Authored-By: Johannes Kirschbauer <hsjobeki@gmail.com>
This commit is contained in:
Silvan Mosberger
2024-12-02 15:54:20 +01:00
parent 45f0035a83
commit 14f4431d12

View File

@@ -763,17 +763,24 @@ let
}; };
}; };
mergedType' =
if mergedType ? functor.wrappedDeprecationMessage then
addDeprecatedWrapped mergedType
else
mergedType;
typeSet = typeSet =
if (bothHave "type") && typesMergeable then if opt.options ? type then
{ type = mergedType'; } if res ? type then
else if opt.options ? type && opt.options.type ? functor.wrappedDeprecationMessage then if typesMergeable then
{ type = addDeprecatedWrapped opt.options.type; } {
type =
if mergedType ? functor.wrappedDeprecationMessage then
addDeprecatedWrapped mergedType
else
mergedType;
}
else
# Keep in sync with the same error below!
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
else if opt.options.type ? functor.wrappedDeprecationMessage then
{ type = addDeprecatedWrapped opt.options.type; }
else
{}
else else
{}; {};
@@ -782,9 +789,9 @@ let
if bothHave "default" || if bothHave "default" ||
bothHave "example" || bothHave "example" ||
bothHave "description" || bothHave "description" ||
bothHave "apply" || bothHave "apply"
(bothHave "type" && (! typesMergeable))
then then
# Keep in sync with the same error above!
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}." throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
else else
let let