From c9b3751f061b340e3e92aecd530dfc9d48f9e2cc Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Tue, 30 Jan 2024 16:25:28 +0530 Subject: Use with_capacity as it's known by now. --- src/vrrpv2.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vrrpv2.rs') diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index e0f45a6..aabe60a 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -112,7 +112,7 @@ fn parse(bytes: &[u8]) -> Result { let Ok(checksum) = rdr.read_u16() else { return Err(VRRPv2Error::ParseError); }; - let mut ip_addrs = Vec::new(); + let mut ip_addrs = Vec::with_capacity(count_ip_addrs as usize); for _i in 0..count_ip_addrs { let Ok(b) = rdr.read_u32() else { return Err(VRRPv2Error::ParseError); -- cgit v1.2.3