Skip to content

Commit

Permalink
Use if let instead of match
Browse files Browse the repository at this point in the history
(Review in whitespace changes ignored mode)
  • Loading branch information
Mingun authored and dralley committed Jun 9, 2024
1 parent 6c58bef commit 0cb09fb
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/reader/buffered_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,19 @@ macro_rules! impl_buffered_source {
}
};

match parser.feed(available) {
Some(i) => {
buf.extend_from_slice(&available[..i]);
if let Some(i) = parser.feed(available) {
buf.extend_from_slice(&available[..i]);

// +1 for `>` which we do not include
self $(.$reader)? .consume(i + 1);
read += i + 1;
// +1 for `>` which we do not include
self $(.$reader)? .consume(i + 1);
read += i + 1;

*position += read;
return Ok(&buf[start..]);
}
None => {
buf.extend_from_slice(available);
available.len()
}
*position += read;
return Ok(&buf[start..]);
}

buf.extend_from_slice(available);
available.len()
};
self $(.$reader)? .consume(used);
read += used;
Expand Down

0 comments on commit 0cb09fb

Please sign in to comment.