diff options
Diffstat (limited to 'src/proto.rs')
-rw-r--r-- | src/proto.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/proto.rs b/src/proto.rs index bfef8e7..d8f6289 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -65,7 +65,7 @@ impl SendQueue { let mut items_at_prio = self .items .remove(&prio) - .unwrap_or(VecDeque::with_capacity(4)); + .unwrap_or_else(|| VecDeque::with_capacity(4)); items_at_prio.push_back(item); self.items.insert(prio, items_at_prio); } @@ -143,7 +143,7 @@ pub(crate) trait SendLoop: Sync { let sth = msg_recv .recv() .await - .ok_or(Error::Message("Connection closed.".into()))?; + .ok_or_else(|| Error::Message("Connection closed.".into()))?; if let Some((id, prio, data)) = sth { trace!("send_loop: got {}, {} bytes", id, data.len()); sending.push(SendQueueItem { @@ -190,7 +190,7 @@ pub(crate) trait RecvLoop: Sync + 'static { read.read_exact(&mut next_slice[..]).await?; trace!("recv_loop: read {} bytes", next_slice.len()); - let mut msg_bytes = receiving.remove(&id).unwrap_or(vec![]); + let mut msg_bytes: Vec<_> = receiving.remove(&id).unwrap_or_default(); msg_bytes.extend_from_slice(&next_slice[..]); if has_cont { |