From 6c62c26d0df243b00914de22cb8d30a8ba3e3eb4 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Wed, 1 Mar 2023 01:19:16 -0500 Subject: clippy my beloved --- packet/src/lib.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'packet/src/lib.rs') diff --git a/packet/src/lib.rs b/packet/src/lib.rs index 6c9a097..c7a8eb9 100644 --- a/packet/src/lib.rs +++ b/packet/src/lib.rs @@ -28,8 +28,8 @@ pub use query::QueryType as PacketType; pub use question::DnsQuestion as PacketQuestion; impl Packet { - pub fn new() -> Packet { - Packet { + pub fn new() -> Self { + Self { header: DnsHeader::new(), questions: Vec::new(), answers: Vec::new(), @@ -38,8 +38,8 @@ impl Packet { } } - pub fn from_buffer(buffer: &mut PacketBuffer) -> Result { - let mut result = Packet::new(); + pub fn from_buffer(buffer: &mut PacketBuffer) -> Result { + let mut result = Self::new(); result.header.read(buffer)?; for _ in 0..result.header.questions { @@ -138,7 +138,6 @@ impl Packet { _ => None, }) }) - .map(|addr| addr) // Finally, pick the first valid entry .next() } -- cgit v1.2.3-freya