Skip to content

Commit

Permalink
fixup! More generic impl of Replacer for closures
Browse files Browse the repository at this point in the history
Do not use the same lifetime for reference and type parameter of
`Captures`.
  • Loading branch information
JanBeh committed Jul 20, 2023
1 parent 092b770 commit adf66a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/regex/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2375,15 +2375,15 @@ impl<'c, 'h> core::iter::FusedIterator for SubCaptureMatches<'c, 'h> {}
/// [`Replacer`].
pub trait ReplacerClosure<'a>
where
Self: FnMut(&'a Captures<'a>) -> <Self as ReplacerClosure>::Output,
Self: FnMut(&'a Captures<'_>) -> <Self as ReplacerClosure<'a>>::Output,
{
/// Return type of the closure (may depend on lifetime `'a`).
type Output: AsRef<str>;
}

impl<'a, F: ?Sized, O> ReplacerClosure<'a> for F
where
F: FnMut(&'a Captures<'a>) -> O,
F: FnMut(&'a Captures<'_>) -> O,
O: AsRef<str>,
{
type Output = O;
Expand Down

0 comments on commit adf66a8

Please sign in to comment.