Skip to content

Commit

Permalink
set len a little more concisely
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Jan 21, 2024
1 parent 0864aea commit ea9dd60
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,13 +888,7 @@ impl BytesMut {
// new start and updating the `len` field to reflect the new length
// of the view.
self.ptr = vptr(self.ptr.as_ptr().add(start));

if self.len >= start {
self.len -= start;
} else {
self.len = 0;
}

self.len = self.len.checked_sub(start).unwrap_or(0);
self.cap -= start;
}

Expand Down

0 comments on commit ea9dd60

Please sign in to comment.