From: Matt Corallo Date: Mon, 15 Aug 2022 19:38:45 +0000 (+0000) Subject: Drop uneccessary `if {...; bool}` pattern in PeerManager X-Git-Tag: v0.0.111~37^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=8ffaacb3c3d1979fdf7c986b4e7f671926e9e6b5;p=rust-lightning Drop uneccessary `if {...; bool}` pattern in PeerManager --- diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 277eab589..623aa969d 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -779,17 +779,15 @@ impl 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 {