-
Notifications
You must be signed in to change notification settings - Fork 13.8k
feat: non-panicking Vec::try_remove
#146293
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
rustbot has assigned @workingjubilee. Use |
Vec::try_remove
7d39eb5
to
bea4dd2
Compare
This comment has been minimized.
This comment has been minimized.
bea4dd2
to
128b441
Compare
This comment has been minimized.
This comment has been minimized.
Looks like I inadvertently repeated #77480 I'd still like to reopen the discussion about this. |
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.
Additions to the standard library APIs will need an ACP first, see https://github.com/rust-lang/libs-team/issues > new issue > Api Change Proposal
This comment has been minimized.
This comment has been minimized.
5bf4f7d
to
c2ffa8a
Compare
Added the tracking issue to the description. Is that sufficient? Edit: added an ACP |
r? libs |
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.
I have a small nit, but after that this looks good to go.
Oh, and could you squash the commits, please? |
59a4d73
to
9a4c40a
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Vec::try_remove is a non-panicking version of Vec::remove
9a4c40a
to
5673449
Compare
Great, thank you! |
feat: non-panicking `Vec::try_remove` `if index < my_vector.len() { Some(my_vector.remove(index)) } else { None }` is annoying to write and non-panicking functions are broadly useful. APC: rust-lang/libs-team#649 Tracking issue: rust-lang#146954
Rollup of 8 pull requests Successful merges: - #116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - #135771 ([rustdoc] Add support for associated items in "jump to def" feature) - #141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - #142401 (Add proper name mangling for pattern types) - #146293 (feat: non-panicking `Vec::try_remove`) - #146859 (BTreeMap: Don't leak allocators when initializing nodes) - #146924 (Add doc for `NonZero*` const creation) - #146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #146293 - BenjaminBrienen:try_remove, r=joboet feat: non-panicking `Vec::try_remove` `if index < my_vector.len() { Some(my_vector.remove(index)) } else { None }` is annoying to write and non-panicking functions are broadly useful. APC: rust-lang/libs-team#649 Tracking issue: #146954
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
if index < my_vector.len() { Some(my_vector.remove(index)) } else { None }
is annoying to write and non-panicking functions are broadly useful.APC: rust-lang/libs-team#649
Tracking issue: #146954