Skip to content

Commit

Permalink
get_vec_pos: use &self instead of &mut self
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 committed Jan 31, 2024
1 parent e24587d commit 6e8ab52
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 @@ -982,7 +982,7 @@ impl BytesMut {
}

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

let prev = self.data as usize;
Expand Down Expand Up @@ -1620,7 +1620,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 6e8ab52

Please sign in to comment.