From e1ea536827a7fee24fe3a21c507ce83a33b140c2 Mon Sep 17 00:00:00 2001 From: Krzysztof Lis Date: Thu, 5 Sep 2024 18:27:23 +0200 Subject: [PATCH] chore: clippy --- crates/common/src/lib.rs | 2 +- crates/executor/src/simulate.rs | 5 ++--- crates/gateway-client/src/metrics.rs | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index c6c64d8137..300427ae07 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -424,7 +424,7 @@ impl ChainId { pub fn as_str(&self) -> &str { std::str::from_utf8(self.0.as_be_bytes()) .expect("valid utf8") - .trim_start_matches(|c| c == '\0') + .trim_start_matches('\0') } pub const MAINNET: Self = Self::from_slice_unwrap(b"SN_MAIN"); diff --git a/crates/executor/src/simulate.rs b/crates/executor/src/simulate.rs index c87e8aac08..4cec1283d2 100644 --- a/crates/executor/src/simulate.rs +++ b/crates/executor/src/simulate.rs @@ -198,12 +198,11 @@ pub fn trace( cache.cache_set(block_hash, CacheItem::CachedErr(err.clone())); err })?; - let state_diff = - to_state_diff(&mut tx_state, tx_declared_deprecated_class_hash).map_err(|e| { + let state_diff = to_state_diff(&mut tx_state, tx_declared_deprecated_class_hash) + .inspect_err(|_| { // Remove the cache entry so it's no longer inflight. let mut cache = cache.0.lock().unwrap(); cache.cache_remove(&block_hash); - e })?; tx_state.commit(); diff --git a/crates/gateway-client/src/metrics.rs b/crates/gateway-client/src/metrics.rs index 98b71a4eb7..58c3a633da 100644 --- a/crates/gateway-client/src/metrics.rs +++ b/crates/gateway-client/src/metrics.rs @@ -166,7 +166,7 @@ pub async fn with_metrics( metrics::histogram!(METRIC_REQUESTS_LATENCY, elapsed, "method" => meta.method); - result.map_err(|e| { + result.inspect_err(|e| { increment(METRIC_FAILED_REQUESTS, meta); match &e { @@ -191,7 +191,5 @@ pub async fn with_metrics( } SequencerError::ReqwestError(_) => {} } - - e }) }