From 0080a0da8ceda7b7b00af0a512cffa3d9dee8b09 Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Thu, 12 Sep 2019 18:15:20 +0300 Subject: [PATCH] change expect to unwrap --- src/stream/stream/fold.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/stream/stream/fold.rs b/src/stream/stream/fold.rs index 91a1c8c8..05d49371 100644 --- a/src/stream/stream/fold.rs +++ b/src/stream/stream/fold.rs @@ -42,21 +42,12 @@ where match next { Some(v) => { cx.waker().wake_by_ref(); - let old = self - .as_mut() - .acc() - .take() - .expect("FoldFuture should never contain None"); + let old = self.as_mut().acc().take().unwrap(); let new = (self.as_mut().f())(old, v); *self.as_mut().acc() = Some(new); Poll::Pending } - None => Poll::Ready( - self.as_mut() - .acc() - .take() - .expect("FoldFuture should never contain None"), - ), + None => Poll::Ready(self.as_mut().acc().take().unwrap()), } } }