File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ where Fut: Future<Output=T>
39
39
/// });
40
40
///
41
41
/// pin_utils::pin_mut!(s);
42
- /// assert_eq!(s.next().await, Some(1 ));
43
- /// assert_eq!(s.next().await, Some(2 ));
44
- /// assert_eq!(s.next().await, Some(3 ));
42
+ /// assert_eq!(s.next().await, Some(23 ));
43
+ /// assert_eq!(s.next().await, Some(24 ));
44
+ /// assert_eq!(s.next().await, Some(25 ));
45
45
/// #
46
46
/// # }) }
47
47
///
@@ -83,20 +83,18 @@ where
83
83
84
84
fn poll_next ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
85
85
match & self . future {
86
- Some ( _) => {
87
- let next = futures_core:: ready!( self . as_mut( ) . future( ) . as_pin_mut( ) . unwrap( ) . poll( cx) ) ;
88
- self . as_mut ( ) . future ( ) . set ( None ) ;
89
-
90
- Poll :: Ready ( Some ( next) )
91
- } ,
92
86
None => {
93
87
let x = self . next ;
94
88
let fut = ( self . as_mut ( ) . successor ( ) ) ( x) ;
95
89
self . as_mut ( ) . future ( ) . set ( Some ( fut) ) ;
96
- // Probably can poll the value here?
97
- Poll :: Pending
98
90
}
91
+ _ => { } ,
99
92
}
93
+
94
+ let next = futures_core:: ready!( self . as_mut( ) . future( ) . as_pin_mut( ) . unwrap( ) . poll( cx) ) ;
95
+ * self . as_mut ( ) . next ( ) = next;
96
+ self . as_mut ( ) . future ( ) . set ( None ) ;
97
+ Poll :: Ready ( Some ( next) )
100
98
}
101
99
}
102
100
You can’t perform that action at this time.
0 commit comments