From 758800cb2f02b76fdd2c97097f789601e45fb563 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 20 Jun 2022 18:55:10 +0200 Subject: [PATCH] Use `map_inbound_stream` helper --- core/src/muxing/boxed.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/core/src/muxing/boxed.rs b/core/src/muxing/boxed.rs index 3547183d657..aa703af89b4 100644 --- a/core/src/muxing/boxed.rs +++ b/core/src/muxing/boxed.rs @@ -50,16 +50,10 @@ where &self, cx: &mut Context<'_>, ) -> Poll, Self::Error>> { - let event = ready!(self.inner.poll_event(cx).map_err(into_io_error)?); - - match event { - StreamMuxerEvent::AddressChange(a) => { - Poll::Ready(Ok(StreamMuxerEvent::AddressChange(a))) - } - StreamMuxerEvent::InboundSubstream(s) => { - Poll::Ready(Ok(StreamMuxerEvent::InboundSubstream(SubstreamBox::new(s)))) - } - } + let event = ready!(self.inner.poll_event(cx).map_err(into_io_error)?) + .map_inbound_stream(SubstreamBox::new); + + Poll::Ready(Ok(event)) } #[inline]