Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
steebchen committed Sep 18, 2024
1 parent 4da3d83 commit ec6b20e
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
3 changes: 1 addition & 2 deletions crates/executor/src/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 2 additions & 4 deletions crates/gateway-client/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ 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 {
match e {
SequencerError::StarknetError(_) => {
increment_failed(meta, REASON_STARKNET);
}
Expand All @@ -191,7 +191,5 @@ pub async fn with_metrics<T>(
}
SequencerError::ReqwestError(_) => {}
}

e
})
}

0 comments on commit ec6b20e

Please sign in to comment.