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

Replace vec! with Vec::{from,new}. #617

Merged
merged 1 commit into from
Oct 7, 2022
Merged

Replace vec! with Vec::{from,new}. #617

merged 1 commit into from
Oct 7, 2022

Conversation

branlwyd
Copy link
Contributor

@branlwyd branlwyd commented Oct 7, 2022

Opinionated change: since Rust 1.44 [1], it has been possible to use Vec::from to write vector literals. On the idea that a method call is a simpler tool than a macro, prefer a method call. (Vec::new is also used, if the vector being created is empty.)

[1] rust-lang/rust#68692

Opinionated change: since Rust 1.44 [1], it has been possible to use
Vec::from to write vector literals. On the idea that a method call is
a simpler tool than a macro, prefer a method call. (Vec::new is also
used, if the vector being created is empty.)

[1] rust-lang/rust#68692
@branlwyd branlwyd requested a review from a team as a code owner October 7, 2022 17:48
@branlwyd
Copy link
Contributor Author

branlwyd commented Oct 7, 2022

(This is a style-only change, I suspect it will have negligible effect on compile times & no effect on run times. I've been experimenting with replacing vec! in the last few PRs and it worked well so I cleaned up the last few instances of vec!.)

@branlwyd branlwyd merged commit 0ae3a66 into main Oct 7, 2022
@branlwyd branlwyd deleted the bran/vec-from branch October 7, 2022 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants