Skip to content

Commit

Permalink
Add a SAFETY comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Apr 14, 2024
1 parent 80b38e0 commit 9e7d8ef
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 9e7d8ef

Please sign in to comment.