Skip to content

Commit

Permalink
use the const instead of a magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
lthiery committed Aug 16, 2023
1 parent dcc3702 commit a399816
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/packet/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ fn random_token(buffer: &[u8]) -> u16 {

pub fn gateway_mac(buffer: &[u8]) -> Result<MacAddress, ParseError> {
if buffer.len() < GATEWAY_MAC_LEN {
Err(ParseError::InvalidPacketLength(buffer.len(), 8))
Err(ParseError::InvalidPacketLength(
buffer.len(),
GATEWAY_MAC_LEN,
))
} else {
Ok(MacAddress::new(
buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7],
Expand Down

0 comments on commit a399816

Please sign in to comment.