Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clippy lints #113

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/chainspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ impl ChainSpec {
timestamp: self.genesis.timestamp,
mix_hash: self.genesis.mix_hash,
beneficiary: self.genesis.coinbase,
base_fee_per_gas: base_fee_per_gas.map(Into::into),
base_fee_per_gas,
withdrawals_root,
parent_beacon_block_root,
blob_gas_used: blob_gas_used.map(Into::into),
excess_blob_gas: excess_blob_gas.map(Into::into),
blob_gas_used,
excess_blob_gas,
requests_hash,
..Default::default()
}
Expand Down
6 changes: 3 additions & 3 deletions crates/engine/util/src/reorg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ where
tx_type: tx.tx_type(),
success: exec_result.result.is_success(),
cumulative_gas_used,
logs: exec_result.result.into_logs().into_iter().map(Into::into).collect(),
logs: exec_result.result.into_logs().into_iter().collect(),
..Default::default()
}));

Expand Down Expand Up @@ -424,8 +424,8 @@ where
receipts_root: outcome.ethereum_receipts_root(reorg_target.header.number).unwrap(),
logs_bloom: outcome.block_logs_bloom(reorg_target.header.number).unwrap(),
gas_used: cumulative_gas_used,
blob_gas_used: blob_gas_used.map(Into::into),
excess_blob_gas: excess_blob_gas.map(Into::into),
blob_gas_used,
excess_blob_gas,
state_root: state_provider.state_root_from_state(hashed_state)?,
requests_hash: None, // TODO(prague)
target_blobs_per_block: None, // TODO(prague)
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/engine-primitives/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV4 {
// Spec:
// <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#specification-2>
should_override_builder: false,
blobs_bundle: sidecars.into_iter().map(Into::into).collect::<Vec<_>>().into(),
blobs_bundle: sidecars.into_iter().collect::<Vec<_>>().into(),
},
execution_requests: requests.unwrap_or_default(),
}
Expand Down
6 changes: 3 additions & 3 deletions crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ where
tx_type: tx.tx_type(),
success: result.is_success(),
cumulative_gas_used,
logs: result.into_logs().into_iter().map(Into::into).collect(),
logs: result.into_logs().into_iter().collect(),
..Default::default()
}));

Expand Down Expand Up @@ -474,8 +474,8 @@ where
gas_used: cumulative_gas_used,
extra_data: builder_config.extra_data,
parent_beacon_block_root: attributes.parent_beacon_block_root,
blob_gas_used: blob_gas_used.map(Into::into),
excess_blob_gas: excess_blob_gas.map(Into::into),
blob_gas_used,
excess_blob_gas,
requests_hash,
target_blobs_per_block: None,
};
Expand Down
6 changes: 2 additions & 4 deletions crates/net/network/src/session/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use futures::{stream::Fuse, SinkExt, StreamExt};
use metrics::Gauge;
use reth_eth_wire::{
capability::RawCapabilityMessage,
errors::{EthHandshakeError, EthStreamError, P2PStreamError},
errors::{EthHandshakeError, EthStreamError},
message::{EthBroadcastMessage, RequestPair},
Capabilities, DisconnectP2P, DisconnectReason, EthMessage, NetworkPrimitives,
};
Expand Down Expand Up @@ -392,9 +392,7 @@ impl<N: NetworkPrimitives> ActiveSession<N> {
fn start_disconnect(&mut self, reason: DisconnectReason) -> Result<(), EthStreamError> {
self.conn
.inner_mut()
.start_disconnect(reason)
.map_err(P2PStreamError::from)
.map_err(Into::into)
.start_disconnect(reason).map_err(Into::into)
}

/// Flushes the disconnect message and emits the corresponding message
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-builder/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ impl AuthServerConfig {
let ipc_server = ipc_server_config.build(ipc_endpoint_str);
let res = ipc_server
.start(module.inner)
.await
.map_err(reth_ipc::server::IpcServerStartError::from)?;
.await?;
ipc_handle = Some(res);
}

Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-eth-api/src/helpers/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ pub trait EthCall: EstimateCall + Call + LoadPendingBlock + LoadBlock + FullEthA
tx,
&mut db,
overrides,
)
.map(Into::into)?;
)?;
let (res, _) = this.transact(&mut db, env)?;

match ensure_success(res.result) {
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc-eth-types/src/revm_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use super::{EthApiError, EthResult, RpcInvalidTransactionError};
#[inline]
pub fn get_precompiles(spec_id: SpecId) -> impl IntoIterator<Item = Address> {
let spec = PrecompileSpecId::from_spec_id(spec_id);
Precompiles::new(spec).addresses().copied().map(Address::from)
}
Precompiles::new(spec).addresses().copied()}

