feat: non-panicking Vec::try_remove#146293
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.
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 |
|
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
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
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang#142401 (Add proper name mangling for pattern types) - rust-lang#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang#146924 (Add doc for `NonZero*` const creation) - rust-lang#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
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
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