diff options
| author | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-08-14 23:29:18 +0200 |
|---|---|---|
| committer | Silvan Mosberger <silvan.mosberger@tweag.io> | 2023-08-14 23:32:42 +0200 |
| commit | 150217c1ac10fbef93e03694f6955029249c9aa4 (patch) | |
| tree | 7d19ab363ffd7a785f3c1cbe52073c5db3f92757 /lib | |
| parent | lib.removePrefix: Add tests (diff) | |
| download | nixpkgs-150217c1ac10fbef93e03694f6955029249c9aa4.tar.gz | |
lib.removePrefix: Optimise
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/strings.nix | 4 |
1 files 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); |
