From 150217c1ac10fbef93e03694f6955029249c9aa4 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 14 Aug 2023 23:29:18 +0200 Subject: [PATCH] lib.removePrefix: Optimise --- lib/strings.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/strings.nix b/lib/strings.nix index 1eb6cf9c1afb..df891c899887 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -629,10 +629,10 @@ rec { This behavior is deprecated and will throw an error in the future.'' (let preLen = stringLength prefix; - sLen = stringLength str; in if substring 0 preLen str == prefix then - substring preLen (sLen - preLen) str + # -1 will take the string until the end + substring preLen (-1) str else str);