]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop a needless match in favor of an `if let`
authorMatt Corallo <git@bluematt.me>
Mon, 11 Apr 2022 17:34:11 +0000 (17:34 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 10 May 2022 23:40:20 +0000 (23:40 +0000)
lightning/src/ln/peer_handler.rs

index 08bfa919d27065511bf29c8a63867d9f43aa1c60..d4e6b4645b276a22da88cddfd7bc441b2a13d8b9 100644 (file)
@@ -1674,15 +1674,12 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
                        },
                        Some(peer_lock) => {
                                let peer = peer_lock.lock().unwrap();
-                               match peer.their_node_id {
-                                       Some(node_id) => {
-                                               log_trace!(self.logger,
-                                                       "Handling disconnection of peer {}, with {}future connection to the peer possible.",
-                                                       log_pubkey!(node_id), if no_connection_possible { "no " } else { "" });
-                                               self.node_id_to_descriptor.lock().unwrap().remove(&node_id);
-                                               self.message_handler.chan_handler.peer_disconnected(&node_id, no_connection_possible);
-                                       },
-                                       None => {}
+                               if let Some(node_id) = peer.their_node_id {
+                                       log_trace!(self.logger,
+                                               "Handling disconnection of peer {}, with {}future connection to the peer possible.",
+                                               log_pubkey!(node_id), if no_connection_possible { "no " } else { "" });
+                                       self.node_id_to_descriptor.lock().unwrap().remove(&node_id);
+                                       self.message_handler.chan_handler.peer_disconnected(&node_id, no_connection_possible);
                                }
                        }
                };