From 3ec1e90b1069a9baad558fb1c988191ccd4f6c36 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 28 May 2026 00:15:16 -0400 Subject: [PATCH] lib/modules: remove warnIf usage warnIf sends our warning message through a function call, even if the warning condition doesn't trigger. This requires a lot of thunk allocation that can be easily avoided. --- lib/modules.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 1adee44f7a33..2820aa921bf2 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1158,8 +1158,10 @@ let value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue; warnDeprecation = - warnIf (opt.type.deprecationMessage != null) - "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}"; + if (opt.type.deprecationMessage != null) then + warn "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}" + else + x: x; in warnDeprecation opt