[pve-devel] [PATCH installer] tui: persist disk selection for zfs and btrfs
Lukas Wagner
l.wagner at proxmox.com
Tue Jun 27 15:57:24 CEST 2023
On 6/27/23 15:34, Maximiliano Sandoval wrote:
>>
>> impl BtrfsBootdiskOptions {
>> - pub fn defaults_from(disk: &Disk) -> Self {
>> + pub fn defaults_from(disks: &[Disk]) -> Self {
>> + let disk = &disks[0];
>> Self {
>> disk_size: disk.size,
>> + selected_disks: (0..disks.len()).collect(),
>
> Any reason not to use Vec::with_capacity(disks.len()) here?
>
I haven't really examined the rest of the code, but wouldn't that change the behavior
completely? E.g., if `disk.len()` is 3, then
`(0..disks.len()).collect()` will give you a Vec [0, 1, 2], while
`Vec::with_capacity(disks.len())` would give you an empty Vec with an initial capacity
of at least 3.
--
- Lukas
More information about the pve-devel
mailing list