From d708a587b05282139228f93b88088b491cdc1273 Mon Sep 17 00:00:00 2001 From: Jose Daniel Hernandez Date: Fri, 20 Sep 2024 12:19:03 -0600 Subject: [PATCH] network-libp2p: Fix clippy warnings Fix clippy warnings in the `network-libp2p` subcrate. --- network-libp2p/src/swarm.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/network-libp2p/src/swarm.rs b/network-libp2p/src/swarm.rs index 5cb1b2fe54..db323419d7 100644 --- a/network-libp2p/src/swarm.rs +++ b/network-libp2p/src/swarm.rs @@ -356,13 +356,11 @@ fn handle_event( } SwarmEvent::Dialing { - peer_id, + peer_id: Some(peer_id), connection_id: _, } => { // This event is only triggered if the network behaviour performs the dial - if let Some(peer_id) = peer_id { - debug!(%peer_id, "Dialing peer"); - } + debug!(%peer_id, "Dialing peer"); } SwarmEvent::NewListenAddr { @@ -809,9 +807,9 @@ fn handle_event( if let Some(channel) = state.requests.remove(&request_id) { // We might get empty responses (None) because of the implementation of our codecs. let response = response - .ok_or_else(|| { - RequestError::OutboundRequest(OutboundRequestError::Timeout) - }) + .ok_or(RequestError::OutboundRequest( + OutboundRequestError::Timeout, + )) .map(|data| data.into()); // The initiator of the request might no longer exist, so we