about summary refs log tree commit diff
path: root/library/alloc/tests
diff options
context:
space:
mode:
authorBenoît du Garreau <bdgdlm@outlook.com>2024-07-08 14:30:17 +0200
committerBenoît du Garreau <bdgdlm@outlook.com>2024-07-15 12:12:44 +0200
commit772315de7c1f68bb95de5a7eb85cb2f167834c53 (patch)
tree73b689bdedf64fcaff5f0e94e5b7b7659d0cc987 /library/alloc/tests
parent0da95bd8698d9edd684e0978e888ad1bd29f19ba (diff)
downloadrust-772315de7c1f68bb95de5a7eb85cb2f167834c53.tar.gz
rust-772315de7c1f68bb95de5a7eb85cb2f167834c53.zip
Remove generic lifetime parameter of trait `Pattern`
Use a GAT for `Searcher` associated type because this trait is always
implemented for every lifetime anyway.
Diffstat (limited to 'library/alloc/tests')
-rw-r--r--library/alloc/tests/str.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/library/alloc/tests/str.rs b/library/alloc/tests/str.rs
index 0078f5eaa3d..de5d3991c91 100644
--- a/library/alloc/tests/str.rs
+++ b/library/alloc/tests/str.rs
@@ -1927,12 +1927,10 @@ mod pattern {
         }
     }
 
-    fn cmp_search_to_vec<'a>(
-        rev: bool,
-        pat: impl Pattern<'a, Searcher: ReverseSearcher<'a>>,
-        haystack: &'a str,
-        right: Vec<SearchStep>,
-    ) {
+    fn cmp_search_to_vec<P>(rev: bool, pat: P, haystack: &str, right: Vec<SearchStep>)
+    where
+        P: for<'a> Pattern<Searcher<'a>: ReverseSearcher<'a>>,
+    {
         let mut searcher = pat.into_searcher(haystack);
         let mut v = vec![];
         loop {
@@ -2191,9 +2189,9 @@ generate_iterator_test! {
 fn different_str_pattern_forwarding_lifetimes() {
     use std::str::pattern::Pattern;
 
-    fn foo<'a, P>(p: P)
+    fn foo<P>(p: P)
     where
-        for<'b> &'b P: Pattern<'a>,
+        for<'b> &'b P: Pattern,
     {
         for _ in 0..3 {
             "asdf".find(&p);