From: Viktor Tigerström <11711198+ViktorTigerstrom@users.noreply.github.com> Date: Thu, 12 Jan 2023 22:25:44 +0000 (+0100) Subject: Remove redundant Vec in `get_and_clear_pending_msg_events` X-Git-Tag: v0.0.114-beta~21^2~6 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=29ed2864f32e4748f67eb64a5cc74c8a6defe4b4;p=rust-lightning Remove redundant Vec in `get_and_clear_pending_msg_events` --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 583e8422c..fefa002ee 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -5706,9 +5706,7 @@ where let mut peer_state_lock = peer_state_mutex.lock().unwrap(); let peer_state = &mut *peer_state_lock; if peer_state.pending_msg_events.len() > 0 { - let mut peer_pending_events = Vec::new(); - mem::swap(&mut peer_pending_events, &mut peer_state.pending_msg_events); - pending_events.append(&mut peer_pending_events); + pending_events.append(&mut peer_state.pending_msg_events); } }