diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-14 18:38:01 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-14 18:38:40 -0500 |
commit | 75d44755bdd5da61e6409fa739e333b1e2b9a1da (patch) | |
tree | ba22c47415e27841f24850da5c4b1597248c8fec /src/blocking/reader.rs | |
parent | a50aafc38b07359bd4c7bf88f118cdbcdd561790 (diff) | |
download | ttyrec-75d44755bdd5da61e6409fa739e333b1e2b9a1da.tar.gz ttyrec-75d44755bdd5da61e6409fa739e333b1e2b9a1da.zip |
clippy
Diffstat (limited to 'src/blocking/reader.rs')
-rw-r--r-- | src/blocking/reader.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/blocking/reader.rs b/src/blocking/reader.rs index 609c393..f4a51a8 100644 --- a/src/blocking/reader.rs +++ b/src/blocking/reader.rs @@ -33,7 +33,11 @@ impl<T: std::io::Read> Reader<T> { if bytes == 0 { return Err(crate::Error::EOF); } - self.parser.add_bytes(&self.buf[..bytes]); + 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!()), + ); } } |