Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,6 @@ impl Bytes {
/// Panics if `at > len`.
#[must_use = "consider Bytes::truncate if you don't need the other half"]
pub fn split_off(&mut self, at: usize) -> Self {
assert!(
at <= self.len(),
"split_off out of bounds: {:?} <= {:?}",
at,
self.len(),
);

if at == self.len() {
return Bytes::new();
}
Expand All @@ -400,6 +393,13 @@ impl Bytes {
return mem::replace(self, Bytes::new());
}

assert!(
at <= self.len(),
"split_off out of bounds: {:?} <= {:?}",
at,
self.len(),
);

let mut ret = self.clone();

self.len = at;
Expand Down