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 d8abfc0386..b48803f7be 100644 --- a/crates/executor/src/simulate.rs +++ b/crates/executor/src/simulate.rs @@ -200,11 +200,10 @@ pub fn trace( err })?; let state_diff = - to_state_diff(&mut tx_state, tx_declared_deprecated_class_hash).map_err(|e| { + to_state_diff(&mut tx_state, tx_declared_deprecated_class_hash).inspect_err(|e| { // 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..3de4ced705 100644 --- a/crates/gateway-client/src/metrics.rs +++ b/crates/gateway-client/src/metrics.rs @@ -166,10 +166,10 @@ 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 { + match e { SequencerError::StarknetError(_) => { increment_failed(meta, REASON_STARKNET); } @@ -191,7 +191,5 @@ pub async fn with_metrics( } SequencerError::ReqwestError(_) => {} } - - e }) }