diff options
author | Alex Auvolat <alex@adnab.me> | 2021-10-12 13:18:24 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-10-12 13:18:24 +0200 |
commit | 74e661febe14e165349497bca689a50c5edacc94 (patch) | |
tree | 1a19b11e5f182828ab6976a58ae9e99e785ee4df /src/proto.rs | |
parent | 7753b789b7aca87db4db7aed20e79a41ecb0b225 (diff) | |
download | netapp-74e661febe14e165349497bca689a50c5edacc94.tar.gz netapp-74e661febe14e165349497bca689a50c5edacc94.zip |
Fix clippy lints
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 { |