lib.strings: remove assertMsg usage
assertMsg 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:
+3
-2
@@ -2532,8 +2532,9 @@ rec {
|
||||
strw = lib.stringLength str;
|
||||
reqWidth = width - (lib.stringLength filler);
|
||||
in
|
||||
assert lib.assertMsg (strw <= width)
|
||||
"fixedWidthString: requested string length (${toString width}) must not be shorter than actual length (${toString strw})";
|
||||
assert
|
||||
strw <= width
|
||||
|| throw "fixedWidthString: requested string length (${toString width}) must not be shorter than actual length (${toString strw})";
|
||||
if strw == width then str else filler + fixedWidthString reqWidth filler str;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user