diff --git a/src/proto.rs b/src/proto.rs index a72b424..c26d676 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -125,7 +125,7 @@ impl From for DNSMessageType { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct DNSHeader { /// used by the requester to match up replies to outstanding queries pub id: u16, @@ -317,15 +317,13 @@ mod tests { dns_query[3] = (rcode as u8) << 0; let parse_result = DNSHeader::from_udp_datagram(&dns_query); - let parse_result_clone = parse_result.clone(); assert_eq!( - parse_result.err(), - Some(DNSParseError::DNSRCodeInvalid), - "query: {:02x?}, rcode: {}, parsed_rcode: {:?}", + parse_result, + Err(DNSParseError::DNSRCodeInvalid), + "query: {:02x?}, rcode: {}", dns_query, rcode, - parse_result_clone.map(|x| x.response_code).unwrap() ); } }