We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 53fcca5 commit 83ccdf3Copy full SHA for 83ccdf3
src/common.rs
@@ -42,12 +42,9 @@ impl ChunkedFile {
42
impl Read for ChunkedFile {
43
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
44
let mut currently_read = 0;
45
- let mut index = match self.chunks.iter().position(|(_, chunk)| {
+ let mut index = self.chunks.iter().position(|(_, chunk)| {
46
chunk.offset >= self.position && chunk.offset + chunk.size < self.position
47
- }) {
48
- None => return Err(ErrorKind::UnexpectedEof.into()),
49
- Some(i) => i,
50
- };
+ }).unwrap_or_else(|| usize::MAX);
51
while currently_read < buf.len() && index < self.chunks.len() {
52
let (path, chunk) = &self.chunks[index];
53
let chunk_position = self.position - chunk.offset;
0 commit comments