Taking a slice of the entire vec then turning back into vector is the same thing as just .clone(), which isn't even needed as shit would just end its lifetime after the function returns
return is not needed when there is no semicolon at end of last statement
Since it passes ownership of bytes to the function, there is no need to clone it
Just starting learning Rust, dunno if this is it, or if I'm right
to_vec is just another clone, they could just use .remove(index). Also, we can't tell the context to know whether returning a vector was really needed.
I am extending these characters in text to you, my mammal companion in species-hood, as a sign of thankfulness and companionship. My statement is not a falsehood; we are both made of flesh and blood and are indeed alive. We are carbon-based life forms, obviously.
However, I must make a counterargument-- the one who has behaved in a way fitting of accolades is you, for you have looked at the colorful picture and translated it into characters not unlike the ones we are currently using to communicate. Godspeed.
16
u/Respawned234 Aug 14 '21 edited Aug 14 '21
f>32, f already isn't 0.clone(), which isn't even needed asshitwould just end its lifetime after the function returnsreturnis not needed when there is no semicolon at end of last statementbytesto the function, there is no need to clone itJust starting learning Rust, dunno if this is it, or if I'm right
4
u/daterkerjabs Aug 14 '21
LGTM. 🚢 It!
4
u/knightttime Aug 14 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
1
u/Martsadas Aug 15 '21
i dont even know what programming language is this
1
u/Tornado547 Jan 26 '22
Since bytes gets dropped anyway here you may as well just modify bytes directly and not even have to clone it.