]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Drop uneccessary `if {...; bool}` pattern in PeerManager 2022-08-cleanup-ratelimits
authorMatt Corallo <git@bluematt.me>
Mon, 15 Aug 2022 19:38:45 +0000 (19:38 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 16 Aug 2022 00:52:44 +0000 (00:52 +0000)
lightning/src/ln/peer_handler.rs

index 277eab5894365525e8b483833dc09ae46ef28aec..623aa969dfd4262da60773428c6d03aff681a4ab 100644 (file)
@@ -779,17 +779,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref, CMH: Deref> P
                                self.maybe_send_extra_ping(peer);
                        }
 
-                       if {
-                               let next_buff = match peer.pending_outbound_buffer.front() {
-                                       None => return,
-                                       Some(buff) => buff,
-                               };
+                       let next_buff = match peer.pending_outbound_buffer.front() {
+                               None => return,
+                               Some(buff) => buff,
+                       };
 
-                               let pending = &next_buff[peer.pending_outbound_buffer_first_msg_offset..];
-                               let data_sent = descriptor.send_data(pending, peer.should_read());
-                               peer.pending_outbound_buffer_first_msg_offset += data_sent;
-                               peer.pending_outbound_buffer_first_msg_offset == next_buff.len()
-                       } {
+                       let pending = &next_buff[peer.pending_outbound_buffer_first_msg_offset..];
+                       let data_sent = descriptor.send_data(pending, peer.should_read());
+                       peer.pending_outbound_buffer_first_msg_offset += data_sent;
+                       if peer.pending_outbound_buffer_first_msg_offset == next_buff.len() {
                                peer.pending_outbound_buffer_first_msg_offset = 0;
                                peer.pending_outbound_buffer.pop_front();
                        } else {