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 e4af486 commit 4eb62b9Copy full SHA for 4eb62b9
src/bytes.rs
@@ -434,13 +434,6 @@ impl Bytes {
434
/// Panics if `at > len`.
435
#[must_use = "consider Bytes::advance if you don't need the other half"]
436
pub fn split_to(&mut self, at: usize) -> Self {
437
- assert!(
438
- at <= self.len(),
439
- "split_to out of bounds: {:?} <= {:?}",
440
- at,
441
- self.len(),
442
- );
443
-
444
if at == self.len() {
445
return mem::replace(self, Bytes::new());
446
}
@@ -449,6 +442,13 @@ impl Bytes {
449
return Bytes::new();
450
451
+ assert!(
+ at <= self.len(),
447
+ "split_to out of bounds: {:?} <= {:?}",
448
+ at,
+ self.len(),
+ );
+
452
let mut ret = self.clone();
453
454
unsafe { self.inc_start(at) };
0 commit comments