Skip to content

Commit

Permalink
Remove unnecessary block
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 0cb09fb commit 02de8a5
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/reader/buffered_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,31 +101,31 @@ macro_rules! impl_buffered_source {
let mut read = 0;
let start = buf.len();
loop {
let used = {
let available = match self $(.$reader)? .fill_buf() $(.$await)? {
Ok(n) if n.is_empty() => break,
Ok(n) => n,
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => continue,
Err(e) => {
*position += read;
return Err(Error::Io(e.into()));
}
};
let available = match self $(.$reader)? .fill_buf() $(.$await)? {
Ok(n) if n.is_empty() => break,
Ok(n) => n,
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => continue,
Err(e) => {
*position += read;
return Err(Error::Io(e.into()));
}
};

if let Some(i) = parser.feed(available) {
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..]);
}
*position += read;
return Ok(&buf[start..]);
}

buf.extend_from_slice(available);
available.len()
};
// The `>` symbol not yet found, continue reading
buf.extend_from_slice(available);

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

0 comments on commit 02de8a5

Please sign in to comment.