diff options
Diffstat (limited to 'src/reader.rs')
-rw-r--r-- | src/reader.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/reader.rs b/src/reader.rs index 478af36..3426dcb 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -24,6 +24,8 @@ impl<T: futures_lite::io::AsyncRead + std::marker::Unpin + Send> Reader<T> { /// * [`Error::EOF`](crate::Error::EOF): The input stream has been closed. /// * [`Error::Read`](crate::Error::Read): There was an error reading from /// the input stream. + // these unwraps aren't reachable + #[allow(clippy::missing_panics_doc)] pub async fn read_frame(&mut self) -> crate::Result<crate::Frame> { loop { if let Some(frame) = self.parser.next_frame() { @@ -40,7 +42,7 @@ impl<T: futures_lite::io::AsyncRead + std::marker::Unpin + Send> Reader<T> { self.parser.add_bytes( // read() returning a value means that that many bytes are // guaranteed to be available - self.buf.get(..bytes).unwrap_or_else(|| unreachable!()), + &self.buf[..bytes], ); } } |