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 9d3ec1c commit ce09d7dCopy full SHA for ce09d7d
src/bytes.rs
@@ -385,13 +385,6 @@ impl Bytes {
385
/// Panics if `at > len`.
386
#[must_use = "consider Bytes::truncate if you don't need the other half"]
387
pub fn split_off(&mut self, at: usize) -> Self {
388
- assert!(
389
- at <= self.len(),
390
- "split_off out of bounds: {:?} <= {:?}",
391
- at,
392
- self.len(),
393
- );
394
-
395
if at == self.len() {
396
return Bytes::new();
397
}
@@ -400,6 +393,13 @@ impl Bytes {
400
return mem::replace(self, Bytes::new());
401
402
+ assert!(
+ at <= self.len(),
398
+ "split_off out of bounds: {:?} <= {:?}",
399
+ at,
+ self.len(),
+ );
+
403
let mut ret = self.clone();
404
405
self.len = at;
0 commit comments