mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 13:24:19 +00:00
Remove assertion and don't consume 0 bytes
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
fbba417f09
commit
437145afbe
1 changed files with 3 additions and 3 deletions
|
@ -1753,8 +1753,6 @@ impl<'a> Iterator for MultiBufferChunks<'a> {
|
|||
|
||||
impl<'a> MultiBufferBytes<'a> {
|
||||
fn consume(&mut self, len: usize) {
|
||||
assert!(len > 0);
|
||||
|
||||
self.range.start += len;
|
||||
self.chunk = &self.chunk[len..];
|
||||
|
||||
|
@ -1796,7 +1794,9 @@ impl<'a> io::Read for MultiBufferBytes<'a> {
|
|||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
let len = cmp::min(buf.len(), self.chunk.len());
|
||||
buf[..len].copy_from_slice(&self.chunk[..len]);
|
||||
self.consume(len);
|
||||
if len > 0 {
|
||||
self.consume(len);
|
||||
}
|
||||
Ok(len)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue