From e79febe47cf1e47c11b901a9b476749b8668e2fc Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Fri, 2 Aug 2024 14:35:43 +0200 Subject: [PATCH 1/3] Rust nightly removed the lifetime from Pattern --- src/pattern.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pattern.rs b/src/pattern.rs index 2db04d8b3..4041dda6b 100644 --- a/src/pattern.rs +++ b/src/pattern.rs @@ -10,10 +10,10 @@ pub struct RegexSearcher<'r, 't> { next_match: Option<(usize, usize)>, } -impl<'r, 't> Pattern<'t> for &'r Regex { - type Searcher = RegexSearcher<'r, 't>; +impl<'r> Pattern for &'r Regex { + type Searcher<'t> = RegexSearcher<'r, 't>; - fn into_searcher(self, haystack: &'t str) -> RegexSearcher<'r, 't> { + fn into_searcher(self, haystack: &str) -> RegexSearcher<'r, '_> { RegexSearcher { haystack, it: self.find_iter(haystack), From b587720ebe0ebb3e46bddea24b9955d07efca537 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:49:21 +0200 Subject: [PATCH 2/3] Don't elide lifetime --- src/pattern.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pattern.rs b/src/pattern.rs index 4041dda6b..fc4da692e 100644 --- a/src/pattern.rs +++ b/src/pattern.rs @@ -13,7 +13,7 @@ pub struct RegexSearcher<'r, 't> { impl<'r> Pattern for &'r Regex { type Searcher<'t> = RegexSearcher<'r, 't>; - fn into_searcher(self, haystack: &str) -> RegexSearcher<'r, '_> { + fn into_searcher<'h>(self, haystack: &'h str) -> RegexSearcher<'r, 'h> { RegexSearcher { haystack, it: self.find_iter(haystack), From 8d87475772acc83b0675a670c7eab2bc955282a0 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:54:25 +0200 Subject: [PATCH 3/3] Rename lifetime --- src/pattern.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pattern.rs b/src/pattern.rs index fc4da692e..5c4260e95 100644 --- a/src/pattern.rs +++ b/src/pattern.rs @@ -13,7 +13,7 @@ pub struct RegexSearcher<'r, 't> { impl<'r> Pattern for &'r Regex { type Searcher<'t> = RegexSearcher<'r, 't>; - fn into_searcher<'h>(self, haystack: &'h str) -> RegexSearcher<'r, 'h> { + fn into_searcher<'t>(self, haystack: &'t str) -> RegexSearcher<'r, 't> { RegexSearcher { haystack, it: self.find_iter(haystack),