Skip to content

Commit

Permalink
get_vec_pos: use &self instead of &mut self (#670)
Browse files Browse the repository at this point in the history
I can't see any reason that get_vec_pos needs a &mut self.
  • Loading branch information
braddunbar authored Feb 6, 2024
1 parent f586ffc commit 1bcd212
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/bytes_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl BytesMut {
/// th.join().unwrap();
/// ```
#[inline]
pub fn freeze(mut self) -> Bytes {
pub fn freeze(self) -> Bytes {
if self.kind() == KIND_VEC {
// Just re-use `Bytes` internal Vec vtable
unsafe {
Expand Down Expand Up @@ -978,7 +978,7 @@ impl BytesMut {
}

#[inline]
unsafe fn get_vec_pos(&mut self) -> usize {
unsafe fn get_vec_pos(&self) -> usize {
debug_assert_eq!(self.kind(), KIND_VEC);

self.data as usize >> VEC_POS_OFFSET
Expand Down Expand Up @@ -1618,7 +1618,7 @@ impl PartialEq<Bytes> for BytesMut {
}

impl From<BytesMut> for Vec<u8> {
fn from(mut bytes: BytesMut) -> Self {
fn from(bytes: BytesMut) -> Self {
let kind = bytes.kind();

let mut vec = if kind == KIND_VEC {
Expand Down

0 comments on commit 1bcd212

Please sign in to comment.