From b28cc38c3858f39499f08149f2d617a10f68c76e Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 23 Aug 2023 19:12:59 -0500 Subject: [PATCH] Simplify Streamer --- src/stream.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/stream.rs b/src/stream.rs index 60a0728..9833050 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -139,12 +139,9 @@ impl Streamer { where S: Stream + Unpin, { - let opt = match self.0 { - Some(ref mut stream) => { - std::future::poll_fn(|cx| Pin::new(&mut *stream).poll_next(cx)).await - } - None => None, - }; + let stream = self.0.as_mut().take()?; + + let opt = std::future::poll_fn(|cx| Pin::new(&mut *stream).poll_next(cx)).await; if opt.is_none() { self.0.take();