lib.modules: remove throwIfNot usage

throwIfNot sends our error message through a function call, even if the
error condition doesn't trigger. This requires a lot of thunk allocation
that can be easily avoided.
This commit is contained in:
Eman Resu
2026-06-30 21:38:26 -04:00
parent e1ae8a8194
commit bb50241c60
+5 -3
View File
@@ -46,7 +46,6 @@ let
setAttrByPath
substring
take
throwIfNot
trace
typeOf
types
@@ -680,8 +679,11 @@ let
config = addFreeformType (addMeta (m.config or { }));
}
else
# shorthand syntax
throwIfNot (isAttrs m) "module ${file} (${key}) does not look like a module." {
# shorthand syntax
if !isAttrs m then
throw "module ${file} (${key}) does not look like a module."
else
{
_file = toString m._file or file;
_class = m._class or null;
key = toString m.key or key;