-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Implement Vec::from_elem
(RFC 832)
#22455
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
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @gankro (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see CONTRIBUTING.md for more information. |
let mut ptr = v.as_mut_ptr(); | ||
|
||
// Write all elements except the last one | ||
for i in range(1, n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range(1, n) -> 1..n
(yes I know the RFC had this, I am dumb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem :)
Ok this looks good to me, I'd just like @aturon or @alexcrichton to verify that public-stable-doc(hidden)-free-fn-in-std::vec is the way we want to go on this. |
Ok IRC says this is the right approach. r=me with commits squashed. |
Implement `Vec::from_elem` by making the `vec![element; len]` macro more powerful (see RFC 832). Closes rust-lang#22414
a528491
to
2bf553c
Compare
Great! I've squashed the commits as requested |
Thanks, and great work! ❤️ |
Thanks for mentoring! |
Implement `Vec::from_elem` by making the `vec![element; len]` macro more powerful (see rust-lang/rfcs#832). Closes rust-lang#22414 r? @gankro
Implement
Vec::from_elem
by making thevec![element; len]
macro more powerful (see rust-lang/rfcs#832).Closes #22414
r? @gankro