From 84c04ab9df3a68dfcf7932bf3550c3e436d10204 Mon Sep 17 00:00:00 2001 From: Yujia Qiao Date: Fri, 3 Nov 2023 19:37:43 +0800 Subject: [PATCH] fix: clippy (#302) --- src/protocol.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/protocol.rs b/src/protocol.rs index 577c7323..955346ef 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -112,8 +112,7 @@ impl UdpTraffic { } pub async fn read(reader: &mut T, hdr_len: u8) -> Result { - let mut buf = Vec::new(); - buf.resize(hdr_len as usize, 0); + let mut buf = vec![0; hdr_len as usize]; reader .read_exact(&mut buf) .await