X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fio%2Fbyteio.rs;h=0ff54cb13ed9321e31f794dbea03e8365d53dc39;hb=b53512389ece2e9e496ae2e99a1b2f2072931f1a;hp=2bac1900967b74545e411ccf0d8c5f886c07c775;hpb=52f954a3961a683e1b317c63067063082501ce3d;p=nihav.git diff --git a/nihav-core/src/io/byteio.rs b/nihav-core/src/io/byteio.rs index 2bac190..0ff54cb 100644 --- a/nihav-core/src/io/byteio.rs +++ b/nihav-core/src/io/byteio.rs @@ -753,14 +753,13 @@ impl ByteIO for BoundedFileReader { if ret.is_err() { return Err(ByteIOError::ReadError); } let sz = ret.unwrap(); if sz < len { - if let Err(_err) = self.file.read(&mut buf[sz..][..1]) { - self.eof = true; - if sz == 0 { - return Err(ByteIOError::EOF); - } - } else { + if let Ok(1) = self.file.read(&mut buf[sz..][..1]) { return Ok(sz + 1); } + self.eof = true; + if sz == 0 { + return Err(ByteIOError::EOF); + } } Ok(sz) }