lib.fetchers.normalizeHash: avoid expensive builtins.tail call

This commit is contained in:
Eman Resu
2026-05-19 21:53:22 -04:00
parent 0466dc5b70
commit a64ab557a0

View File

@@ -15,7 +15,7 @@ let
inherit (lib)
concatMapStringsSep
head
tail
length
throwIf
;
inherit (lib.attrsets)
@@ -125,7 +125,7 @@ rec {
in
if hashesAsNVPairs == [ ] then
throwIf required "fetcher called without `hash`" null
else if tail hashesAsNVPairs != [ ] then
else if length hashesAsNVPairs != 1 then
throw "fetcher called with mutually-incompatible arguments: ${
concatMapStringsSep ", " (a: a.name) hashesAsNVPairs
}"