From b97174340bad78f2df33d8fb8bef9c841c6e511b Mon Sep 17 00:00:00 2001 From: Brad Dunbar Date: Tue, 6 Feb 2024 16:20:31 -0500 Subject: [PATCH] consistency in split_off and split_to --- src/bytes_mut.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index e485363d4..5784ff871 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -393,11 +393,11 @@ impl BytesMut { unsafe { let mut other = self.shallow_clone(); - other.cap = at; - other.len = at; // SAFETY: We've checked that `at` <= `self.len()` and we know that `self.len()` <= // `self.capacity()`. self.advance_unchecked(at); + other.cap = at; + other.len = at; other } }