Skip to content

Commit

Permalink
chore: make clippy happy (#11439)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Oct 2, 2024
1 parent 5ec448e commit 70d498d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion crates/cli/commands/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ where
let last_block_number = provider_factory.last_block_number()?;
let local_head = provider_factory
.sealed_header(last_block_number)?
.ok_or(ProviderError::HeaderNotFound(last_block_number.into()))?;
.ok_or_else(|| ProviderError::HeaderNotFound(last_block_number.into()))?;

let mut header_downloader = ReverseHeadersDownloaderBuilder::new(config.stages.headers)
.build(file_client.clone(), consensus.clone())
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/commands/src/recover/storage_tries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> Command<C>
let best_block = provider.best_block_number()?;
let best_header = provider
.sealed_header(best_block)?
.ok_or(ProviderError::HeaderNotFound(best_block.into()))?;
.ok_or_else(|| ProviderError::HeaderNotFound(best_block.into()))?;

let mut deleted_tries = 0;
let tx_mut = provider.tx_mut();
Expand Down
4 changes: 2 additions & 2 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ where
let safe = self
.blockchain
.find_block_by_hash(safe_block_hash, BlockSource::Any)?
.ok_or_else(|| ProviderError::UnknownBlockHash(safe_block_hash))?;
.ok_or(ProviderError::UnknownBlockHash(safe_block_hash))?;
self.blockchain.set_safe(SealedHeader::new(safe.header, safe_block_hash));
}
Ok(())
Expand All @@ -965,7 +965,7 @@ where
let finalized = self
.blockchain
.find_block_by_hash(finalized_block_hash, BlockSource::Any)?
.ok_or_else(|| ProviderError::UnknownBlockHash(finalized_block_hash))?;
.ok_or(ProviderError::UnknownBlockHash(finalized_block_hash))?;
self.blockchain.finalize_block(finalized.number)?;
self.blockchain
.set_finalized(SealedHeader::new(finalized.header, finalized_block_hash));
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/cli/src/commands/build_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ where
let last_block_number = provider_factory.last_block_number()?;
let local_head = provider_factory
.sealed_header(last_block_number)?
.ok_or(ProviderError::HeaderNotFound(last_block_number.into()))?;
.ok_or_else(|| ProviderError::HeaderNotFound(last_block_number.into()))?;

let mut header_downloader = ReverseHeadersDownloaderBuilder::new(config.stages.headers)
.build(file_client.clone(), consensus.clone())
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/logs_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pub fn append_matching_block_logs(
let transaction_id = first_tx_num + receipt_idx as u64;
let transaction = provider
.transaction_by_id(transaction_id)?
.ok_or(ProviderError::TransactionNotFound(transaction_id.into()))?;
.ok_or_else(|| ProviderError::TransactionNotFound(transaction_id.into()))?;

transaction_hash = Some(transaction.hash());
}
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc/src/eth/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ where
let block = self
.provider
.header_by_hash_or_number(block_hash.into())?
.ok_or(ProviderError::HeaderNotFound(block_hash.into()))?;
.ok_or_else(|| ProviderError::HeaderNotFound(block_hash.into()))?;

// we also need to ensure that the receipts are available and return an error if
// not, in case the block hash been reorged
Expand Down Expand Up @@ -511,7 +511,7 @@ where
None => self
.provider
.block_hash(header.number)?
.ok_or(ProviderError::HeaderNotFound(header.number.into()))?,
.ok_or_else(|| ProviderError::HeaderNotFound(header.number.into()))?,
};

if let Some(receipts) = self.eth_cache.get_receipts(block_hash).await? {
Expand Down
7 changes: 4 additions & 3 deletions crates/stages/stages/src/stages/sender_recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,10 @@ where

// fetch the sealed header so we can use it in the sender recovery
// unwind
let sealed_header = provider
.sealed_header(block_number)?
.ok_or(ProviderError::HeaderNotFound(block_number.into()))?;
let sealed_header =
provider.sealed_header(block_number)?.ok_or_else(|| {
ProviderError::HeaderNotFound(block_number.into())
})?;
Err(StageError::Block {
block: Box::new(sealed_header),
error: BlockErrorKind::Validation(
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/db-common/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ where
let hash = provider_rw.block_hash(block)?.unwrap();
let expected_state_root = provider_rw
.header_by_number(block)?
.ok_or(ProviderError::HeaderNotFound(block.into()))?
.ok_or_else(|| ProviderError::HeaderNotFound(block.into()))?
.state_root;

// first line can be state root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl<N: ProviderNodeTypes> BlockchainProvider2<N> {
// the in-memory state.
let last_block_body_index = provider
.block_body_indices(last_database_block_number)?
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(last_database_block_number))?;
.ok_or(ProviderError::BlockBodyIndicesNotFound(last_database_block_number))?;
let mut in_memory_tx_num = last_block_body_index.next_tx_num();

let (start, end) = self.convert_range_bounds(range, || {
Expand Down

0 comments on commit 70d498d

Please sign in to comment.