3
0
Fork 0
forked from mirrors/nixpkgs

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