From 25c3ab2c1e388a900d63812fb41039dbe6a2fe62 Mon Sep 17 00:00:00 2001 From: Pierre Krieger <pierre.krieger1708@gmail.com> Date: Wed, 22 Apr 2020 00:36:12 +0200 Subject: [PATCH] Fix warning reported in out_events when Registry is None (#5716) --- substrate/client/network/src/service/out_events.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/client/network/src/service/out_events.rs b/substrate/client/network/src/service/out_events.rs index 8f9c138095f..2d4d7ded213 100644 --- a/substrate/client/network/src/service/out_events.rs +++ b/substrate/client/network/src/service/out_events.rs @@ -97,10 +97,10 @@ impl Stream for Receiver { fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Event>> { if let Some(ev) = ready!(Pin::new(&mut self.inner).poll_next(cx)) { let metrics = self.metrics.lock().clone(); - if let Some(Some(metrics)) = metrics.as_ref().map(|m| &**m) { - metrics.event_out(&ev, self.name); - } else { - log::warn!("Inconsistency in out_events: event happened before sender associated"); + match metrics.as_ref().map(|m| m.as_ref()) { + Some(Some(metrics)) => metrics.event_out(&ev, self.name), + Some(None) => (), // no registry + None => log::warn!("Inconsistency in out_events: event happened before sender associated"), } Poll::Ready(Some(ev)) } else { -- GitLab