Uh oh!
There was an error while loading. Please reload this page.
Add Iterator::collect_into - #93057
Conversation
rust-highfive
commented
Jan 19, 2022
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @dtolnay (or someone else) soon. Please see the contribution instructions for more information. |
dtolnay
left a comment
There was a problem hiding this comment.
I've skimmed the previous discussions in #48597 and #92982 and I don't personally see the appeal of this. Adding a minor variation like this to accomplish something that is already easy distracts people into having to think about which way to write the same thing when, rather than just writing what they mean, and that overshadows any benefit of having the API.
Is there someone else from @rust-lang/libs-api who would prefer to see this signature added?
fncollect_into<E:Extend<Self::Item>>(self,collection:&mutE) -> &mutEIf so, I'll let you approve the unstable and we can hash it out further when it comes to stabilization.
m-ou-se
commented
Jan 28, 2022
I'm not entirely convinced, but I do see how it makes (I don't think Some relevant grep counts from the crates on crates.io:
(That particular implementation would be more powerful if we had |
frengor
commented
Jan 28, 2022
I personally don't think Moreover, as pointed out by @m-ou-se, when learning about iterators, Finally, I think people will just use the method they prefer. Also note that the proposed doc is clearly stating that |
bors
commented
Feb 4, 2022
☔ The latest upstream changes (presumably #93645) made this pull request unmergeable. Please resolve the merge conflicts. |
0b978ef to
64b86bbCompare
This comment has been minimized.
This comment has been minimized.
64b86bb to
70d8449Comparebors
commented
Feb 18, 2022
☔ The latest upstream changes (presumably #94103) made this pull request unmergeable. Please resolve the merge conflicts. |
70d8449 to
b9a44b1Compare
This comment has been minimized.
This comment has been minimized.
b9a44b1 to
04b3162Comparem-ou-se
commented
Mar 9, 2022
Alright, let's try this out as an unstable feature. Can you open a tracking issue and put its number it in the |
frengor
commented
Mar 9, 2022
Of course, give me a moment. |
m-ou-se
commented
Mar 9, 2022
@bors r+ |
bors
commented
Mar 9, 2022
📌 Commit 63eddb3 has been approved by |
Add Iterator::collect_into This PR adds `Iterator::collect_into` as proposed by `@cormacrelf` in rust-lang#48597 (see rust-lang#48597 (comment)). Followup of rust-lang#92982. This adds the following method to the Iterator trait: ```rust fn collect_into<E: Extend<Self::Item>>(self, collection: &mut E) -> &mut E ```
…askrgr Rollup of 8 pull requests Successful merges: - rust-lang#91804 (Make some `Clone` impls `const`) - rust-lang#92541 (Mention intent of `From` trait in its docs) - rust-lang#93057 (Add Iterator::collect_into) - rust-lang#94739 (Suggest `if let`/`let_else` for refutable pat in `let`) - rust-lang#94754 (Warn users about `||` in let chain expressions) - rust-lang#94763 (Add documentation about lifetimes to thread::scope.) - rust-lang#94768 (Ignore `close_read_wakes_up` test on SGX platform) - rust-lang#94772 (Add miri to the well known conditional compilation names and values) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
cormacrelf
commented
Mar 10, 2022
Awesome, thanks everyone, especially @frengor, IIRC first contribution and did a great job. 🦀 |
frengor
commented
Mar 11, 2022
Thank you! |
This PR adds
Iterator::collect_intoas proposed by @cormacrelf in #48597 (see #48597 (comment)).Followup of #92982.
This adds the following method to the Iterator trait: