lib.isStringLike: Remove use of list

In the current implementation of Nix, this list would be allocated
over and over. Iirc pennae tried to optimize static list allocation,
but gained no significant performance improvement.
This commit is contained in:
Robert Hensing 2022-12-31 00:58:34 +01:00
parent d0d0f7d0aa
commit d103811173

View File

@ -18,6 +18,7 @@ rec {
isInt isInt
isList isList
isAttrs isAttrs
isPath
isString isString
match match
parseDrvName parseDrvName
@ -821,7 +822,8 @@ rec {
string interpolations and in most functions that expect a string. string interpolations and in most functions that expect a string.
*/ */
isStringLike = x: isStringLike = x:
elem (typeOf x) [ "path" "string" ] || isString x ||
isPath x ||
x ? outPath || x ? outPath ||
x ? __toString; x ? __toString;