From: Jeffrey Czyz Date: Mon, 22 Jan 2024 22:26:54 +0000 (-0600) Subject: Remove unnecessary unwraps X-Git-Tag: v0.0.121~2^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=7b8d018f1f2506d215db9d89f913303b6a89d39a;p=rust-lightning Remove unnecessary unwraps --- diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 100446f05..c3a50fd24 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1272,7 +1272,7 @@ impl(&self, peer: &mut Peer, message: &M) { - let logger = WithContext::from(&self.logger, Some(peer.their_node_id.unwrap().0), None); + let logger = WithContext::from(&self.logger, peer.their_node_id.map(|p| p.0), None); if is_gossip_msg(message.type_id()) { log_gossip!(logger, "Enqueueing message {:?} to {}", message, log_pubkey!(peer.their_node_id.unwrap().0)); } else { @@ -1377,7 +1377,7 @@ impl { - let logger = WithContext::from(&self.logger, Some(peer.their_node_id.unwrap().0), None); + let logger = WithContext::from(&self.logger, peer.their_node_id.map(|p| p.0), None); match self.node_id_to_descriptor.lock().unwrap().entry(peer.their_node_id.unwrap().0) { hash_map::Entry::Occupied(e) => { log_trace!(logger, "Got second connection with {}, closing", log_pubkey!(peer.their_node_id.unwrap().0)); @@ -1457,7 +1457,7 @@ impl x, Err(e) => { @@ -1841,7 +1841,7 @@ impl