From 32b973478cd806c5f07ffa128179a5395a6597c9 Mon Sep 17 00:00:00 2001 From: Sunil Nimmagadda Date: Sun, 4 May 2025 11:59:40 +0530 Subject: Use a match here. --- src/vrrpv2.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/vrrpv2.rs') diff --git a/src/vrrpv2.rs b/src/vrrpv2.rs index 0968c7c..8247b19 100644 --- a/src/vrrpv2.rs +++ b/src/vrrpv2.rs @@ -192,10 +192,10 @@ fn parse(bytes: &[u8]) -> Result { /// ``` pub fn from_bytes(bytes: &[u8]) -> Result { let vrrpv2 = parse(bytes)?; - if checksum(bytes) != 0 { - return Err(VRRPv2Error::InvalidChecksum); + match checksum(bytes) { + 0 => Ok(vrrpv2), + _ => Err(VRRPv2Error::InvalidChecksum), } - Ok(vrrpv2) } fn checksum(bytes: &[u8]) -> u16 { -- cgit v1.2.3