Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_vec_pos: use &self instead of &mut self #670

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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