From d03c2169d2a421e6a4469c0b80307f32fd2d292f Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Wed, 3 Jun 2026 12:54:37 -0400 Subject: [PATCH] lib.modules: inline warnDeprecation Saves 0.5% of all thunks for my personal config. --- lib/modules.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/modules.nix b/lib/modules.nix index 938b17bd3b92..8b26f2c462e8 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1138,15 +1138,13 @@ let # Apply the 'apply' function to the merged value. This allows options to # yield a value computed from the definitions value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue; - - warnDeprecation = - 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 + ( + 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}" opt + else + opt + ) // { value = addErrorContext "while evaluating the option `${showOption loc}':" value; inherit (res.defsFinal') highestPrio;