This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit e20cdb4
authored
Unrolled build for rust-lang#126118
Rollup merge of rust-lang#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. 😊1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1824 | 1824 | | |
1825 | 1825 | | |
1826 | 1826 | | |
1827 | | - | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
1828 | 1831 | | |
1829 | 1832 | | |
1830 | 1833 | | |
| |||
1884 | 1887 | | |
1885 | 1888 | | |
1886 | 1889 | | |
| 1890 | + | |
| 1891 | + | |
1887 | 1892 | | |
1888 | 1893 | | |
1889 | 1894 | | |
| |||
0 commit comments