We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When to_vec() is called on temporary Vec<_> the lint should warn that to_vec() is not needed and causes extra allocation. (Suggesting removing it.)
to_vec()
Vec<_>
What is the advantage of the recommended code over the original code
None.
(playground)
fn create_vec() -> Vec<u8> { vec![1, 2, 42] } fn main() { println!("{:?}", create_vec().to_vec()); }
Could be written as:
fn create_vec() -> Vec<u8> { vec![1, 2, 42] } fn main() { println!("{:?}", create_vec()); }
The text was updated successfully, but these errors were encountered:
This can be an enhancement of redundant_clone. And it should share logic with implicit_clone.
redundant_clone
implicit_clone
Sorry, something went wrong.
No branches or pull requests
What it does
When
to_vec()
is called on temporaryVec<_>
the lint should warn thatto_vec()
is not needed and causes extra allocation. (Suggesting removing it.)Categories
What is the advantage of the recommended code over the original code
Vec<_>
)Drawbacks
None.
Example
(playground)
Could be written as:
The text was updated successfully, but these errors were encountered: