From d78caa3edfc06a60a3b1c41843dc17eb3c12bafa Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Thu, 25 Jul 2024 08:16:51 -0400 Subject: [PATCH] Update `partition()` signature for de-lifetiming of `Pattern` https://github.com/rust-lang/rust/pull/127481 --- src/strings/partition.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/strings/partition.rs b/src/strings/partition.rs index 780ded2..43eb147 100644 --- a/src/strings/partition.rs +++ b/src/strings/partition.rs @@ -17,10 +17,7 @@ use std::str::pattern::Pattern; /// assert_eq!(partition("abc.123-xyz", ['-', '.']), Some(("abc", ".", "123-xyz"))); /// assert_eq!(partition("abc_123_xyz", ['-', '.']), None); /// ``` -pub fn partition<'a, P: Pattern<'a>>( - s: &'a str, - pattern: P, -) -> Option<(&'a str, &'a str, &'a str)> { +pub fn partition(s: &str, pattern: P) -> Option<(&str, &str, &str)> { let (i, sep) = s.match_indices(pattern).next()?; Some((&s[..i], sep, &s[(i + sep.len())..])) }