From: Lukas Wagner <l.wagner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Maximiliano Sandoval <m.sandoval@proxmox.com>,
Stefan Sterz <s.sterz@proxmox.com>
Subject: Re: [pve-devel] [PATCH installer] tui: persist disk selection for zfs and btrfs
Date: Tue, 27 Jun 2023 15:57:24 +0200 [thread overview]
Message-ID: <4e6e294b-4e9f-3ee1-413f-eb90e9357031@proxmox.com> (raw)
In-Reply-To: <948378528.2288.1687872849696@webmail.proxmox.com>
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
next prev parent reply other threads:[~2023-06-27 13:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 12:54 Stefan Sterz
2023-06-27 13:34 ` Maximiliano Sandoval
2023-06-27 13:57 ` Lukas Wagner [this message]
2023-06-27 13:59 ` Stefan Sterz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4e6e294b-4e9f-3ee1-413f-eb90e9357031@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=m.sandoval@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=s.sterz@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.