From 855f2d04358991a8cd10d4f7b5ff9e0b0ea53901 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:00 -0400 Subject: [PATCH] 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. --- lib/strings.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/strings.nix b/lib/strings.nix index b81a04a6666b..a926edfaeba6 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -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; /**