Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
CHr15F0x authored and kkovaacs committed Sep 23, 2024
1 parent f60b177 commit e1ea536
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 2 additions & 3 deletions crates/executor/src/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 1 addition & 3 deletions crates/gateway-client/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub async fn with_metrics<T>(

metrics::histogram!(METRIC_REQUESTS_LATENCY, elapsed, "method" => meta.method);

result.map_err(|e| {
result.inspect_err(|e| {
increment(METRIC_FAILED_REQUESTS, meta);

match &e {
Expand All @@ -191,7 +191,5 @@ pub async fn with_metrics<T>(
}
SequencerError::ReqwestError(_) => {}
}

e
})
}

0 comments on commit e1ea536

Please sign in to comment.