summary refs log tree commit diff
path: root/lib/strings.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index 820d1901f94..11066890ec3 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -253,10 +253,7 @@ rec {
       => false
   */
   hasInfix = infix: content:
-    let
-      drop = x: substring 1 (stringLength x) x;
-    in hasPrefix infix content
-      || content != "" && hasInfix infix (drop content);
+    builtins.match ".*${escapeRegex infix}.*" content != null;
 
   /* Convert a string to a list of characters (i.e. singleton strings).
      This allows you to, e.g., map a function over each character.  However,