Skip to content

Commit ea9dd60

Browse files
committed
set len a little more concisely
1 parent 0864aea commit ea9dd60

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/bytes_mut.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -888,13 +888,7 @@ impl BytesMut {
888888
// new start and updating the `len` field to reflect the new length
889889
// of the view.
890890
self.ptr = vptr(self.ptr.as_ptr().add(start));
891-
892-
if self.len >= start {
893-
self.len -= start;
894-
} else {
895-
self.len = 0;
896-
}
897-
891+
self.len = self.len.checked_sub(start).unwrap_or(0);
898892
self.cap -= start;
899893
}
900894

0 commit comments

Comments
 (0)