fix clippy warnings on util and rpc

This commit is contained in:
Trinity Pointard
2021-04-09 02:32:42 +02:00
committed by Alex Auvolat
parent 88925ebe22
commit f05bb111c2
9 changed files with 45 additions and 51 deletions
+3 -3
View File
@@ -57,7 +57,7 @@ where
trace!(
"Request message: {}",
serde_json::to_string(&msg)
.unwrap_or("<json error>".into())
.unwrap_or_else(|_| "<json error>".into())
.chars()
.take(100)
.collect::<String>()
@@ -123,7 +123,7 @@ impl RpcServer {
req: Request<Body>,
addr: SocketAddr,
) -> Result<Response<Body>, Error> {
if req.method() != &Method::POST {
if req.method() != Method::POST {
let mut bad_request = Response::default();
*bad_request.status_mut() = StatusCode::BAD_REQUEST;
return Ok(bad_request);
@@ -201,7 +201,7 @@ impl RpcServer {
.get_ref()
.0
.peer_addr()
.unwrap_or(([0, 0, 0, 0], 0).into());
.unwrap_or_else(|_| ([0, 0, 0, 0], 0).into());
let self_arc = self_arc.clone();
async move {
Ok::<_, Error>(service_fn(move |req: Request<Body>| {