From dcada8f40671b54f10bff7f0f8dd5a9240321d74 Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Sat, 23 Nov 2024 23:21:32 +0530 Subject: Use write_all as pointed out by clippy. --- src/vrrpv2.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index 9a08801..c9d5031 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -102,7 +102,7 @@ impl VRRPv2 { let sz = (4 + self.count_ip_addrs) * 4; let bytes: Vec = Vec::with_capacity(sz.into()); let mut wr = Cursor::new(bytes); - wr.write( + wr.write_all( [ 0x21, self.virtual_router_id, @@ -111,13 +111,13 @@ impl VRRPv2 { ] .as_ref(), )?; - wr.write([self.auth_type as u8, self.advertisement_interval].as_ref())?; - wr.write(self.checksum.to_be_bytes().as_ref())?; + wr.write_all([self.auth_type as u8, self.advertisement_interval].as_ref())?; + wr.write_all(self.checksum.to_be_bytes().as_ref())?; for ip in self.ip_addrs.iter() { - wr.write(&ip.to_bits().to_be_bytes())?; + wr.write_all(&ip.to_bits().to_be_bytes())?; } - wr.write([0; 4].as_ref())?; // Authentication Data 1 - wr.write([0; 4].as_ref())?; // Authentication Data 2 + wr.write_all([0; 4].as_ref())?; // Authentication Data 1 + wr.write_all([0; 4].as_ref())?; // Authentication Data 2 Ok(wr.into_inner()) } } -- cgit v1.2.3