diff options
author | 2024-02-06 17:34:30 -0500 | |
---|---|---|
committer | 2024-02-06 17:34:30 -0500 | |
commit | 1bcd2129d195a0722d8b5b1a16c7d33698701f2e (patch) | |
tree | 0af0086c1a81ce2cf89d347d7b4e2dd154b4863e /src | |
parent | f586ffc52589f01be1b4a44d6544b3d0226773d6 (diff) | |
download | bytes-1bcd2129d195a0722d8b5b1a16c7d33698701f2e.tar.gz bytes-1bcd2129d195a0722d8b5b1a16c7d33698701f2e.tar.zst bytes-1bcd2129d195a0722d8b5b1a16c7d33698701f2e.zip |
get_vec_pos: use &self instead of &mut self (#670)
I can't see any reason that get_vec_pos needs a &mut self.
Diffstat (limited to 'src')
-rw-r--r-- | src/bytes_mut.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index bb72a21..9018896 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -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 { @@ -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 @@ -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 { |