Skip to content

Commit

Permalink
Update partition() signature for de-lifetiming of Pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jul 25, 2024
1 parent 331b9e2 commit d78caa3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/strings/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<P: Pattern>(s: &str, pattern: P) -> Option<(&str, &str, &str)> {
let (i, sep) = s.match_indices(pattern).next()?;
Some((&s[..i], sep, &s[(i + sep.len())..]))
}
Expand Down

0 comments on commit d78caa3

Please sign in to comment.