From 77942dd46dde5dccc6e210eb5dc8430dbe2ca7aa Mon Sep 17 00:00:00 2001 From: akorchyn Date: Tue, 12 Nov 2024 18:22:35 +0200 Subject: [PATCH] fmt --- src/lib.rs | 52 +++++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c43568c..0b804d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -225,31 +225,37 @@ impl JsonRpcClient { match response.status() { reqwest::StatusCode::OK => {} non_ok_status => { - return Err(JsonRpcError::ServerError( - match non_ok_status { - reqwest::StatusCode::UNAUTHORIZED => { - JsonRpcServerError::ResponseStatusError(JsonRpcServerResponseStatusError::Unauthorized) - } - reqwest::StatusCode::TOO_MANY_REQUESTS => { - JsonRpcServerError::ResponseStatusError(JsonRpcServerResponseStatusError::TooManyRequests) - } - reqwest::StatusCode::BAD_REQUEST => { - JsonRpcServerError::ResponseStatusError(JsonRpcServerResponseStatusError::BadRequest) - } - reqwest::StatusCode::INTERNAL_SERVER_ERROR => { - JsonRpcServerError::InternalError { info: Some(String::from("Internal server error")) } - } - reqwest::StatusCode::SERVICE_UNAVAILABLE => { - JsonRpcServerError::ResponseStatusError(JsonRpcServerResponseStatusError::ServiceUnavailable) - } - reqwest::StatusCode::REQUEST_TIMEOUT => { - JsonRpcServerError::ResponseStatusError(JsonRpcServerResponseStatusError::TimeoutError) - } - unexpected => { - JsonRpcServerError::ResponseStatusError(JsonRpcServerResponseStatusError::Unexpected { status: unexpected }) + return Err(JsonRpcError::ServerError(match non_ok_status { + reqwest::StatusCode::UNAUTHORIZED => JsonRpcServerError::ResponseStatusError( + JsonRpcServerResponseStatusError::Unauthorized, + ), + reqwest::StatusCode::TOO_MANY_REQUESTS => { + JsonRpcServerError::ResponseStatusError( + JsonRpcServerResponseStatusError::TooManyRequests, + ) + } + reqwest::StatusCode::BAD_REQUEST => JsonRpcServerError::ResponseStatusError( + JsonRpcServerResponseStatusError::BadRequest, + ), + reqwest::StatusCode::INTERNAL_SERVER_ERROR => { + JsonRpcServerError::InternalError { + info: Some(String::from("Internal server error")), } } - )); + reqwest::StatusCode::SERVICE_UNAVAILABLE => { + JsonRpcServerError::ResponseStatusError( + JsonRpcServerResponseStatusError::ServiceUnavailable, + ) + } + reqwest::StatusCode::REQUEST_TIMEOUT => { + JsonRpcServerError::ResponseStatusError( + JsonRpcServerResponseStatusError::TimeoutError, + ) + } + unexpected => JsonRpcServerError::ResponseStatusError( + JsonRpcServerResponseStatusError::Unexpected { status: unexpected }, + ), + })); } } let response_payload = response.bytes().await.map_err(|err| {