diff --git a/viz-core/src/body.rs b/viz-core/src/body.rs index c11bb279..df2103ed 100644 --- a/viz-core/src/body.rs +++ b/viz-core/src/body.rs @@ -50,18 +50,19 @@ impl Body for IncomingBody { cx: &mut Context<'_>, ) -> Poll, Self::Error>>> { match self.get_mut() { - Self::Empty | Self::Incoming(None) => Poll::Ready(None), - Self::Incoming(s) => { - match Pin::new(s.as_mut().unwrap()).poll_frame(cx)? { + Self::Empty => Poll::Ready(None), + Self::Incoming(i) => match i { + None => Poll::Ready(None), + Some(b) => match Pin::new(b).poll_frame(cx)? { Poll::Ready(Some(f)) => Poll::Ready(Some(Ok(f))), Poll::Ready(None) => { // the body has been used. - *s = None; + *i = None; Poll::Ready(None) } Poll::Pending => Poll::Pending, - } - } + }, + }, } }