Skip to content

Commit

Permalink
Revert "Reuse capacity when possible in <BytesMut as Buf>::advance im…
Browse files Browse the repository at this point in the history
…pl" (#726)

This reverts commit baa5053.
  • Loading branch information
Darksonn authored Aug 1, 2024
1 parent 03fdde9 commit f488be4
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,13 +1148,6 @@ impl Buf for BytesMut {

#[inline]
fn advance(&mut self, cnt: usize) {
// Advancing by the length is the same as resetting the length to 0,
// except this way we get to reuse the full capacity.
if cnt == self.remaining() {
self.clear();
return;
}

assert!(
cnt <= self.remaining(),
"cannot advance past `remaining`: {:?} <= {:?}",
Expand Down

0 comments on commit f488be4

Please sign in to comment.