We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0864aea commit ea9dd60Copy full SHA for ea9dd60
src/bytes_mut.rs
@@ -888,13 +888,7 @@ impl BytesMut {
888
// new start and updating the `len` field to reflect the new length
889
// of the view.
890
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
+ self.len = self.len.checked_sub(start).unwrap_or(0);
898
self.cap -= start;
899
}
900
0 commit comments