diff --git a/actix-http/src/body/boxed.rs b/actix-http/src/body/boxed.rs index 0c6950a1f..d109a6a74 100644 --- a/actix-http/src/body/boxed.rs +++ b/actix-http/src/body/boxed.rs @@ -77,17 +77,21 @@ impl MessageBody for BoxBody { cx: &mut Context<'_>, ) -> Poll>> { match &mut self.0 { - BoxBodyInner::None(_) => Poll::Ready(None), - BoxBodyInner::Bytes(bytes) => Pin::new(bytes).poll_next(cx).map_err(Into::into), - BoxBodyInner::Stream(stream) => Pin::new(stream).poll_next(cx), + BoxBodyInner::None(body) => { + Pin::new(body).poll_next(cx).map_err(|err| match err {}) + } + BoxBodyInner::Bytes(body) => { + Pin::new(body).poll_next(cx).map_err(|err| match err {}) + } + BoxBodyInner::Stream(body) => Pin::new(body).poll_next(cx), } } #[inline] fn try_into_bytes(self) -> Result { match self.0 { - BoxBodyInner::None(none) => Ok(none.try_into_bytes().unwrap()), - BoxBodyInner::Bytes(bytes) => Ok(bytes.try_into_bytes().unwrap()), + BoxBodyInner::None(body) => Ok(body.try_into_bytes().unwrap()), + BoxBodyInner::Bytes(body) => Ok(body.try_into_bytes().unwrap()), _ => Err(self), } } diff --git a/actix-http/src/body/message_body.rs b/actix-http/src/body/message_body.rs index bd13e75ec..cf65bac2d 100644 --- a/actix-http/src/body/message_body.rs +++ b/actix-http/src/body/message_body.rs @@ -33,7 +33,8 @@ pub trait MessageBody { /// Convert this body into `Bytes`. /// - /// Bodies with `BodySize::None` are allowed to return empty `Bytes`. + /// Body types with `BodySize::None` are allowed to return empty `Bytes`. + #[inline] fn try_into_bytes(self) -> Result where Self: Sized, @@ -139,6 +140,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, @@ -164,6 +166,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, @@ -189,6 +192,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, @@ -214,6 +218,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, @@ -239,6 +244,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, @@ -266,6 +272,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, @@ -292,6 +299,7 @@ mod foreign_impls { BodySize::Sized(self.len() as u64) } + #[inline] fn poll_next( self: Pin<&mut Self>, _cx: &mut Context<'_>, diff --git a/actix-http/src/encoding/encoder.rs b/actix-http/src/encoding/encoder.rs index 70448a115..d06d6b4d8 100644 --- a/actix-http/src/encoding/encoder.rs +++ b/actix-http/src/encoding/encoder.rs @@ -108,6 +108,7 @@ where { type Error = EncoderError; + #[inline] fn size(&self) -> BodySize { match self { EncoderBody::None => BodySize::None, @@ -131,6 +132,7 @@ where } } + #[inline] fn try_into_bytes(self) -> Result where Self: Sized, @@ -149,6 +151,7 @@ where { type Error = EncoderError; + #[inline] fn size(&self) -> BodySize { if self.encoder.is_some() { BodySize::Stream @@ -225,6 +228,7 @@ where } } + #[inline] fn try_into_bytes(mut self) -> Result where Self: Sized,