mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-20 00:00:10 +02:00
refactor: make parameter mut in From<Vec> (#667)
Instead of re-declaring `vec`, we can just use a mut parameter.
This commit is contained in:
+1
-2
@@ -828,8 +828,7 @@ impl From<&'static str> for Bytes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<Vec<u8>> for Bytes {
|
impl From<Vec<u8>> for Bytes {
|
||||||
fn from(vec: Vec<u8>) -> Bytes {
|
fn from(mut vec: Vec<u8>) -> Bytes {
|
||||||
let mut vec = vec;
|
|
||||||
let ptr = vec.as_mut_ptr();
|
let ptr = vec.as_mut_ptr();
|
||||||
let len = vec.len();
|
let len = vec.len();
|
||||||
let cap = vec.capacity();
|
let cap = vec.capacity();
|
||||||
|
|||||||
Reference in New Issue
Block a user