Skip to content

Commit efe3516

Browse files
committed
Fixes review issues
1 parent 0080a0d commit efe3516

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/stream/stream/fold.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ impl<S, F, T, B> FoldFuture<S, F, T, B> {
3131

3232
impl<S, F, B> Future for FoldFuture<S, F, S::Item, B>
3333
where
34-
S: Stream + Unpin + Sized,
34+
S: Stream + Sized,
3535
F: FnMut(B, S::Item) -> B,
3636
{
3737
type Output = B;
3838

3939
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
40-
let next = futures_core::ready!(self.as_mut().stream().poll_next(cx));
40+
loop {
41+
let next = futures_core::ready!(self.as_mut().stream().poll_next(cx));
4142

42-
match next {
43-
Some(v) => {
44-
cx.waker().wake_by_ref();
45-
let old = self.as_mut().acc().take().unwrap();
46-
let new = (self.as_mut().f())(old, v);
47-
*self.as_mut().acc() = Some(new);
48-
Poll::Pending
43+
match next {
44+
Some(v) => {
45+
let old = self.as_mut().acc().take().unwrap();
46+
let new = (self.as_mut().f())(old, v);
47+
*self.as_mut().acc() = Some(new);
48+
}
49+
None => return Poll::Ready(self.as_mut().acc().take().unwrap()),
4950
}
50-
None => Poll::Ready(self.as_mut().acc().take().unwrap()),
5151
}
5252
}
5353
}

0 commit comments

Comments
 (0)