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:
+5
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user