Skip to content

Commit

Permalink
chore: make clippy happy (#13772)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez authored Jan 11, 2025
1 parent ca30702 commit 5a23708
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 37 deletions.
2 changes: 1 addition & 1 deletion crates/chain-state/src/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<T: Clone + Sync + Send + 'static> Stream for ForkChoiceStream<T> {
loop {
match ready!(self.as_mut().project().st.poll_next(cx)) {
Some(Some(notification)) => return Poll::Ready(Some(notification)),
Some(None) => continue,
Some(None) => {}
None => return Poll::Ready(None),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/chainspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ impl ChainSpec {
return Some(block_num);
}
}
ForkCondition::Block(_) | ForkCondition::Never => continue,
ForkCondition::Block(_) | ForkCondition::Never => {}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/e2e-test-utils/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ where
info!("Session established with peer: {:?}", peer_id);
return Some(peer_id)
}
_ => continue,
_ => {}
}
}
None
Expand Down
1 change: 0 additions & 1 deletion crates/engine/tree/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ where
HandlerEvent::BackfillAction(action) => {
// forward action to backfill_sync
this.backfill_sync.on_action(action);
continue 'outer
}
HandlerEvent::Event(ev) => {
// bubble up the event
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum-forks/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl DisplayHardforks {
ForkCondition::Timestamp(_) => {
post_merge.push(display_fork);
}
ForkCondition::Never => continue,
ForkCondition::Never => {}
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/net/network/src/session/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ impl<N: NetworkPrimitives> Future for ActiveSession<N> {
OnIncomingMessageOutcome::NoCapacity(msg) => {
// failed to send due to lack of capacity
this.pending_message_to_session = Some(msg);
continue 'receive
}
}
}
Expand Down
22 changes: 8 additions & 14 deletions crates/net/network/src/test_utils/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,8 @@ impl NetworkEventStream {
/// Awaits the next event for a session to be closed
pub async fn next_session_closed(&mut self) -> Option<(PeerId, Option<DisconnectReason>)> {
while let Some(ev) = self.inner.next().await {
match ev {
NetworkEvent::Peer(PeerEvent::SessionClosed { peer_id, reason }) => {
return Some((peer_id, reason))
}
_ => continue,
if let NetworkEvent::Peer(PeerEvent::SessionClosed { peer_id, reason }) = ev {
return Some((peer_id, reason))
}
}
None
Expand All @@ -716,7 +713,7 @@ impl NetworkEventStream {
NetworkEvent::Peer(PeerEvent::SessionEstablished(info)) => {
return Some(info.peer_id)
}
_ => continue,
_ => {}
}
}
None
Expand All @@ -729,15 +726,12 @@ impl NetworkEventStream {
}
let mut peers = Vec::with_capacity(num);
while let Some(ev) = self.inner.next().await {
match ev {
NetworkEvent::ActivePeerSession { info: SessionInfo { peer_id, .. }, .. } => {
peers.push(peer_id);
num -= 1;
if num == 0 {
return peers;
}
if let NetworkEvent::ActivePeerSession { info: SessionInfo { peer_id, .. }, .. } = ev {
peers.push(peer_id);
num -= 1;
if num == 0 {
return peers;
}
_ => continue,
}
}
peers
Expand Down
8 changes: 4 additions & 4 deletions crates/net/network/src/transactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2026,7 +2026,7 @@ mod tests {
transactions
.on_network_event(NetworkEvent::Peer(PeerEvent::SessionEstablished(info)))
}
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => continue,
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => {}
ev => {
error!("unexpected event {ev:?}")
}
Expand Down Expand Up @@ -2097,7 +2097,7 @@ mod tests {
// to insert a new peer in transactions peerset
transactions.on_network_event(ev);
}
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => continue,
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => {}
_ => {
error!("unexpected event {ev:?}")
}
Expand Down Expand Up @@ -2166,7 +2166,7 @@ mod tests {
// to insert a new peer in transactions peerset
transactions.on_network_event(ev);
}
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => continue,
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => {}
ev => {
error!("unexpected event {ev:?}")
}
Expand Down Expand Up @@ -2241,7 +2241,7 @@ mod tests {
NetworkEvent::Peer(PeerEvent::SessionEstablished(_)) => {
transactions.on_network_event(ev);
}
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => continue,
NetworkEvent::Peer(PeerEvent::PeerAdded(_peer_id)) => {}
ev => {
error!("unexpected event {ev:?}")
}
Expand Down
1 change: 0 additions & 1 deletion crates/net/p2p/src/test_utils/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ impl Stream for TestDownload {
headers.sort_unstable_by_key(|h| h.number);
headers.into_iter().for_each(|h| this.buffer.push(h));
this.done = true;
continue
}
Err(err) => {
this.done = true;
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-api/src/helpers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
}

// Check if the sender is a contract
if self.get_code(sender, None).await?.len() > 0 {
if !self.get_code(sender, None).await?.is_empty() {
return Ok(None);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-eth-types/src/fee_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl FeeHistoryCache {
entries.pop_first();
}

if entries.len() == 0 {
if entries.is_empty() {
self.inner.upper_bound.store(0, SeqCst);
self.inner.lower_bound.store(0, SeqCst);
return
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-testing-util/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl DebugTraceTransactionsStream<'_> {
pub async fn next_err(&mut self) -> Option<(RpcError, TxHash)> {
loop {
match self.next().await? {
Ok(_) => continue,
Ok(_) => {}
Err(err) => return Some(err),
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ impl DebugTraceBlockStream<'_> {
pub async fn next_err(&mut self) -> Option<(RpcError, BlockId)> {
loop {
match self.next().await? {
Ok(_) => continue,
Ok(_) => {}
Err(err) => return Some(err),
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-testing-util/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl TraceBlockStream<'_> {
pub async fn next_err(&mut self) -> Option<(RpcError, BlockId)> {
loop {
match self.next().await? {
Ok(_) => continue,
Ok(_) => {}
Err(err) => return Some(err),
}
}
Expand Down Expand Up @@ -453,7 +453,7 @@ impl TraceBlockOpcodeGasStream<'_> {
pub async fn next_err(&mut self) -> Option<(RpcError, BlockId)> {
loop {
match self.next().await? {
Ok(_) => continue,
Ok(_) => {}
Err(err) => return Some(err),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/libmdbx-rs/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ mod tests {
let db = tx.open_db(None).unwrap();
for i in 1_000usize..1_000_000 {
match tx.put(db.dbi(), i.to_le_bytes(), b"0", WriteFlags::empty()) {
Ok(_) => continue,
Ok(_) => {}
Err(Error::MapFull) => break,
result @ Err(_) => result.unwrap(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ mod tests {
provider.account_block_changeset(last_database_block).unwrap(),
database_changesets
.into_iter()
.last()
.next_back()
.unwrap()
.into_iter()
.sorted_by_key(|(address, _, _)| *address)
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/consistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ mod tests {
consistent_provider.account_block_changeset(last_database_block).unwrap(),
database_changesets
.into_iter()
.last()
.next_back()
.unwrap()
.into_iter()
.sorted_by_key(|(address, _, _)| *address)
Expand Down
1 change: 0 additions & 1 deletion crates/tokio-util/src/event_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ where
Poll::Ready(Some(Ok(item))) => return Poll::Ready(Some(item)),
Poll::Ready(Some(Err(e))) => {
warn!("BroadcastStream lagged: {e:?}");
continue
}
Poll::Ready(None) => return Poll::Ready(None),
Poll::Pending => return Poll::Pending,
Expand Down
1 change: 0 additions & 1 deletion crates/transaction-pool/src/pool/best.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ impl<T: TransactionOrdering> BestTransactions<T> {
Err(TryRecvError::Lagged(_)) => {
// Handle the case where the receiver lagged too far behind.
// `num_skipped` indicates the number of messages that were skipped.
continue
}

// this case is still better than the existing iterator behavior where no new
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/sparse/src/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ impl<P> RevealedSparseTrie<P> {
tree_mask,
hash_mask,
hashes,
hash.filter(|_| path.len() == 0),
hash.filter(|_| path.is_empty()),
);
updates.updated_nodes.insert(path.clone(), branch_node);
}
Expand Down

0 comments on commit 5a23708

Please sign in to comment.