Uh oh!
There was an error while loading. Please reload this page.
Stabilize peekable_next_if - #80011
Conversation
rust-highfive
commented
Dec 13, 2020
(rust-highfive has picked a reviewer for you, use r? to override) |
Stupremee
commented
Dec 13, 2020
r? @jyn514 |
jyn514
commented
Dec 13, 2020
I'm not on T-libs, I shouldn't be the reviewer. r? @dtolnay maybe since they reviewed the initial PR, but it will need FCP either way. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dtolnay
commented
Dec 13, 2020
@rust-lang/libs: These two methods on std::iter::Peekable: impl<I: Iterator> Peekable<I> {
+ pub fn next_if(&mut self, func: impl FnOnce(&I::Item) -> bool) -> Option<I::Item>;+ pub fn next_if_eq<T>(&mut self, expected: &T) -> Option<I::Item>+ where+ T: ?Sized,+ I::Item: PartialEq<T>;
}let alnum = peekable.next_if(char::is_ascii_alphanumeric);// equivalent to:let alnum = match peekable.peek(){Some(ch)if ch.is_ascii_alphanumeric() => Some(peekable.next().unwrap()),
_ => None,};https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
jyn514
commented
Dec 14, 2020
Why would you need to mutate the item? |
KodrAus
commented
Jan 21, 2021
Oh that's an interesting philosophical question... Should we always try offer up the most exclusive reference we can?
I wonder if we asked the same question about With But I think is a shared reference sufficient when we could use an exclusive one? is a good question we should keep asking! |
KodrAus
commented
Jan 21, 2021
A |
KodrAus
commented
Jan 21, 2021
@m-ou-se Do you feel strongly that |
m-ou-se
commented
Jan 21, 2021
That sounds good to me. @rfcbot resolve mut |
rfcbot
commented
Jan 21, 2021
🔔 This is now entering its final comment period, as per the review above. 🔔 |
rfcbot
commented
Jan 31, 2021
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. The RFC will be merged soon. |
dtolnay
commented
Feb 5, 2021
@bors r+ |
bors
commented
Feb 5, 2021
📌 Commit ceda547 has been approved by |
Rollup of 7 pull requests Successful merges: - rust-lang#80011 (Stabilize `peekable_next_if`) - rust-lang#81580 (Document how `MaybeUninit<Struct>` can be initialized.) - rust-lang#81610 (BTreeMap: make Ord bound explicit, compile-test its absence) - rust-lang#81664 (Avoid a hir access inside get_static) - rust-lang#81675 (Make rustdoc respect `--error-format short` in doctests) - rust-lang#81753 (Never MIR inline functions with a different instruction set) - rust-lang#81795 (Small refactor with Iterator::reduce) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR stabilizes the
peekable_next_iffeatureResolves#72480