diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2023-03-01 01:19:16 -0500 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2023-03-01 01:19:16 -0500 |
commit | 6c62c26d0df243b00914de22cb8d30a8ba3e3eb4 (patch) | |
tree | b54f1285f3491f9821718686ed3982cdac19d57e /packet/src/lib.rs | |
parent | inital working dns (diff) | |
download | wrapper-6c62c26d0df243b00914de22cb8d30a8ba3e3eb4.tar.gz wrapper-6c62c26d0df243b00914de22cb8d30a8ba3e3eb4.tar.bz2 wrapper-6c62c26d0df243b00914de22cb8d30a8ba3e3eb4.zip |
clippy my beloved
Diffstat (limited to 'packet/src/lib.rs')
-rw-r--r-- | packet/src/lib.rs | 9 |
1 files changed, 4 insertions, 5 deletions
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<Packet> { - let mut result = Packet::new(); + pub fn from_buffer(buffer: &mut PacketBuffer) -> Result<Self> { + 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() } |