From bf62f564d205b8bf347ddaa217bae1613c16cbf8 Mon Sep 17 00:00:00 2001 From: tottoto Date: Tue, 9 Apr 2024 21:56:46 +0900 Subject: [PATCH] refactor client body (#1464) * remove unnecessary heap pin Signed-off-by: tottoto * use Poll::map_err method to convert error type Signed-off-by: tottoto --------- Signed-off-by: tottoto --- kube-client/src/client/body.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kube-client/src/client/body.rs b/kube-client/src/client/body.rs index 960a9801e..b2888d0de 100644 --- a/kube-client/src/client/body.rs +++ b/kube-client/src/client/body.rs @@ -1,8 +1,8 @@ use std::{ error::Error as StdError, fmt, - pin::Pin, - task::{ready, Context, Poll}, + pin::{pin, Pin}, + task::{Context, Poll}, }; use bytes::Bytes; @@ -87,10 +87,7 @@ impl HttpBody for Body { ) -> Poll, Self::Error>>> { match &mut self.kind { Kind::Once(val) => Poll::Ready(val.take().map(|bytes| Ok(Frame::data(bytes)))), - Kind::Wrap(body) => Poll::Ready( - ready!(Pin::new(body).poll_frame(cx)) - .map(|opt_chunk| opt_chunk.map_err(crate::Error::Service)), - ), + Kind::Wrap(body) => pin!(body).poll_frame(cx).map_err(crate::Error::Service), } }