diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index e130709df..0248df856 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -424,6 +424,7 @@ impl BytesMut { pub fn truncate(&mut self, len: usize) { if len < self.len() { unsafe { + // SAFETY: Shrinking the buffer cannot expose uninitialized bytes. self.set_len(len); } }