Skip to content

Commit

Permalink
chore(code): Fix clippy warnings on Rust 1.84
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Jan 9, 2025
1 parent 5c78b3e commit 97e21b8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion code/crates/core-votekeeper/src/keeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ where
vote_type: VoteType,
threshold: Threshold<ValueId<Ctx>>,
) -> bool {
self.per_round.get(round).map_or(false, |per_round| {
self.per_round.get(round).is_some_and(|per_round| {
per_round.votes.is_threshold_met(
vote_type,
threshold,
Expand Down
11 changes: 6 additions & 5 deletions code/crates/discovery/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ impl Controller {
}

pub(crate) fn dial_is_done_on(&self, connection_data: &ConnectionData) -> bool {
connection_data.peer_id().map_or(false, |peer_id| {
self.dial.is_done_on(&PeerData::PeerId(peer_id))
}) || self
.dial
.is_done_on(&PeerData::Multiaddr(connection_data.multiaddr()))
connection_data
.peer_id()
.is_some_and(|peer_id| self.dial.is_done_on(&PeerData::PeerId(peer_id)))
|| self
.dial
.is_done_on(&PeerData::Multiaddr(connection_data.multiaddr()))
}

pub(crate) fn dial_add_peer_id_to_connection_data(
Expand Down
6 changes: 2 additions & 4 deletions code/crates/discovery/src/handlers/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
if self
.active_connections
.get(&peer_id)
.map_or(false, |connections| connections.contains(&connection_id))
.is_some_and(|connections| connections.contains(&connection_id))
{
if swarm.close_connection(connection_id) {
info!("Closing connection {connection_id} to peer {peer_id}");
Expand Down Expand Up @@ -70,9 +70,7 @@ where
if self
.outbound_connections
.get(&peer_id)
.map_or(false, |out_conn| {
out_conn.connection_id == Some(connection_id)
})
.is_some_and(|out_conn| out_conn.connection_id == Some(connection_id))
{
warn!("Outbound connection {connection_id} to peer {peer_id} closed");

Expand Down
4 changes: 2 additions & 2 deletions code/crates/discovery/src/handlers/identify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ where
if self
.active_connections
.get(&peer_id)
.map_or(false, |connections| connections.contains(&connection_id))
.is_some_and(|connections| connections.contains(&connection_id))
{
return;
}
Expand Down Expand Up @@ -76,7 +76,7 @@ where
if self
.outbound_connections
.get(&peer_id)
.map_or(false, |out_conn| out_conn.connection_id.is_none())
.is_some_and(|out_conn| out_conn.connection_id.is_none())
{
// This case happens when the peer was selected to be part of the outbound connections
// but no connection was established yet. No need to trigger a connect request, it
Expand Down

0 comments on commit 97e21b8

Please sign in to comment.