Construct vec with capacity

This commit is contained in:
Rohan Bhela committed 2025-04-19 12:16:17 -07:00
1 parent d724073c22
commit a8004699f6
1 file changed
+1 -1
+1 -1
View File
@@ -56,7 +56,7 @@ pub async fn ping_server(host: &(String, u16)) -> Result<String, PingServerError
return Err(PingServerError::MalformedResponse);
}
let mut output = vec![];
let mut output = Vec::with_capacity(bytes_needed);
output.extend_from_slice(&buffer[..total_read]);
let json = decode(&(buffer[(length + 1).into()..]));