/// Calculates the caller gas allowance.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ mod tests {
number: newest_block - i,
gas_limit,
gas_used,
base_fee_per_gas: base_fee_per_gas.map(Into::into),
base_fee_per_gas: base_fee_per_gas,
parent_hash,
..Default::default()
};
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc/src/eth/helpers/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where
blob_gas_used: is_cancun.then(|| {
transactions.iter().map(|tx| tx.blob_gas_used().unwrap_or_default()).sum::<u64>()
}),
excess_blob_gas: block_env.get_blob_excess_gas().map(Into::into),
excess_blob_gas: block_env.get_blob_excess_gas(),
extra_data: Default::default(),
parent_beacon_block_root: is_cancun.then_some(B256::ZERO),
requests_hash: is_prague.then_some(EMPTY_REQUESTS_HASH),
Expand All @@ -119,7 +119,7 @@ where
tx_type: tx.tx_type(),
success: result.is_success(),
cumulative_gas_used,
logs: result.into_logs().into_iter().map(Into::into).collect(),
logs: result.into_logs().into_iter().collect(),
..Default::default()
}
}
Expand Down
3 changes: 1 addition & 2 deletions crates/rpc/rpc/src/eth/sim_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ where
while idx < body.len() {
match &body[idx] {
BundleItem::Tx { tx, can_revert } => {
let recovered_tx = recover_raw_transaction::<PoolPooledTx<Eth::Pool>>(tx)
.map_err(EthApiError::from)?;
let recovered_tx = recover_raw_transaction::<PoolPooledTx<Eth::Pool>>(tx)?;
let (tx, signer) = recovered_tx.to_components();
let tx: PoolConsensusTx<Eth::Pool> =
<Eth::Pool as TransactionPool>::Transaction::pooled_into_consensus(tx);
Expand Down
2 changes: 1 addition & 1 deletion crates/stages/stages/src/stages/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ mod tests {
// validate the header total difficulty
td += header.difficulty;
assert_eq!(
provider.header_td_by_number(block_num)?.map(Into::into),
provider.header_td_by_number(block_num)?,
Some(td)
);
}
Expand Down
6 changes: 2 additions & 4 deletions crates/storage/provider/src/providers/consistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,7 @@ impl<N: ProviderNodeTypes> TransactionsProvider for ConsistentProvider<N> {
.body
.transactions()
.get(tx_index)
.cloned()
.map(Into::into))
.cloned())
},
)
}
Expand All @@ -944,8 +943,7 @@ impl<N: ProviderNodeTypes> TransactionsProvider for ConsistentProvider<N> {
.body
.transactions()
.get(tx_index)
.cloned()
.map(Into::into))
.cloned())
},
)
}
Expand Down
13 changes: 4 additions & 9 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,7 @@ impl<TX: DbTx + 'static, N: NodeTypesForProvider> HeaderProvider for DatabasePro
to_range(range),
|static_file, range, _| static_file.headers_range(range),
|range, _| {
self.cursor_read_collect::<tables::Headers<Self::Header>>(range).map_err(Into::into)
},
self.cursor_read_collect::<tables::Headers<Self::Header>>(range)},
|_| true,
)
}
Expand Down Expand Up @@ -1128,8 +1127,7 @@ impl<TX: DbTx + 'static, N: NodeTypes> BlockHashReader for DatabaseProvider<TX,
start..end,
|static_file, range, _| static_file.canonical_hashes_range(range.start, range.end),
|range, _| {
self.cursor_read_collect::<tables::CanonicalHeaders>(range).map_err(Into::into)
},
self.cursor_read_collect::<tables::CanonicalHeaders>(range)},
|_| true,
)
}
Expand Down Expand Up @@ -1524,8 +1522,7 @@ impl<TX: DbTx + 'static, N: NodeTypesForProvider> TransactionsProvider for Datab
&self,
range: impl RangeBounds<TxNumber>,
) -> ProviderResult<Vec<Address>> {
self.cursor_read_collect::<tables::TransactionSenders>(range).map_err(Into::into)
}
self.cursor_read_collect::<tables::TransactionSenders>(range)}

fn transaction_sender(&self, id: TxNumber) -> ProviderResult<Option<Address>> {
Ok(self.tx.get::<tables::TransactionSenders>(id)?)
Expand Down Expand Up @@ -1578,9 +1575,7 @@ impl<TX: DbTx + 'static, N: NodeTypesForProvider> ReceiptProvider for DatabasePr
to_range(range),
|static_file, range, _| static_file.receipts_by_tx_range(range),
|range, _| {
self.cursor_read_collect::<tables::Receipts<Self::Receipt>>(range)
.map_err(Into::into)
},
self.cursor_read_collect::<tables::Receipts<Self::Receipt>>(range)},
|_| true,
)
}
Expand Down
Loading