From 23c248c63f9fb3d0e224cddcc84fb0ee9161101c Mon Sep 17 00:00:00 2001 From: tact1m4n3 Date: Sun, 27 Oct 2024 10:09:07 +0200 Subject: [PATCH] Fixed clippy warnings. --- src/parser.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 166335c..2f21df5 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -64,7 +64,7 @@ impl Parser { } /// Consumes a byte and returns a raw (not parsed) packet if one is available. - pub fn push_byte_raw<'a>(&'a mut self, byte: u8) -> Option, ParseError>> { + pub fn push_byte_raw(&mut self, byte: u8) -> Option> { match self.state { State::AwaitingSync => { if self.config.sync.contains(&byte) { @@ -152,9 +152,7 @@ impl Parser { } } State::AwaitingLen => { - let Some(byte) = reader.next() else { - return None; - }; + let byte = reader.next()?; if (MIN_LEN_BYTE..=MAX_LEN_BYTE).contains(&byte) { self.state = State::Reading { @@ -229,7 +227,7 @@ impl Iterator for PacketIterator<'_, '_> { fn next(&mut self) -> Option { if let Some((result, remaining_data)) = self.parser.push_bytes(self.remaining_data) { self.remaining_data = remaining_data; - return Some(result); + Some(result) } else { None }