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.
This commit is contained in:
Eman Resu
2026-05-25 23:14:39 -04:00
parent 0b304744b8
commit 85e32af8ef
+5 -7
View File
@@ -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 {