forked from mirror/async-std
Fixes review issues
This commit is contained in:
parent
0080a0da8c
commit
efe351659f
1 changed files with 10 additions and 10 deletions
|
@ -31,23 +31,23 @@ impl<S, F, T, B> FoldFuture<S, F, T, B> {
|
|||
|
||||
impl<S, F, B> Future for FoldFuture<S, F, S::Item, B>
|
||||
where
|
||||
S: Stream + Unpin + Sized,
|
||||
S: Stream + Sized,
|
||||
F: FnMut(B, S::Item) -> B,
|
||||
{
|
||||
type Output = B;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
let next = futures_core::ready!(self.as_mut().stream().poll_next(cx));
|
||||
loop {
|
||||
let next = futures_core::ready!(self.as_mut().stream().poll_next(cx));
|
||||
|
||||
match next {
|
||||
Some(v) => {
|
||||
cx.waker().wake_by_ref();
|
||||
let old = self.as_mut().acc().take().unwrap();
|
||||
let new = (self.as_mut().f())(old, v);
|
||||
*self.as_mut().acc() = Some(new);
|
||||
Poll::Pending
|
||||
match next {
|
||||
Some(v) => {
|
||||
let old = self.as_mut().acc().take().unwrap();
|
||||
let new = (self.as_mut().f())(old, v);
|
||||
*self.as_mut().acc() = Some(new);
|
||||
}
|
||||
None => return Poll::Ready(self.as_mut().acc().take().unwrap()),
|
||||
}
|
||||
None => Poll::Ready(self.as_mut().acc().take().unwrap()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue