rust/library/alloc/src/vec
Jacob Pratt 3cdc3b7e0b
Rollup merge of #126118 - jan-ferdinand:docs_for_vec_set_len, r=the8472
docs: Mention `spare_capacity_mut()` in `Vec::set_len`

I recently went down a small rabbit hole when trying to identify safe use of `Vec::set_len`. The solution was `Vec::spare_capacity_mut`. I think the docs on `Vec::set_len` benefit from mentioning this method.

A possible counter-argument could be that the [clippy lint `uninit_vec`](https://rust-lang.github.io/rust-clippy/master/index.html#/uninit_vec) already nudges people in the right direction. However, I think a working example on `Vec::set_len` is still beneficial.

Happy to hear your thoughts on the matter. 😊
2024-12-20 01:36:45 -05:00
..
cow.rs Add #[track_caller] to allocating methods of Vec & VecDeque 2024-09-20 01:20:10 +03:00
drain.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
extract_if.rs remove obsolete comment and pub(super) visibility 2024-12-16 22:06:52 +01:00
in_place_collect.rs Auto merge of #126557 - GrigorenkoPV:vec_track_caller, r=joboet 2024-10-14 02:33:40 +00:00
in_place_drop.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
into_iter.rs Use &raw in the standard library 2024-09-25 17:03:20 -07:00
is_zero.rs library: consistently use American spelling for 'behavior' 2024-10-25 12:02:47 +02:00
mod.rs Rollup merge of #126118 - jan-ferdinand:docs_for_vec_set_len, r=the8472 2024-12-20 01:36:45 -05:00
partial_eq.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
set_len_on_drop.rs Tune RepeatWith::try_fold and Take::for_each and Vec::extend_trusted 2022-11-24 19:14:19 -08:00
spec_extend.rs Add #[track_caller] to allocating methods of Vec & VecDeque 2024-09-20 01:20:10 +03:00
spec_from_elem.rs Add #[track_caller] to allocating methods of Vec & VecDeque 2024-09-20 01:20:10 +03:00
spec_from_iter.rs Add #[track_caller] to allocating methods of Vec & VecDeque 2024-09-20 01:20:10 +03:00
spec_from_iter_nested.rs Add #[track_caller] to allocating methods of Vec & VecDeque 2024-09-20 01:20:10 +03:00
splice.rs Add #[track_caller] to allocating methods of Vec & VecDeque 2024-09-20 01:20:10 +03:00