Skip to content

Commit

Permalink
clippy clean
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Jan 5, 2024
1 parent e28f0b6 commit 4c06798
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion poem-grpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ fn create_client_endpoint(

Ok::<_, poem::Error>(HttpResponse::from(hyper::Response::from_parts(
parts,
body.map_err(|err| IoError::other(err)),
body.map_err(IoError::other),
)))
}
}))
Expand Down
4 changes: 2 additions & 2 deletions poem-grpc/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub(crate) fn create_encode_response_body<T: Encoder>(
});

BodyExt::boxed(StreamBody::new(
ReceiverStream::new(rx).map(|frame| Ok::<_, IoError>(frame)),
ReceiverStream::new(rx).map(Ok::<_, IoError>),
))
.into()
}
Expand All @@ -160,7 +160,7 @@ pub(crate) fn create_encode_request_body<T: Encoder>(
});

BodyExt::boxed(StreamBody::new(
ReceiverStream::new(rx).map(|frame| Ok::<_, IoError>(frame)),
ReceiverStream::new(rx).map(Ok::<_, IoError>),
))
.into()
}
Expand Down
4 changes: 2 additions & 2 deletions poem/src/listener/acme/jose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub(crate) async fn request(
None => Some(Jwk::new(key_pair)),
Some(_) => None,
};
let protected = Protected::base64(jwk, kid, nonce, &uri.to_string())?;
let protected = Protected::base64(jwk, kid, nonce, uri)?;
let payload = match payload {
Some(payload) => serde_json::to_vec(&payload).map_err(|err| {
IoError::new(ErrorKind::Other, format!("failed to encode payload: {err}"))
Expand Down Expand Up @@ -145,7 +145,7 @@ pub(crate) async fn request(
format!("unexpected status code: status = {}", resp.status()),
));
}
Ok(resp.into())
Ok(resp)
}

pub(crate) async fn request_json<T, R>(
Expand Down
4 changes: 2 additions & 2 deletions poem/src/listener/rustls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ impl RustlsConfig {
WebPkiClientVerifier::builder(read_trust_anchor(trust_anchor)?.into())
.allow_unauthenticated()
.build()
.map_err(|err| IoError::other(err))?;
.map_err(IoError::other)?;
builder.with_client_cert_verifier(verifier)
}
TlsClientAuth::Required(trust_anchor) => {
let verifier =
WebPkiClientVerifier::builder(read_trust_anchor(trust_anchor)?.into())
.build()
.map_err(|err| IoError::other(err))?;
.map_err(IoError::other)?;
builder.with_client_cert_verifier(verifier)
}
};
Expand Down
2 changes: 1 addition & 1 deletion poem/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl From<(http::Request<Incoming>, LocalAddr, RemoteAddr, Scheme)> for Request
version: parts.version,
headers: parts.headers,
extensions: parts.extensions,
body: Body(body.map_err(|err| Error::other(err)).boxed()),
body: Body(body.map_err(Error::other).boxed()),
state: RequestState {
local_addr,
remote_addr,
Expand Down
1 change: 0 additions & 1 deletion poem/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ async fn serve_connection(
tokio::select! {
_ = conn => {
// Connection completed successfully.
return;
},
_ = connection_shutdown_token.cancelled() => {
tracing::info!(remote_addr=%remote_addr, "closing connection due to inactivity");
Expand Down

0 comments on commit 4c06798

Please sign in to comment.