Skip to content

Commit

Permalink
refactor: make parameter mut in From<Vec> (#667)
Browse files Browse the repository at this point in the history
Instead of re-declaring `vec`, we can just use a mut parameter.
  • Loading branch information
braddunbar authored Jan 31, 2024
1 parent e24587d commit d2e7abd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,7 @@ impl From<&'static str> for Bytes {
}

impl From<Vec<u8>> for Bytes {
fn from(vec: Vec<u8>) -> Bytes {
let mut vec = vec;
fn from(mut vec: Vec<u8>) -> Bytes {
let ptr = vec.as_mut_ptr();
let len = vec.len();
let cap = vec.capacity();
Expand Down

0 comments on commit d2e7abd

Please sign in to comment.