From 04c2e649b1f5482b8c3466b0fdbd1815b3126a48 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Fri, 29 Nov 2024 04:46:51 +0200 Subject: [PATCH] Small readability improvement --- protocols/request-response/src/lib.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/protocols/request-response/src/lib.rs b/protocols/request-response/src/lib.rs index 9436450136c..bf92d4d5685 100644 --- a/protocols/request-response/src/lib.rs +++ b/protocols/request-response/src/lib.rs @@ -708,18 +708,11 @@ where } } - fn on_dial_failure( - &mut self, - DialFailure { - peer_id, - connection_id, - .. - }: DialFailure, - ) { - let key = if let Some(peer_id) = peer_id { + fn on_dial_failure(&mut self, failure: DialFailure) { + let key = if let Some(peer_id) = failure.peer_id { peer_id.into() } else { - connection_id.into() + failure.connection_id.into() }; // If there are pending outgoing requests when a dial failure occurs, @@ -732,7 +725,7 @@ where for request in pending { self.pending_events .push_back(ToSwarm::GenerateEvent(Event::OutboundFailure { - peer: peer_id, + peer: failure.peer_id, request_id: request.request_id, error: OutboundFailure::DialFailure, }));