mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-20 11:37:32 +00:00
![]() 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. 😊 |
||
---|---|---|
.. | ||
benches | ||
src | ||
tests | ||
Cargo.toml |