-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Add BinaryHeap::retain as suggested in #42849 #71485
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (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. Due to 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 the contribution instructions for more information. |
Please also note in the documentation that this visits the elements in unsorted (and unspecified) order. r? @Amanieu for approval of the method. I suspect we may want to add retain_sorted as well. |
90698d7
to
70c6c0e
Compare
Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Could you create a separate tracking issue for this feature? Also as @Mark-Simulacrum said, please add a note in the docs that the iteration order is arbitrary (just like the
There is no efficient way to iterate over a heap in sorted order, so I would rather not add this method. |
|
I attempted to determine if there was an efficient way, but wasn't sure. That's enough reason for me though :) |
70c6c0e
to
177fd06
Compare
177fd06
to
787eddc
Compare
@bors r+ |
📌 Commit 787eddc has been approved by |
…manieu Add BinaryHeap::retain as suggested in rust-lang#42849 This PR implements retain for BinaryHeap as suggested in rust-lang#42849. This is my first PR for Rust, so please let me know if I should be doing anything differently, thanks!
Rollup of 8 pull requests Successful merges: - rust-lang#69456 (fix misleading type annotation diagonstics) - rust-lang#71330 (Only run dataflow for const qualification if type-based check would fail) - rust-lang#71480 (Improve PanicInfo examples readability) - rust-lang#71485 (Add BinaryHeap::retain as suggested in rust-lang#42849) - rust-lang#71512 (Remove useless "" args) - rust-lang#71527 (Miscellaneous cleanup in `check_consts`) - rust-lang#71534 (Avoid unused Option::map results) - rust-lang#71535 (Fix typos in docs for keyword "in") Failed merges: r? @ghost
This PR implements retain for BinaryHeap as suggested in #42849.
This is my first PR for Rust, so please let me know if I should be doing anything differently, thanks!