From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-comp 14/15] tree wide: fix clippy lint "large_enum_variant"
Date: Fri, 6 Mar 2026 12:21:46 +0100 [thread overview]
Message-ID: <20260306112148.208189-15-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260306112148.208189-1-s.sterz@proxmox.com>
see:
https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
.../reassign_volume_dialog.rs | 10 +++++-----
src/configuration/pve/move_disk_dialog.rs | 10 +++++-----
.../reassign_disk_dialog.rs | 10 +++++-----
.../lxc_property/lxc_mount_point_property.rs | 10 +++++-----
.../pve/qemu_property/qemu_disk_property.rs | 20 +++++++++++++------
.../qemu_property/qemu_efidisk_property.rs | 17 ++++++++++------
.../qemu_property/qemu_tpmstate_property.rs | 17 ++++++++++------
7 files changed, 56 insertions(+), 38 deletions(-)
diff --git a/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs b/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
index d7c7389..87f63d7 100644
--- a/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
+++ b/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
@@ -36,12 +36,12 @@ struct LxcReassignVolumePanel {
}
enum Msg {
- Target(Option<ClusterResource>),
+ Target(Box<Option<ClusterResource>>),
LoadResult(Result<Value, Error>),
}
struct LxcReassignVolumeComp {
- target: Option<ClusterResource>,
+ target: Box<Option<ClusterResource>>,
load_guard: Option<AsyncAbortGuard>,
used_mount_points: HashSet<String>,
validate_id: Option<ValidateFn<u16>>,
@@ -53,7 +53,7 @@ impl Component for LxcReassignVolumeComp {
fn create(_ctx: &Context<Self>) -> Self {
Self {
- target: None,
+ target: Box::new(None),
load_guard: None,
used_mount_points: HashSet::new(),
validate_id: None,
@@ -69,7 +69,7 @@ impl Component for LxcReassignVolumeComp {
node: Some(node),
vmid: Some(vmid),
..
- }) = &self.target
+ }) = &*self.target
{
let url = guest_config_url(
*vmid,
@@ -141,7 +141,7 @@ impl Component for LxcReassignVolumeComp {
.required(true)
.guest_type(PveGuestType::Lxc)
.exclude_guest(props.vmid)
- .on_change(ctx.link().callback(Msg::Target))
+ .on_change(ctx.link().callback(|t| Msg::Target(Box::new(t))))
.mobile(props.mobile)
.submit(false);
diff --git a/src/configuration/pve/move_disk_dialog.rs b/src/configuration/pve/move_disk_dialog.rs
index 57d4549..6f19204 100644
--- a/src/configuration/pve/move_disk_dialog.rs
+++ b/src/configuration/pve/move_disk_dialog.rs
@@ -22,11 +22,11 @@ struct MoveDiskPanel {
enum Msg {
FormUpdate,
- StorageInfo(Option<StorageInfo>),
+ StorageInfo(Box<Option<StorageInfo>>),
}
struct MoveDiskPanelComp {
- storage_info: Option<StorageInfo>,
+ storage_info: Box<Option<StorageInfo>>,
_observer: FormContextObserver,
}
@@ -42,7 +42,7 @@ impl Component for MoveDiskPanelComp {
.add_listener(ctx.link().callback(|_| Msg::FormUpdate));
Self {
- storage_info: None,
+ storage_info: Box::new(None),
_observer,
}
}
@@ -58,7 +58,7 @@ impl Component for MoveDiskPanelComp {
let props = ctx.props();
// let state = &props.state;
- let (supported_formats, default_format) = match &self.storage_info {
+ let (supported_formats, default_format) = match &*self.storage_info {
Some(StorageInfo {
formats: Some(formats),
..
@@ -85,7 +85,7 @@ impl Component for MoveDiskPanelComp {
.include_select_existing(false)
.autoselect(true)
.content_types(Some(content_types))
- .on_change(ctx.link().callback(Msg::StorageInfo))
+ .on_change(ctx.link().callback(|t| Msg::StorageInfo(Box::new(t))))
.mobile(props.mobile);
let format_label = tr!("Format");
diff --git a/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs b/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
index 600b095..bc3e377 100644
--- a/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
+++ b/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
@@ -30,12 +30,12 @@ struct QemuReassignDiskPanel {
}
enum Msg {
- Target(Option<ClusterResource>),
+ Target(Box<Option<ClusterResource>>),
LoadResult(Result<Value, Error>),
}
struct QemuReassignDiskPanelComp {
- target: Option<ClusterResource>,
+ target: Box<Option<ClusterResource>>,
load_guard: Option<AsyncAbortGuard>,
used_devices: Option<HashSet<String>>,
}
@@ -46,7 +46,7 @@ impl Component for QemuReassignDiskPanelComp {
fn create(_ctx: &Context<Self>) -> Self {
Self {
- target: None,
+ target: Box::new(None),
load_guard: None,
used_devices: None,
}
@@ -61,7 +61,7 @@ impl Component for QemuReassignDiskPanelComp {
node: Some(node),
vmid: Some(vmid),
..
- }) = &self.target
+ }) = &*self.target
{
let url = guest_config_url(
*vmid,
@@ -100,7 +100,7 @@ impl Component for QemuReassignDiskPanelComp {
.required(true)
.guest_type(PveGuestType::Qemu)
.exclude_guest(props.vmid)
- .on_change(ctx.link().callback(Msg::Target))
+ .on_change(ctx.link().callback(|t| Msg::Target(Box::new(t))))
.mobile(props.mobile)
.submit(false);
diff --git a/src/form/pve/lxc_property/lxc_mount_point_property.rs b/src/form/pve/lxc_property/lxc_mount_point_property.rs
index 36f36a0..8f59725 100644
--- a/src/form/pve/lxc_property/lxc_mount_point_property.rs
+++ b/src/form/pve/lxc_property/lxc_mount_point_property.rs
@@ -52,7 +52,7 @@ struct MountPointPanel {
}
struct MountPointComp {
- storage_info: Option<StorageInfo>,
+ storage_info: Box<Option<StorageInfo>>,
_observer: FormContextObserver,
is_create: bool,
@@ -65,7 +65,7 @@ struct MountPointComp {
enum Msg {
FormUpdate,
- StorageInfo(Option<StorageInfo>),
+ StorageInfo(Box<Option<StorageInfo>>),
}
impl MountPointComp {
@@ -109,7 +109,7 @@ impl Component for MountPointComp {
Self {
_observer,
- storage_info: None,
+ storage_info: Box::new(None),
is_create: props.name.is_none(),
unused_volume: String::new(),
used_mount_points: HashSet::new(),
@@ -141,7 +141,7 @@ impl Component for MountPointComp {
let advanced = form_ctx.get_show_advanced();
- let storage_type = match &self.storage_info {
+ let storage_type = match &*self.storage_info {
Some(StorageInfo { ty, .. }) => ty.clone(),
_ => String::new(),
};
@@ -203,7 +203,7 @@ impl Component for MountPointComp {
.submit(false)
.required(true)
.content_types(Some(vec![StorageContent::Rootdir]))
- .on_change(ctx.link().callback(Msg::StorageInfo))
+ .on_change(ctx.link().callback(|i| Msg::StorageInfo(Box::new(i))))
.mobile(mobile);
let disk_size_label = tr!("Disk size") + " (GiB)";
diff --git a/src/form/pve/qemu_property/qemu_disk_property.rs b/src/form/pve/qemu_property/qemu_disk_property.rs
index 8e64b10..724d24e 100644
--- a/src/form/pve/qemu_property/qemu_disk_property.rs
+++ b/src/form/pve/qemu_property/qemu_disk_property.rs
@@ -52,7 +52,7 @@ struct DiskPanel {
}
struct DiskPanelComp {
- storage_info: Option<StorageInfo>,
+ storage_info: Box<Option<StorageInfo>>,
_observer: FormContextObserver,
is_create: bool,
@@ -65,7 +65,7 @@ struct DiskPanelComp {
enum DiskPanelMsg {
FormUpdate,
- StorageInfo(Option<StorageInfo>),
+ StorageInfo(Box<Option<StorageInfo>>),
}
impl DiskPanelComp {
@@ -135,7 +135,7 @@ impl Component for DiskPanelComp {
.add_listener(ctx.link().callback(|_| DiskPanelMsg::FormUpdate));
Self {
- storage_info: None,
+ storage_info: Box::new(None),
_observer,
is_create: props.name.is_none(),
is_scsi: false,
@@ -170,7 +170,7 @@ impl Component for DiskPanelComp {
let advanced = form_ctx.get_show_advanced();
- let (supported_formats, default_format, select_existing) = match &self.storage_info {
+ let (supported_formats, default_format, select_existing) = match &*self.storage_info {
Some(StorageInfo {
formats: Some(formats),
select_existing,
@@ -225,7 +225,10 @@ impl Component for DiskPanelComp {
.submit(false)
.required(true)
.content_types(Some(vec![StorageContent::Images]))
- .on_change(ctx.link().callback(DiskPanelMsg::StorageInfo))
+ .on_change(
+ ctx.link()
+ .callback(|i| DiskPanelMsg::StorageInfo(Box::new(i))),
+ )
.mobile(mobile);
let disk_image_label = tr!("Disk image");
@@ -234,7 +237,12 @@ impl Component for DiskPanelComp {
.name(FILE_PN)
.node(props.node.clone())
.required(true)
- .storage(self.storage_info.as_ref().map(|info| info.storage.clone()));
+ .storage(
+ self.storage_info
+ .as_ref()
+ .as_ref()
+ .map(|info| info.storage.clone()),
+ );
let disk_size_label = tr!("Disk size") + " (GiB)";
let disk_size_field = QemuDiskSizeFormatSelector::new()
diff --git a/src/form/pve/qemu_property/qemu_efidisk_property.rs b/src/form/pve/qemu_property/qemu_efidisk_property.rs
index 3497238..a692230 100644
--- a/src/form/pve/qemu_property/qemu_efidisk_property.rs
+++ b/src/form/pve/qemu_property/qemu_efidisk_property.rs
@@ -32,10 +32,10 @@ struct QemuEfidiskPanel {
enum Msg {
FormUpdate,
- StorageInfo(Option<StorageInfo>),
+ StorageInfo(Box<Option<StorageInfo>>),
}
struct QemuEfidiskPanelComp {
- storage_info: Option<StorageInfo>,
+ storage_info: Box<Option<StorageInfo>>,
_observer: FormContextObserver,
}
@@ -51,7 +51,7 @@ impl Component for QemuEfidiskPanelComp {
.add_listener(ctx.link().callback(|_| Msg::FormUpdate));
Self {
- storage_info: None,
+ storage_info: Box::new(None),
_observer,
}
}
@@ -69,7 +69,7 @@ impl Component for QemuEfidiskPanelComp {
let mobile = props.mobile;
let state = &props.state;
- let (supported_formats, default_format, select_existing) = match &self.storage_info {
+ let (supported_formats, default_format, select_existing) = match &*self.storage_info {
Some(StorageInfo {
formats: Some(formats),
select_existing,
@@ -103,7 +103,7 @@ impl Component for QemuEfidiskPanelComp {
.required(true)
.autoselect(true)
.content_types(Some(vec![StorageContent::Images]))
- .on_change(ctx.link().callback(Msg::StorageInfo))
+ .on_change(ctx.link().callback(|i| Msg::StorageInfo(Box::new(i))))
.mobile(true);
let format_label = tr!("Format");
@@ -119,7 +119,12 @@ impl Component for QemuEfidiskPanelComp {
.name(FILE_PN)
.node(props.node.clone())
.required(true)
- .storage(self.storage_info.as_ref().map(|info| info.storage.clone()));
+ .storage(
+ self.storage_info
+ .as_ref()
+ .as_ref()
+ .map(|info| info.storage.clone()),
+ );
let bios_hint = hint(tr!(
"Warning: The VM currently does not uses 'OVMF (UEFI)' as BIOS."
diff --git a/src/form/pve/qemu_property/qemu_tpmstate_property.rs b/src/form/pve/qemu_property/qemu_tpmstate_property.rs
index 42264f6..39234f0 100644
--- a/src/form/pve/qemu_property/qemu_tpmstate_property.rs
+++ b/src/form/pve/qemu_property/qemu_tpmstate_property.rs
@@ -24,10 +24,10 @@ struct QemuTpmStatePanel {
enum Msg {
FormUpdate,
- StorageInfo(Option<StorageInfo>),
+ StorageInfo(Box<Option<StorageInfo>>),
}
struct QemuTpmStatePanelComp {
- storage_info: Option<StorageInfo>,
+ storage_info: Box<Option<StorageInfo>>,
_observer: FormContextObserver,
}
@@ -43,7 +43,7 @@ impl Component for QemuTpmStatePanelComp {
.add_listener(ctx.link().callback(|_| Msg::FormUpdate));
Self {
- storage_info: None,
+ storage_info: Box::new(None),
_observer,
}
}
@@ -60,7 +60,7 @@ impl Component for QemuTpmStatePanelComp {
let props = ctx.props();
let mobile = props.mobile;
- let select_existing = match &self.storage_info {
+ let select_existing = match &*self.storage_info {
Some(StorageInfo {
select_existing, ..
}) => select_existing.unwrap_or(false),
@@ -74,7 +74,12 @@ impl Component for QemuTpmStatePanelComp {
.node(props.node.clone())
.required(true)
.disabled(!select_existing)
- .storage(self.storage_info.as_ref().map(|info| info.storage.clone()));
+ .storage(
+ self.storage_info
+ .as_ref()
+ .as_ref()
+ .map(|info| info.storage.clone()),
+ );
let mut panel = InputPanel::new()
.mobile(mobile)
@@ -89,7 +94,7 @@ impl Component for QemuTpmStatePanelComp {
.required(true)
.autoselect(true)
.content_types(Some(vec![StorageContent::Images]))
- .on_change(ctx.link().callback(Msg::StorageInfo))
+ .on_change(ctx.link().callback(|t| Msg::StorageInfo(Box::new(t))))
.mobile(true),
);
--
2.47.3
next prev parent reply other threads:[~2026-03-06 11:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 11:21 [PATCH yew-comp 00/15] clippy clean up proxmox-yew-comp Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 01/15] tree wide: fix clippy lint "useless_conversion" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 02/15] tree wide: fix clippy lint "new_without_default" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 03/15] tree wide: fix clippy lint "redundant_static_lifetimes" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 04/15] tree wide: fix clippy lint "unnecessary_lazy_evaluations" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 05/15] tree wide: fix clippy lint "unwrap_or_default" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 06/15] tree wide: fix clippy lint "clone_on_copy" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 07/15] tree wide: fix clippy lint "collapsible_else_if" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 08/15] tree wide: fix various minor clippy lints Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 09/15] tree wide: fix clippy lint "manual_strip" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 10/15] lxc_property/qemu_property: fix clippy lint "match_like_matches_macro" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 11/15] firewall_property: fix clippy lint "redundant_guards" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 12/15] qemu_property: fix clippy lint "redundant_pattern_matching" Shannon Sterz
2026-03-06 11:21 ` [PATCH yew-comp 13/15] qemu_hardware_pane/lxc_resources_panel: allow clippy::enum_variant_names Shannon Sterz
2026-03-06 11:21 ` Shannon Sterz [this message]
2026-03-06 11:21 ` [PATCH yew-comp 15/15] tree wide: allow clippy "too_many_arguments" warning selectively Shannon 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=20260306112148.208189-15-s.sterz@proxmox.com \
--to=s.sterz@proxmox.com \
--cc=yew-devel@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox