Commit 8a207815 authored by adisbladis's avatar adisbladis
Browse files

lib.strings.trimWith: Refactor scoping

I wanted to use this instead of [my ownimplementation](https://github.com/nix-community/pyproject.nix/blob/65d4134/lib/util.nix#L18-L23) and got a small performance regression.
parent 4b6c89a6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -408,7 +408,6 @@ rec {
      start ? false,
      end ? false,
    }:
    s:
    let
      # Define our own whitespace character class instead of using
      # `[:space:]`, which is not well-defined.
@@ -425,7 +424,9 @@ rec {
          "(.*[^${chars}])[${chars}]*"
        else
          "(.*)";

    in
    s:
    let
      # If the string was empty or entirely whitespace,
      # then the regex may not match and `res` will be `null`.
      res = match regex s;