Skip to content

Commit

Permalink
chore: made clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
frolvanya committed Aug 9, 2024
1 parent a3f87e6 commit c3e3b0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion rpc-server/src/modules/gas/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub async fn gas_price(
{
let result = match &cache_block {
Ok(block) => {
if let None = gas_price_request.block_id {
if gas_price_request.block_id.is_none() {
gas_price_request.block_id =
Some(near_primitives::types::BlockId::Height(block.block_height));
};
Expand Down
26 changes: 13 additions & 13 deletions rpc-server/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,13 @@ where
let retry = match json_rpc_err {
near_jsonrpc_client::errors::JsonRpcError::TransportError(_) => true,
near_jsonrpc_client::errors::JsonRpcError::ServerError(server_error) => {
match server_error {
matches!(
server_error,
near_jsonrpc_client::errors::JsonRpcServerError::NonContextualError(_)
| near_jsonrpc_client::errors::JsonRpcServerError::ResponseStatusError(_) => {
true
}
_ => false,
}
| near_jsonrpc_client::errors::JsonRpcServerError::ResponseStatusError(
_
)
)
}
};
if retry {
Expand All @@ -496,7 +496,7 @@ where
},
Err(err) => {
if let Some(e) = err.handler_error() {
match serde_json::to_value(&e) {
match serde_json::to_value(e) {
Ok(near_rpc_response_json) => {
if near_rpc_response_json["name"] == "TIMEOUT_ERROR" {
return Err(ShadowDataConsistencyError::NearRpcCallError(format!(
Expand Down Expand Up @@ -532,15 +532,15 @@ where
// Both services(read_rpc and near_rpc) have a successful response but the data mismatch
// both response objects included for future investigation
ShadowDataConsistencyError::ResultsDontMatch {
error_message: format!("Success results don't match"),
error_message: "Success results don't match".to_string(),
reason: DataMismatchReason::ReadRpcSuccessNearRpcSuccess,
read_rpc_response: read_rpc_json,
near_rpc_response: near_rpc_json,
}
} else if !read_rpc_response_is_ok && near_rpc_response_is_ok {
// read_rpc service has error response and near_rpc has successful response
ShadowDataConsistencyError::ResultsDontMatch {
error_message: format!("ReadRPC failed, NearRPC success"),
error_message: "ReadRPC failed, NearRPC success".to_string(),
reason: DataMismatchReason::ReadRpcErrorNearRpcSuccess,
read_rpc_response: read_rpc_json,
near_rpc_response: near_rpc_json,
Expand All @@ -549,7 +549,7 @@ where
// read_rpc service has successful response and near_rpc has error response
// Expected that all error will be related with network issues.
ShadowDataConsistencyError::ResultsDontMatch {
error_message: format!("ReadRPC success, NearRPC failed"),
error_message: "ReadRPC success, NearRPC failed".to_string(),
reason: DataMismatchReason::ReadRpcSuccessNearRpcError,
read_rpc_response: read_rpc_json,
near_rpc_response: near_rpc_json,
Expand All @@ -559,7 +559,7 @@ where
// both response objects included for future investigation.
// Expected we will only have a difference in the error text.
ShadowDataConsistencyError::ResultsDontMatch {
error_message: format!("Both services failed, but results don't match"),
error_message: "Both services failed, but results don't match".to_string(),
reason: DataMismatchReason::ReadRpcErrorNearRpcError,
read_rpc_response: read_rpc_json,
near_rpc_response: near_rpc_json,
Expand Down Expand Up @@ -656,9 +656,9 @@ fn json_sort_value(value: serde_json::Value) -> serde_json::Value {
map
},
)
.into_iter()
.map(|(_, v)| v)
.into_values()
.collect();

serde_json::Value::from(new_value)
}
serde_json::Value::Object(mut obj) => {
Expand Down

0 comments on commit c3e3b0e

Please sign in to comment.