From 00ac8cbb4f50436c8bf59eddeca7cbada11054a0 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 3 Apr 2022 20:56:54 +0200 Subject: [PATCH] Use result for test --- src/proto.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/proto.rs b/src/proto.rs index 6dd256f..73bbd52 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -245,7 +245,7 @@ mod tests { } #[test] - fn parse_dns_header_opcode_valid() { + fn parse_dns_header_opcode_valid() -> Result<(), DNSParseError> { let mut dns_query = [ 0xff, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; @@ -261,10 +261,8 @@ mod tests { for (idx, opcode) in valid_opcodes.iter().enumerate() { dns_query[2] = opcode << 3; let parse_result = DNSHeader::from_udp_datagram(&dns_query); - assert_eq!( - parse_result.map(|x| x.opcode), - Ok(valid_parsed_opcodes[idx]) - ); + assert_eq!(parse_result?.opcode, valid_parsed_opcodes[idx]); } + Ok(()) } }