Skip to content

Commit

Permalink
use Poll::map_err method to convert error type
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Apr 9, 2024
1 parent 689de48 commit 4bb9176
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kube-client/src/client/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{
error::Error as StdError,
fmt,
pin::{pin, Pin},
task::{ready, Context, Poll},
task::{Context, Poll},
};

use bytes::Bytes;
Expand Down Expand Up @@ -87,9 +87,7 @@ impl HttpBody for Body {
) -> Poll<Option<Result<Frame<Self::Data>, 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!(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),
}
}

Expand Down

0 comments on commit 4bb9176

Please sign in to comment.