Skip to content

Commit

Permalink
Merge pull request #8 from jwodder/pattern-update
Browse files Browse the repository at this point in the history
Update `partition()` signature for de-lifetiming of `Pattern`
  • Loading branch information
jwodder authored Jul 25, 2024
2 parents 331b9e2 + d78caa3 commit 5537919
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 5537919

Please sign in to comment.