diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-15 02:36:32 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-15 02:36:32 -0500 |
commit | 3e0b4e415b99f9324cc0e25c71444d73dbff869f (patch) | |
tree | 54e1324c8620aeacd6807377f21b5233d39e7942 /src/blocking | |
parent | 75d44755bdd5da61e6409fa739e333b1e2b9a1da (diff) | |
download | ttyrec-3e0b4e415b99f9324cc0e25c71444d73dbff869f.tar.gz ttyrec-3e0b4e415b99f9324cc0e25c71444d73dbff869f.zip |
be a bit less aggressive
Diffstat (limited to 'src/blocking')
-rw-r--r-- | src/blocking/reader.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/blocking/reader.rs b/src/blocking/reader.rs index f4a51a8..ef2f783 100644 --- a/src/blocking/reader.rs +++ b/src/blocking/reader.rs @@ -21,6 +21,8 @@ impl<T: std::io::Read> 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 fn read_frame(&mut self) -> crate::Result<crate::Frame> { loop { if let Some(frame) = self.parser.next_frame() { @@ -36,7 +38,7 @@ impl<T: std::io::Read> 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], ); } } |