Skip to content

Commit 5fd8d37

Browse files
committed
avoid failing lint due to now disabled #[cfg(debug_assertions)]
1 parent 3c872c9 commit 5fd8d37

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

beacon_node/lighthouse_network/src/service/gossip_cache.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,17 @@ impl futures::stream::Stream for GossipCache {
250250
Poll::Ready(Some(expired)) => {
251251
let expected_key = expired.key();
252252
let (topic, data) = expired.into_inner();
253-
match self.topic_msgs.get_mut(&topic) {
254-
Some(msgs) => {
255-
let key = msgs.remove(&data);
256-
debug_assert_eq!(key, Some(expected_key));
257-
if msgs.is_empty() {
258-
// no more messages for this topic.
259-
self.topic_msgs.remove(&topic);
260-
}
261-
}
262-
None => {
263-
#[cfg(debug_assertions)]
264-
panic!("Topic for registered message is not present.")
253+
let topic_msg = self.topic_msgs.get_mut(&topic);
254+
debug_assert!(
255+
topic_msg.is_none(),
256+
"Topic for registered message is not present."
257+
);
258+
if let Some(msgs) = topic_msg {
259+
let key = msgs.remove(&data);
260+
debug_assert_eq!(key, Some(expected_key));
261+
if msgs.is_empty() {
262+
// no more messages for this topic.
263+
self.topic_msgs.remove(&topic);
265264
}
266265
}
267266
Poll::Ready(Some(Ok(topic)))

0 commit comments

Comments
 (0)