From 85e32af8ef67bde9c5a8c7dbf06bb9dcec392c9f Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Mon, 25 May 2026 23:14:39 -0400 Subject: [PATCH] stdenv/problems: don't create pname variable A package failing an automatic problem (of which there's currently only one) is rare. A package having meta.problems specified is even rarer. Inlining the getName call to its two usages saves a thunk in the vast, vast majority of cases, and I consider it to be worth it. --- pkgs/stdenv/generic/problems.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkgs/stdenv/generic/problems.nix b/pkgs/stdenv/generic/problems.nix index ea4703954a30..0f03c393e384 100644 --- a/pkgs/stdenv/generic/problems.nix +++ b/pkgs/stdenv/generic/problems.nix @@ -478,27 +478,25 @@ rec { ) automaticProblems; in attrs: - let - pname = getName attrs; - in if # Fast path for when there's no problem that needs to be handled all ( - problem: problem.condition attrs -> problem.handler pname == "ignore" + problem: problem.condition attrs -> problem.handler (getName attrs) == "ignore" ) automaticProblemsConfigCache && ( # No manual problems !attrs ? meta.problems # Or all manual problems are ignored - || all (name: handlerForProblem (attrs.meta.problems.${name}.kind or name) name pname == "ignore") ( - attrNames attrs.meta.problems - ) + || all ( + name: handlerForProblem (attrs.meta.problems.${name}.kind or name) name (getName attrs) == "ignore" + ) (attrNames attrs.meta.problems) ) then null else # Slow path, only here we actually figure out which problems we need to handle let + pname = getName attrs; problems = attrs.meta.problems or { } // genAutomaticProblems config attrs; problemsToHandle = filter (v: v.handler != "ignore") ( mapAttrsToList (name: problem: rec {