Skip to content

Commit 6189c0e

Browse files
committed
chore: solve clippy errors
1 parent d766f00 commit 6189c0e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/blobscan_client/types.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<'a> TryFrom<(&'a EthersBlock<EthersTransaction>, u32)> for BlockEntity {
7373
) -> Result<Self, Self::Error> {
7474
let number = ethers_block
7575
.number
76-
.with_context(|| format!("Missing block number field in execution block"))?;
76+
.with_context(|| "Missing block number field in execution block".to_string())?;
7777

7878
Ok(Self {
7979
number,
@@ -99,7 +99,7 @@ impl<'a> TryFrom<(&'a EthersTransaction, &'a EthersBlock<EthersTransaction>)>
9999
Ok(Self {
100100
block_number: ethers_block
101101
.number
102-
.with_context(|| format!("Missing block number field in execution block"))?,
102+
.with_context(|| "Missing block number field in execution block".to_string())?,
103103
hash,
104104
from: ethers_tx.from,
105105
to: ethers_tx
@@ -130,11 +130,11 @@ impl<'a> From<(&'a BlobData, &'a H256, usize, &'a H256)> for BlobEntity {
130130
(blob_data, versioned_hash, index, tx_hash): (&'a BlobData, &'a H256, usize, &'a H256),
131131
) -> Self {
132132
Self {
133-
tx_hash: tx_hash.clone(),
133+
tx_hash: *tx_hash,
134134
index: index as u32,
135135
commitment: blob_data.kzg_commitment.clone(),
136136
data: blob_data.blob.clone(),
137-
versioned_hash: versioned_hash.clone(),
137+
versioned_hash: *versioned_hash,
138138
}
139139
}
140140
}

src/slot_processor.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ fn create_versioned_hash_blob_mapping(
4343

4444
for blob in blobs {
4545
let versioned_hash = calculate_versioned_hash(&blob.kzg_commitment)?;
46-
if !version_hash_to_blob.contains_key(&versioned_hash) {
47-
version_hash_to_blob.insert(versioned_hash, blob);
48-
}
46+
47+
version_hash_to_blob.entry(versioned_hash).or_insert(blob);
4948
}
5049

5150
Ok(version_hash_to_blob)
@@ -228,7 +227,7 @@ impl<'a> SlotProcessor<'a> {
228227
.transactions
229228
.iter()
230229
.filter(|tx| tx_hash_to_versioned_hashes.contains_key(&tx.hash))
231-
.map(|tx| Ok(TransactionEntity::try_from((tx, &execution_block))?))
230+
.map(|tx| TransactionEntity::try_from((tx, &execution_block)))
232231
.collect::<Result<Vec<TransactionEntity>>>()?;
233232

234233
let versioned_hash_to_blob =

0 commit comments

Comments
 (0)