* [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp
@ 2026-03-09 15:29 Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 01/13] tree wide: fix clippy lint "useless_conversion" Shannon Sterz
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
these patches clean up all clippy warning in proxmox-yew-comp. see each
patch for a description which lints are being cleaned up.
changelog
---------
changes since v1 (thanks @ Dominik Csapak):
* cleaned up list of addressed clippy lints in commit 8 (tree wide: fix
various minor clippy lints)
* instead of fixing or locally ignoring the lints "too_many_arguments",
"enum_variant_names", and "large_enum_variant", drop the respective
commits addressing them and add one that globally ignores them.
Shannon Sterz (13):
tree wide: fix clippy lint "useless_conversion"
tree wide: fix clippy lint "new_without_default"
tree wide: fix clippy lint "redundant_static_lifetimes"
tree wide: fix clippy lint "unnecessary_lazy_evaluations"
tree wide: fix clippy lint "unwrap_or_default"
tree wide: fix clippy lint "clone_on_copy"
tree wide: fix clippy lint "collapsible_else_if"
tree wide: fix various minor clippy lints
tree wide: fix clippy lint "manual_strip"
lxc_property/qemu_property: fix clippy lint "match_like_matches_macro"
firewall_property: fix clippy lint "redundant_guards"
qemu_property: fix clippy lint "redundant_pattern_matching"
cargo.toml: globally ignore certain clippy lints
Cargo.toml | 5 +
.../firewall_options_cluster_panel.rs | 6 ++
.../pve/firewall/firewall_rules_panel.rs | 4 +-
src/configuration/pve/lxc_network_panel.rs | 15 ++-
.../pve/lxc_resources_panel/desktop.rs | 4 +-
.../pve/lxc_resources_panel/mobile.rs | 2 +-
.../reassign_volume_dialog.rs | 6 +-
src/configuration/pve/move_disk_dialog.rs | 2 +-
.../pve/qemu_hardware_panel/desktop.rs | 6 +-
.../pve/qemu_hardware_panel/mobile.rs | 4 +-
.../reassign_disk_dialog.rs | 4 +-
src/editable_property.rs | 2 +-
src/form/pve/boot_device_list.rs | 6 +-
.../firewall_property/log_level_selector.rs | 6 ++
.../log_ratelimit_property.rs | 13 ++-
.../log_ratelimit_selector.rs | 12 ++-
src/form/pve/firewall_property/mod.rs | 6 +-
src/form/pve/hotplug_feature_selector.rs | 18 ++--
src/form/pve/lxc_mount_options_selector.rs | 10 +-
.../pve/lxc_property/lxc_cores_property.rs | 8 +-
.../pve/lxc_property/lxc_features_property.rs | 27 +++--
.../lxc_property/lxc_memory_swap_property.rs | 4 +-
.../lxc_property/lxc_mount_point_property.rs | 88 +++++++----------
.../lxc_property/lxc_nameserver_property.rs | 4 +-
.../pve/lxc_property/lxc_network_property.rs | 36 +++----
src/form/pve/mod.rs | 4 +-
src/form/pve/pve_guest_selector.rs | 14 ++-
src/form/pve/pve_network_selector.rs | 11 ++-
src/form/pve/pve_storage_content_selector.rs | 12 ++-
src/form/pve/pve_vlan_field.rs | 6 ++
src/form/pve/qemu_cache_type_selector.rs | 6 ++
src/form/pve/qemu_controller_selector.rs | 6 ++
src/form/pve/qemu_cpu_flags_list.rs | 22 +++--
src/form/pve/qemu_disk_format_selector.rs | 11 ++-
.../pve/qemu_disk_size_format_selector.rs | 12 ++-
src/form/pve/qemu_display_type_selector.rs | 6 ++
src/form/pve/qemu_machine_version_selector.rs | 18 ++--
src/form/pve/qemu_ostype_selector.rs | 6 ++
src/form/pve/qemu_property/mod.rs | 2 +-
.../qemu_property/qemu_amd_sev_property.rs | 18 ++--
.../pve/qemu_property/qemu_disk_property.rs | 99 +++++++++----------
.../qemu_property/qemu_display_property.rs | 4 +-
.../qemu_property/qemu_efidisk_property.rs | 11 +--
.../qemu_property/qemu_intel_tdx_property.rs | 12 +--
.../pve/qemu_property/qemu_memory_property.rs | 17 ++--
.../qemu_property/qemu_processor_property.rs | 4 +-
.../pve/qemu_property/qemu_scsihw_property.rs | 4 +-
.../qemu_property/qemu_smbios1_property.rs | 2 +-
.../qemu_spice_enhancement_property.rs | 4 +-
.../qemu_property/qemu_tpmstate_property.rs | 4 +-
src/layout/mobile_form.rs | 4 +-
src/loadable_component.rs | 6 ++
src/log_view.rs | 2 +-
src/pending_property_view/mod.rs | 6 ++
src/property_edit_dialog.rs | 4 +-
src/property_view/mod.rs | 6 +-
src/utils/task_descriptions.rs | 4 +-
57 files changed, 356 insertions(+), 289 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 01/13] tree wide: fix clippy lint "useless_conversion"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 02/13] tree wide: fix clippy lint "new_without_default" Shannon Sterz
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/configuration/pve/lxc_network_panel.rs | 2 +-
src/configuration/pve/lxc_resources_panel/desktop.rs | 2 +-
src/configuration/pve/qemu_hardware_panel/desktop.rs | 2 +-
src/editable_property.rs | 2 +-
src/form/pve/firewall_property/log_ratelimit_property.rs | 1 -
src/form/pve/qemu_disk_format_selector.rs | 3 +--
src/form/pve/qemu_property/qemu_memory_property.rs | 4 ++--
src/layout/mobile_form.rs | 2 --
src/property_view/mod.rs | 4 ++--
9 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/configuration/pve/lxc_network_panel.rs b/src/configuration/pve/lxc_network_panel.rs
index 34c8fa8..701eb4a 100644
--- a/src/configuration/pve/lxc_network_panel.rs
+++ b/src/configuration/pve/lxc_network_panel.rs
@@ -73,7 +73,7 @@ struct NetworkEntry {
impl ExtractPrimaryKey for NetworkEntry {
fn extract_key(&self) -> Key {
- Key::from(self.key.clone())
+ self.key.clone()
}
}
diff --git a/src/configuration/pve/lxc_resources_panel/desktop.rs b/src/configuration/pve/lxc_resources_panel/desktop.rs
index 72b77fd..2b16133 100644
--- a/src/configuration/pve/lxc_resources_panel/desktop.rs
+++ b/src/configuration/pve/lxc_resources_panel/desktop.rs
@@ -58,7 +58,7 @@ struct ResourceEntry {
impl ExtractPrimaryKey for ResourceEntry {
fn extract_key(&self) -> Key {
- Key::from(self.key.clone())
+ self.key.clone()
}
}
diff --git a/src/configuration/pve/qemu_hardware_panel/desktop.rs b/src/configuration/pve/qemu_hardware_panel/desktop.rs
index 5ad1114..9bc33fb 100644
--- a/src/configuration/pve/qemu_hardware_panel/desktop.rs
+++ b/src/configuration/pve/qemu_hardware_panel/desktop.rs
@@ -63,7 +63,7 @@ struct HardwareEntry {
impl ExtractPrimaryKey for HardwareEntry {
fn extract_key(&self) -> Key {
- Key::from(self.key.clone())
+ self.key.clone()
}
}
diff --git a/src/editable_property.rs b/src/editable_property.rs
index 4d9d459..b1e124c 100644
--- a/src/editable_property.rs
+++ b/src/editable_property.rs
@@ -135,7 +135,7 @@ impl EditableProperty {
pub fn new(name: impl IntoPropValue<Option<AttrValue>>, title: impl Into<AttrValue>) -> Self {
let name = name.into_prop_value();
Self {
- name: name.into(),
+ name: name,
revert_keys: None,
title: title.into(),
required: false,
diff --git a/src/form/pve/firewall_property/log_ratelimit_property.rs b/src/form/pve/firewall_property/log_ratelimit_property.rs
index e58078d..2dbbaad 100644
--- a/src/form/pve/firewall_property/log_ratelimit_property.rs
+++ b/src/form/pve/firewall_property/log_ratelimit_property.rs
@@ -89,5 +89,4 @@ pub fn log_ratelimit_property(mobile: bool) -> EditableProperty {
let form_data = delete_empty_values(&form_data, &[LOG_RATELIMIT_PN], false);
Ok(form_data)
})
- .into()
}
diff --git a/src/form/pve/qemu_disk_format_selector.rs b/src/form/pve/qemu_disk_format_selector.rs
index 8106bcb..3468dd8 100644
--- a/src/form/pve/qemu_disk_format_selector.rs
+++ b/src/form/pve/qemu_disk_format_selector.rs
@@ -114,8 +114,7 @@ impl Component for QemuDiskFormatComp {
.min_width(300)
.show_header(false)
.header_focusable(false)
- .class(pwt::css::FlexFit)
- .into(),
+ .class(pwt::css::FlexFit),
)
.selection(args.selection.clone())
.on_select(args.controller.on_select_callback())
diff --git a/src/form/pve/qemu_property/qemu_memory_property.rs b/src/form/pve/qemu_property/qemu_memory_property.rs
index e057fe5..9a8d50a 100644
--- a/src/form/pve/qemu_property/qemu_memory_property.rs
+++ b/src/form/pve/qemu_property/qemu_memory_property.rs
@@ -185,7 +185,7 @@ pub fn qemu_memory_property(mobile: bool) -> EditableProperty {
if balloon == old_memory && old_memory != current_memory {
form_ctx
.write()
- .set_field_value("balloon", current_memory.clone().into());
+ .set_field_value("balloon", current_memory.clone());
}
}
_ => {}
@@ -194,7 +194,7 @@ pub fn qemu_memory_property(mobile: bool) -> EditableProperty {
if let Some(current_memory) = current_memory {
form_ctx
.write()
- .set_field_value("_old_memory", current_memory.into());
+ .set_field_value("_old_memory", current_memory);
}
})
}
diff --git a/src/layout/mobile_form.rs b/src/layout/mobile_form.rs
index 04f4a62..1f78885 100644
--- a/src/layout/mobile_form.rs
+++ b/src/layout/mobile_form.rs
@@ -7,7 +7,6 @@ pub fn label_widget(label: impl Into<AttrValue>, field: impl Into<Html>) -> Colu
Column::new()
.with_child(FieldLabel::new(label.into()).padding_bottom(PwtSpace::Em(0.3)))
.with_child(field)
- .into()
}
/// Column with label and field
@@ -30,5 +29,4 @@ pub fn label_field(
.class((!enabled).then(|| "pwt-label-disabled")),
)
.with_child(field.label_id(label_id).disabled(!enabled))
- .into()
}
diff --git a/src/property_view/mod.rs b/src/property_view/mod.rs
index 39382f0..2d86415 100644
--- a/src/property_view/mod.rs
+++ b/src/property_view/mod.rs
@@ -31,7 +31,7 @@ pub struct PropertyGridRecord {
impl ExtractPrimaryKey for PropertyGridRecord {
fn extract_key(&self) -> Key {
- Key::from(self.key.clone())
+ self.key.clone()
}
}
@@ -276,7 +276,7 @@ pub fn render_property_value(record: &Value, property: &EditableProperty) -> Htm
match value {
None::<_> | Some(Value::Null) => {
let placeholder = if let Some(placeholder) = &property.placeholder {
- placeholder.to_string().into()
+ placeholder.to_string()
} else {
String::from("-")
};
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 02/13] tree wide: fix clippy lint "new_without_default"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 01/13] tree wide: fix clippy lint "useless_conversion" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 03/13] tree wide: fix clippy lint "redundant_static_lifetimes" Shannon Sterz
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
.../pve/firewall/firewall_options_cluster_panel.rs | 6 ++++++
src/form/pve/firewall_property/log_level_selector.rs | 6 ++++++
src/form/pve/firewall_property/log_ratelimit_selector.rs | 6 ++++++
src/form/pve/hotplug_feature_selector.rs | 6 ++++++
src/form/pve/lxc_mount_options_selector.rs | 6 ++++++
src/form/pve/pve_guest_selector.rs | 6 ++++++
src/form/pve/pve_network_selector.rs | 6 ++++++
src/form/pve/pve_storage_content_selector.rs | 6 ++++++
src/form/pve/pve_vlan_field.rs | 6 ++++++
src/form/pve/qemu_cache_type_selector.rs | 6 ++++++
src/form/pve/qemu_controller_selector.rs | 6 ++++++
src/form/pve/qemu_cpu_flags_list.rs | 6 ++++++
src/form/pve/qemu_disk_format_selector.rs | 6 ++++++
src/form/pve/qemu_disk_size_format_selector.rs | 6 ++++++
src/form/pve/qemu_display_type_selector.rs | 6 ++++++
src/form/pve/qemu_ostype_selector.rs | 6 ++++++
src/loadable_component.rs | 6 ++++++
src/pending_property_view/mod.rs | 6 ++++++
18 files changed, 108 insertions(+)
diff --git a/src/configuration/pve/firewall/firewall_options_cluster_panel.rs b/src/configuration/pve/firewall/firewall_options_cluster_panel.rs
index 112af05..d0156a2 100644
--- a/src/configuration/pve/firewall/firewall_options_cluster_panel.rs
+++ b/src/configuration/pve/firewall/firewall_options_cluster_panel.rs
@@ -38,6 +38,12 @@ pub struct FirewallOptionsClusterPanel {
pub readonly: bool,
}
+impl Default for FirewallOptionsClusterPanel {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl FirewallOptionsClusterPanel {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/firewall_property/log_level_selector.rs b/src/form/pve/firewall_property/log_level_selector.rs
index 0c224a3..3a5a0f2 100644
--- a/src/form/pve/firewall_property/log_level_selector.rs
+++ b/src/form/pve/firewall_property/log_level_selector.rs
@@ -11,6 +11,12 @@ use pwt_macros::{builder, widget};
#[builder]
pub struct LogLevelSelector {}
+impl Default for LogLevelSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl LogLevelSelector {
/// Create a new instance.
pub fn new() -> Self {
diff --git a/src/form/pve/firewall_property/log_ratelimit_selector.rs b/src/form/pve/firewall_property/log_ratelimit_selector.rs
index 9b496e7..36f92b3 100644
--- a/src/form/pve/firewall_property/log_ratelimit_selector.rs
+++ b/src/form/pve/firewall_property/log_ratelimit_selector.rs
@@ -32,6 +32,12 @@ pub struct LogRatelimitSelector {
label_id: Option<AttrValue>,
}
+impl Default for LogRatelimitSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl LogRatelimitSelector {
pub const RATE_NAME: AttrValue = AttrValue::Static("_lograte_");
pub const RATE_UNIT: AttrValue = AttrValue::Static("_lograte_unit_");
diff --git a/src/form/pve/hotplug_feature_selector.rs b/src/form/pve/hotplug_feature_selector.rs
index 537a03e..45e4166 100644
--- a/src/form/pve/hotplug_feature_selector.rs
+++ b/src/form/pve/hotplug_feature_selector.rs
@@ -26,6 +26,12 @@ pub struct HotplugFeatureSelector {
pub mobile: bool,
}
+impl Default for HotplugFeatureSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl HotplugFeatureSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/lxc_mount_options_selector.rs b/src/form/pve/lxc_mount_options_selector.rs
index 451ad39..7a8d0a5 100644
--- a/src/form/pve/lxc_mount_options_selector.rs
+++ b/src/form/pve/lxc_mount_options_selector.rs
@@ -18,6 +18,12 @@ use pwt_macros::{builder, widget};
#[builder]
pub struct LxcMountOptionsSelector {}
+impl Default for LxcMountOptionsSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl LxcMountOptionsSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/pve_guest_selector.rs b/src/form/pve/pve_guest_selector.rs
index 9db1336..f55a6a9 100644
--- a/src/form/pve/pve_guest_selector.rs
+++ b/src/form/pve/pve_guest_selector.rs
@@ -73,6 +73,12 @@ pub struct PveGuestSelector {
pub mobile: bool,
}
+impl Default for PveGuestSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PveGuestSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/pve_network_selector.rs b/src/form/pve/pve_network_selector.rs
index e8cb894..1c9d170 100644
--- a/src/form/pve/pve_network_selector.rs
+++ b/src/form/pve/pve_network_selector.rs
@@ -52,6 +52,12 @@ pub struct PveNetworkSelector {
pub interface_type: Option<ListNetworksType>,
}
+impl Default for PveNetworkSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PveNetworkSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/pve_storage_content_selector.rs b/src/form/pve/pve_storage_content_selector.rs
index 1607e66..fdb3d96 100644
--- a/src/form/pve/pve_storage_content_selector.rs
+++ b/src/form/pve/pve_storage_content_selector.rs
@@ -74,6 +74,12 @@ pub struct PveStorageContentSelector {
pub mobile: bool,
}
+impl Default for PveStorageContentSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PveStorageContentSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/pve_vlan_field.rs b/src/form/pve/pve_vlan_field.rs
index aec03f6..98de8ad 100644
--- a/src/form/pve/pve_vlan_field.rs
+++ b/src/form/pve/pve_vlan_field.rs
@@ -8,6 +8,12 @@ use pwt_macros::widget;
#[derive(Clone, Properties, PartialEq)]
pub struct PveVlanField {}
+impl Default for PveVlanField {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PveVlanField {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/qemu_cache_type_selector.rs b/src/form/pve/qemu_cache_type_selector.rs
index e30403d..ce50ed7 100644
--- a/src/form/pve/qemu_cache_type_selector.rs
+++ b/src/form/pve/qemu_cache_type_selector.rs
@@ -20,6 +20,12 @@ pub struct QemuCacheTypeSelector {
pub default: Option<AttrValue>,
}
+impl Default for QemuCacheTypeSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuCacheTypeSelector {
/// Create a new instance.
pub fn new() -> Self {
diff --git a/src/form/pve/qemu_controller_selector.rs b/src/form/pve/qemu_controller_selector.rs
index 215d794..0622e11 100644
--- a/src/form/pve/qemu_controller_selector.rs
+++ b/src/form/pve/qemu_controller_selector.rs
@@ -33,6 +33,12 @@ pub struct QemuControllerSelector {
pub exclude_devices: Option<HashSet<String>>,
}
+impl Default for QemuControllerSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuControllerSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/qemu_cpu_flags_list.rs b/src/form/pve/qemu_cpu_flags_list.rs
index 8aa10a5..becdaf3 100644
--- a/src/form/pve/qemu_cpu_flags_list.rs
+++ b/src/form/pve/qemu_cpu_flags_list.rs
@@ -20,6 +20,12 @@ pub type QemuCpuFlagsComp = ManagedFieldMaster<QemuCpuFlagsField>;
#[builder]
pub struct QemuCpuFlags {}
+impl Default for QemuCpuFlags {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuCpuFlags {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/qemu_disk_format_selector.rs b/src/form/pve/qemu_disk_format_selector.rs
index 3468dd8..5b26d2f 100644
--- a/src/form/pve/qemu_disk_format_selector.rs
+++ b/src/form/pve/qemu_disk_format_selector.rs
@@ -38,6 +38,12 @@ pub struct QemuDiskFormatSelector {
pub on_change: Option<Callback<Option<StorageInfoFormatsDefault>>>,
}
+impl Default for QemuDiskFormatSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuDiskFormatSelector {
pub fn new() -> Self {
yew::props!(Self {})
diff --git a/src/form/pve/qemu_disk_size_format_selector.rs b/src/form/pve/qemu_disk_size_format_selector.rs
index 603ee5a..d981f1c 100644
--- a/src/form/pve/qemu_disk_size_format_selector.rs
+++ b/src/form/pve/qemu_disk_size_format_selector.rs
@@ -49,6 +49,12 @@ pub struct QemuDiskSizeFormatSelector {
default_format: Option<StorageInfoFormatsDefault>,
}
+impl Default for QemuDiskSizeFormatSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuDiskSizeFormatSelector {
pub const DISK_SIZE: AttrValue = AttrValue::Static("_disk_size_");
pub const DISK_FORMAT: AttrValue = AttrValue::Static("_disk_format_");
diff --git a/src/form/pve/qemu_display_type_selector.rs b/src/form/pve/qemu_display_type_selector.rs
index d451691..4101545 100644
--- a/src/form/pve/qemu_display_type_selector.rs
+++ b/src/form/pve/qemu_display_type_selector.rs
@@ -20,6 +20,12 @@ pub struct QemuDisplayTypeSelector {
pub serial_device_list: Option<Rc<Vec<AttrValue>>>,
}
+impl Default for QemuDisplayTypeSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuDisplayTypeSelector {
/// Create a new instance.
pub fn new() -> Self {
diff --git a/src/form/pve/qemu_ostype_selector.rs b/src/form/pve/qemu_ostype_selector.rs
index d2180c4..ae04946 100644
--- a/src/form/pve/qemu_ostype_selector.rs
+++ b/src/form/pve/qemu_ostype_selector.rs
@@ -20,6 +20,12 @@ pub struct QemuOstypeSelector {
pub default: Option<AttrValue>,
}
+impl Default for QemuOstypeSelector {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl QemuOstypeSelector {
/// Create a new instance.
pub fn new() -> Self {
diff --git a/src/loadable_component.rs b/src/loadable_component.rs
index 0235f17..09f01db 100644
--- a/src/loadable_component.rs
+++ b/src/loadable_component.rs
@@ -386,6 +386,12 @@ pub struct LoadableComponentState<V: PartialEq> {
async_pool: AsyncPool,
}
+impl<V: PartialEq> Default for LoadableComponentState<V> {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl<V: PartialEq> LoadableComponentState<V> {
pub fn new() -> Self {
Self {
diff --git a/src/pending_property_view/mod.rs b/src/pending_property_view/mod.rs
index 6aa68dd..b084e6a 100644
--- a/src/pending_property_view/mod.rs
+++ b/src/pending_property_view/mod.rs
@@ -37,6 +37,12 @@ pub struct PvePendingConfiguration {
pub keys: HashSet<String>,
}
+impl Default for PvePendingConfiguration {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
impl PvePendingConfiguration {
pub fn new() -> Self {
Self {
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 03/13] tree wide: fix clippy lint "redundant_static_lifetimes"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 01/13] tree wide: fix clippy lint "useless_conversion" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 02/13] tree wide: fix clippy lint "new_without_default" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 04/13] tree wide: fix clippy lint "unnecessary_lazy_evaluations" Shannon Sterz
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
.../reassign_volume_dialog.rs | 4 +--
.../reassign_disk_dialog.rs | 2 +-
.../log_ratelimit_property.rs | 12 ++++----
src/form/pve/firewall_property/mod.rs | 4 +--
.../pve/lxc_property/lxc_cores_property.rs | 8 ++---
.../pve/lxc_property/lxc_features_property.rs | 20 ++++++-------
.../lxc_property/lxc_memory_swap_property.rs | 4 +--
.../lxc_property/lxc_mount_point_property.rs | 28 ++++++++---------
.../lxc_property/lxc_nameserver_property.rs | 4 +--
.../pve/lxc_property/lxc_network_property.rs | 30 +++++++++----------
.../qemu_property/qemu_amd_sev_property.rs | 16 +++++-----
.../pve/qemu_property/qemu_disk_property.rs | 24 +++++++--------
.../qemu_property/qemu_efidisk_property.rs | 6 ++--
.../qemu_property/qemu_intel_tdx_property.rs | 10 +++----
.../qemu_property/qemu_processor_property.rs | 2 +-
.../pve/qemu_property/qemu_scsihw_property.rs | 2 +-
.../qemu_property/qemu_tpmstate_property.rs | 4 +--
17 files changed, 90 insertions(+), 90 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 c6ebaa3..8345b72 100644
--- a/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
+++ b/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
@@ -13,8 +13,8 @@ use pwt::prelude::*;
use pwt::widget::InputPanel;
use pwt::AsyncAbortGuard;
-const TARGET_MOUNT_POINT_ID: &'static str = "_target_mount_point_id_";
-const TARGET_VMID_PN: &'static str = "target-vmid";
+const TARGET_MOUNT_POINT_ID: &str = "_target_mount_point_id_";
+const TARGET_VMID_PN: &str = "target-vmid";
use crate::configuration::guest_config_url;
use crate::form::pve::{
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 1e82f3d..c0122eb 100644
--- a/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
+++ b/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
@@ -18,7 +18,7 @@ use crate::form::pve::{
use crate::http_get;
use crate::{PropertyEditDialog, PropertyEditorState};
-const TARGET_VMID_PN: &'static str = "target-vmid";
+const TARGET_VMID_PN: &str = "target-vmid";
#[derive(PartialEq, Properties, Clone)]
struct QemuReassignDiskPanel {
diff --git a/src/form/pve/firewall_property/log_ratelimit_property.rs b/src/form/pve/firewall_property/log_ratelimit_property.rs
index 2dbbaad..4b2b8c5 100644
--- a/src/form/pve/firewall_property/log_ratelimit_property.rs
+++ b/src/form/pve/firewall_property/log_ratelimit_property.rs
@@ -14,13 +14,13 @@ use crate::{EditableProperty, PropertyEditorState, SchemaValidation};
use super::LogRatelimitSelector;
-const LOG_RATELIMIT_PN: &'static str = "log_ratelimit";
-const ENABLE_PN: &'static str = "_enable";
-const RATE_PN: &'static str = "_rate";
-const BURST_PN: &'static str = "_burst";
+const LOG_RATELIMIT_PN: &str = "log_ratelimit";
+const ENABLE_PN: &str = "_enable";
+const RATE_PN: &str = "_rate";
+const BURST_PN: &str = "_burst";
-const RATE_FIELD_NAME: &'static str = "_rate_";
-const UNIT_FIELD_NAME: &'static str = "_unit_";
+const RATE_FIELD_NAME: &str = "_rate_";
+const UNIT_FIELD_NAME: &str = "_unit_";
fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
RenderPropertyInputPanelFn::new(move |_state: PropertyEditorState| {
diff --git a/src/form/pve/firewall_property/mod.rs b/src/form/pve/firewall_property/mod.rs
index 39a87b1..5ab6de8 100644
--- a/src/form/pve/firewall_property/mod.rs
+++ b/src/form/pve/firewall_property/mod.rs
@@ -179,7 +179,7 @@ pub fn forward_policy_poperty(mobile: bool) -> EditableProperty {
pub fn nf_conntrack_max_poperty(mobile: bool) -> EditableProperty {
let title = tr!("Connection Tracking Max");
- const NAME: &'static str = "nf_conntrack_max";
+ const NAME: &str = "nf_conntrack_max";
EditableProperty::new(NAME, title.clone())
.required(true)
.placeholder(tr!("Default"))
@@ -204,7 +204,7 @@ pub fn nf_conntrack_max_poperty(mobile: bool) -> EditableProperty {
}
pub fn nf_timeout_established_poperty(mobile: bool) -> EditableProperty {
- const NAME: &'static str = "nf_conntrack_tcp_timeout_established";
+ const NAME: &str = "nf_conntrack_tcp_timeout_established";
let title = tr!("TCP Timeout Established");
EditableProperty::new(NAME, title.clone())
.required(true)
diff --git a/src/form/pve/lxc_property/lxc_cores_property.rs b/src/form/pve/lxc_property/lxc_cores_property.rs
index 04bb6c2..76f4664 100644
--- a/src/form/pve/lxc_property/lxc_cores_property.rs
+++ b/src/form/pve/lxc_property/lxc_cores_property.rs
@@ -9,9 +9,9 @@ use crate::{
form::delete_empty_values, EditableProperty, PropertyEditorState, RenderPropertyInputPanelFn,
};
-const CORES_PN: &'static str = "cores";
-const CPU_LIMIT_PN: &'static str = "cpulimit";
-const CPU_UNITS_PN: &'static str = "cpuunits";
+const CORES_PN: &str = "cores";
+const CPU_LIMIT_PN: &str = "cpulimit";
+const CPU_UNITS_PN: &str = "cpuunits";
const CPU_UNITS_DEFAULT: u64 = 100;
@@ -80,7 +80,7 @@ fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
}
pub fn lxc_cores_property(mobile: bool) -> EditableProperty {
- const KEYS: &[&'static str] = &[CORES_PN, CPU_UNITS_PN, CPU_LIMIT_PN];
+ const KEYS: &[&str] = &[CORES_PN, CPU_UNITS_PN, CPU_LIMIT_PN];
let title = tr!("Cores");
EditableProperty::new(CORES_PN, title)
.required(true)
diff --git a/src/form/pve/lxc_property/lxc_features_property.rs b/src/form/pve/lxc_property/lxc_features_property.rs
index dc23d0c..e969e26 100644
--- a/src/form/pve/lxc_property/lxc_features_property.rs
+++ b/src/form/pve/lxc_property/lxc_features_property.rs
@@ -16,18 +16,18 @@ use pwt::widget::InputPanel;
use crate::{EditableProperty, PropertyEditorState};
-const NFS_CHECKBOX_NAME: &'static str = "_nfs_";
-const CIFS_CHECKBOX_NAME: &'static str = "_cifs_";
+const NFS_CHECKBOX_NAME: &str = "_nfs_";
+const CIFS_CHECKBOX_NAME: &str = "_cifs_";
-const FEATURES_PN: &'static str = "features";
-const MOUNT_PN: &'static str = "_mount";
-const NESTING_PN: &'static str = "_nesting";
-const KEYCTL_PN: &'static str = "_keyctl";
-const FUSE_PN: &'static str = "_fuse";
-const MKNOD_PN: &'static str = "_mknod";
+const FEATURES_PN: &str = "features";
+const MOUNT_PN: &str = "_mount";
+const NESTING_PN: &str = "_nesting";
+const KEYCTL_PN: &str = "_keyctl";
+const FUSE_PN: &str = "_fuse";
+const MKNOD_PN: &str = "_mknod";
-const FSTYPE_NFS: &'static str = "nfs";
-const FSTYPE_CIFS: &'static str = "cifs";
+const FSTYPE_NFS: &str = "nfs";
+const FSTYPE_CIFS: &str = "cifs";
#[derive(PartialEq, Properties)]
struct LxcFeaturesPanel {
diff --git a/src/form/pve/lxc_property/lxc_memory_swap_property.rs b/src/form/pve/lxc_property/lxc_memory_swap_property.rs
index e6edcd6..d7368d2 100644
--- a/src/form/pve/lxc_property/lxc_memory_swap_property.rs
+++ b/src/form/pve/lxc_property/lxc_memory_swap_property.rs
@@ -7,8 +7,8 @@ use pwt::widget::{form::Number, InputPanel};
use crate::{EditableProperty, PropertyEditorState, RenderPropertyInputPanelFn};
-const MEMORY_PN: &'static str = "memory";
-const SWAP_PN: &'static str = "swap";
+const MEMORY_PN: &str = "memory";
+const SWAP_PN: &str = "swap";
const DEFAULT_MEMORY: u64 = 512;
fn renderer(_name: &str, value: &Value, _record: &Value) -> Html {
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 4c31bb1..b6ed449 100644
--- a/src/form/pve/lxc_property/lxc_mount_point_property.rs
+++ b/src/form/pve/lxc_property/lxc_mount_point_property.rs
@@ -19,22 +19,22 @@ use crate::form::{
};
use crate::{EditableProperty, PropertyEditorState};
-const MOUNT_POINT_ID: &'static str = "_mount_point_id_";
-const NOREPLICATE_FIELD_NAME: &'static str = "_noreplicate_";
-const DISK_SIZE_FIELD_NAME: &'static str = "_disk_size_";
-const IMAGE_STORAGE: &'static str = "_storage_";
+const MOUNT_POINT_ID: &str = "_mount_point_id_";
+const NOREPLICATE_FIELD_NAME: &str = "_noreplicate_";
+const DISK_SIZE_FIELD_NAME: &str = "_disk_size_";
+const IMAGE_STORAGE: &str = "_storage_";
-const VOLUME_PN: &'static str = "_volume";
-const MOUNT_PATH_PN: &'static str = "_mp";
-const MOUNT_OPTIONS_PN: &'static str = "_mountoptions";
+const VOLUME_PN: &str = "_volume";
+const MOUNT_PATH_PN: &str = "_mp";
+const MOUNT_OPTIONS_PN: &str = "_mountoptions";
-const SHARED_PN: &'static str = "_shared";
-const READONLY_PN: &'static str = "_ro";
-const SIZE_PN: &'static str = "_size";
-const REPLICATE_PN: &'static str = "_replicate";
-const BACKUP_PN: &'static str = "_backup";
-const ACL_PN: &'static str = "_acl";
-const QUOTA_PN: &'static str = "_quota";
+const SHARED_PN: &str = "_shared";
+const READONLY_PN: &str = "_ro";
+const SIZE_PN: &str = "_size";
+const REPLICATE_PN: &str = "_replicate";
+const BACKUP_PN: &str = "_backup";
+const ACL_PN: &str = "_acl";
+const QUOTA_PN: &str = "_quota";
#[derive(Properties, Clone, PartialEq)]
struct MountPointPanel {
diff --git a/src/form/pve/lxc_property/lxc_nameserver_property.rs b/src/form/pve/lxc_property/lxc_nameserver_property.rs
index e0cccf0..b41c246 100644
--- a/src/form/pve/lxc_property/lxc_nameserver_property.rs
+++ b/src/form/pve/lxc_property/lxc_nameserver_property.rs
@@ -8,8 +8,8 @@ use crate::{
form::delete_empty_values, EditableProperty, PropertyEditorState, RenderPropertyInputPanelFn,
};
-const SEARCDOMAIN_PN: &'static str = "searchdomain";
-const NAMESERVER_PN: &'static str = "nameserver";
+const SEARCDOMAIN_PN: &str = "searchdomain";
+const NAMESERVER_PN: &str = "nameserver";
fn renderer(_name: &str, value: &Value, _record: &Value) -> Html {
match value {
diff --git a/src/form/pve/lxc_property/lxc_network_property.rs b/src/form/pve/lxc_property/lxc_network_property.rs
index 7582435..79dd675 100644
--- a/src/form/pve/lxc_property/lxc_network_property.rs
+++ b/src/form/pve/lxc_property/lxc_network_property.rs
@@ -18,23 +18,23 @@ use crate::form::{
};
use crate::{EditableProperty, PropertyEditorState, RenderPropertyInputPanelFn, SchemaValidation};
-const NAME_PN: &'static str = "_name";
-const IP_PN: &'static str = "_ip";
-const IP6_PN: &'static str = "_ip6";
-const GW_PN: &'static str = "_gw";
-const GW6_PN: &'static str = "_gw6";
-const HWADDR_PN: &'static str = "_hwaddr";
-const BRIDGE_PN: &'static str = "_bridge";
-const TAG_PN: &'static str = "_tag";
-const RATE_PN: &'static str = "_rate";
-const MTU_PN: &'static str = "_mtu";
-const HOST_MANAGED_PN: &'static str = "_host-managed";
+const NAME_PN: &str = "_name";
+const IP_PN: &str = "_ip";
+const IP6_PN: &str = "_ip6";
+const GW_PN: &str = "_gw";
+const GW6_PN: &str = "_gw6";
+const HWADDR_PN: &str = "_hwaddr";
+const BRIDGE_PN: &str = "_bridge";
+const TAG_PN: &str = "_tag";
+const RATE_PN: &str = "_rate";
+const MTU_PN: &str = "_mtu";
+const HOST_MANAGED_PN: &str = "_host-managed";
-const FIREWALL_PN: &'static str = "_firewall";
-const DISCONNECT_PN: &'static str = "_link_down";
+const FIREWALL_PN: &str = "_firewall";
+const DISCONNECT_PN: &str = "_link_down";
-const IPV4_MODE_FIELD_NAME: &'static str = "_ipv4_mode_";
-const IPV6_MODE_FIELD_NAME: &'static str = "_ipv6_mode_";
+const IPV4_MODE_FIELD_NAME: &str = "_ipv4_mode_";
+const IPV6_MODE_FIELD_NAME: &str = "_ipv6_mode_";
fn get_schema(name: &str) -> &'static Schema {
let object_schema = LxcConfigNet::API_SCHEMA.unwrap_object_schema();
diff --git a/src/form/pve/qemu_property/qemu_amd_sev_property.rs b/src/form/pve/qemu_property/qemu_amd_sev_property.rs
index 9f1e467..9ec7683 100644
--- a/src/form/pve/qemu_property/qemu_amd_sev_property.rs
+++ b/src/form/pve/qemu_property/qemu_amd_sev_property.rs
@@ -11,15 +11,15 @@ use pwt::widget::{Container, FieldPosition, InputPanel};
use crate::form::{delete_empty_values, flatten_property_string, property_string_from_parts};
use crate::{EditableProperty, PropertyEditorState, RenderPropertyInputPanelFn};
-const AMD_SEV_PN: &'static str = "amd-sev";
-const TYPE_PN: &'static str = "_type";
-const NO_DEBUG_PN: &'static str = "_no-debug";
-const NO_KEY_SHARING_PN: &'static str = "_no-key-sharing";
+const AMD_SEV_PN: &str = "amd-sev";
+const TYPE_PN: &str = "_type";
+const NO_DEBUG_PN: &str = "_no-debug";
+const NO_KEY_SHARING_PN: &str = "_no-key-sharing";
-const DEBUG_FIELD_NAME: &'static str = "_debug";
-const KEY_SHARING_FIELD_NAME: &'static str = "_key-sharing";
-const ALLOW_SMT_FIELD_NAME: &'static str = "_allow-smt";
-const KERNEL_HASHES_FIELD_NAME: &'static str = "_kernel-hashes";
+const DEBUG_FIELD_NAME: &str = "_debug";
+const KEY_SHARING_FIELD_NAME: &str = "_key-sharing";
+const ALLOW_SMT_FIELD_NAME: &str = "_allow-smt";
+const KERNEL_HASHES_FIELD_NAME: &str = "_kernel-hashes";
fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
RenderPropertyInputPanelFn::new(move |state: PropertyEditorState| {
diff --git a/src/form/pve/qemu_property/qemu_disk_property.rs b/src/form/pve/qemu_property/qemu_disk_property.rs
index 4c8a046..dc9ec47 100644
--- a/src/form/pve/qemu_property/qemu_disk_property.rs
+++ b/src/form/pve/qemu_property/qemu_disk_property.rs
@@ -15,19 +15,19 @@ use pve_api_types::{
};
use yew::virtual_dom::VComp;
-const MEDIA_TYPE: &'static str = "_media_type_";
-const BUS_DEVICE: &'static str = "_device_";
-const IMAGE_STORAGE: &'static str = "_storage_";
-const NOREPLICATE_FIELD_NAME: &'static str = "_noreplicate_";
-const DISCARD_CHECKBOX_NAME: &'static str = "_discard_checkbox_";
+const MEDIA_TYPE: &str = "_media_type_";
+const BUS_DEVICE: &str = "_device_";
+const IMAGE_STORAGE: &str = "_storage_";
+const NOREPLICATE_FIELD_NAME: &str = "_noreplicate_";
+const DISCARD_CHECKBOX_NAME: &str = "_discard_checkbox_";
-const FILE_PN: &'static str = "_file";
-const DISCARD_PN: &'static str = "_discard";
-const READONLY_PN: &'static str = "_ro";
-const REPLICATE_PN: &'static str = "_replicate";
-const BACKUP_PN: &'static str = "_backup";
-const IOTHREAD_PN: &'static str = "_iothread";
-const SSD_PN: &'static str = "_ssd";
+const FILE_PN: &str = "_file";
+const DISCARD_PN: &str = "_discard";
+const READONLY_PN: &str = "_ro";
+const REPLICATE_PN: &str = "_replicate";
+const BACKUP_PN: &str = "_backup";
+const IOTHREAD_PN: &str = "_iothread";
+const SSD_PN: &str = "_ssd";
use crate::form::pve::pve_storage_content_selector::PveStorageContentSelector;
use crate::form::pve::{
diff --git a/src/form/pve/qemu_property/qemu_efidisk_property.rs b/src/form/pve/qemu_property/qemu_efidisk_property.rs
index 15b32e6..83e028e 100644
--- a/src/form/pve/qemu_property/qemu_efidisk_property.rs
+++ b/src/form/pve/qemu_property/qemu_efidisk_property.rs
@@ -12,10 +12,10 @@ use pve_api_types::{
};
use yew::virtual_dom::VComp;
-const IMAGE_STORAGE: &'static str = "_storage_";
+const IMAGE_STORAGE: &str = "_storage_";
-const FILE_PN: &'static str = "_file";
-const EFITYPE_PN: &'static str = "_efitype";
+const FILE_PN: &str = "_file";
+const EFITYPE_PN: &str = "_efitype";
use crate::form::property_string_from_parts;
use crate::form::pve::{PveStorageContentSelector, PveStorageSelector, QemuDiskFormatSelector};
diff --git a/src/form/pve/qemu_property/qemu_intel_tdx_property.rs b/src/form/pve/qemu_property/qemu_intel_tdx_property.rs
index 9be3541..d8ca8f0 100644
--- a/src/form/pve/qemu_property/qemu_intel_tdx_property.rs
+++ b/src/form/pve/qemu_property/qemu_intel_tdx_property.rs
@@ -11,11 +11,11 @@ use pwt::widget::{Container, FieldPosition, InputPanel};
use crate::form::{delete_empty_values, flatten_property_string, property_string_from_parts};
use crate::{EditableProperty, PropertyEditorState, RenderPropertyInputPanelFn};
-const INTEL_TDX_PN: &'static str = "intel-tdx";
-const TYPE_PN: &'static str = "_type";
-const ATTESTATION_PN: &'static str = "_attestation";
-const VSOCK_CID_PN: &'static str = "_vsock-cid";
-const VSOCK_PORT_PN: &'static str = "_vsock-port";
+const INTEL_TDX_PN: &str = "intel-tdx";
+const TYPE_PN: &str = "_type";
+const ATTESTATION_PN: &str = "_attestation";
+const VSOCK_CID_PN: &str = "_vsock-cid";
+const VSOCK_PORT_PN: &str = "_vsock-port";
fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
RenderPropertyInputPanelFn::new(move |state: PropertyEditorState| {
diff --git a/src/form/pve/qemu_property/qemu_processor_property.rs b/src/form/pve/qemu_property/qemu_processor_property.rs
index b663b01..280879e 100644
--- a/src/form/pve/qemu_property/qemu_processor_property.rs
+++ b/src/form/pve/qemu_property/qemu_processor_property.rs
@@ -167,7 +167,7 @@ pub fn qemu_sockets_cores_property(
user_is_root: bool,
mobile: bool,
) -> EditableProperty {
- const KEYS: &[&'static str] = &[
+ const KEYS: &[&str] = &[
"sockets", "cores", "cpu", "vcpus", "cpuunits", "cpulimit", "affinity", "numa",
];
diff --git a/src/form/pve/qemu_property/qemu_scsihw_property.rs b/src/form/pve/qemu_property/qemu_scsihw_property.rs
index 0414a4f..774db55 100644
--- a/src/form/pve/qemu_property/qemu_scsihw_property.rs
+++ b/src/form/pve/qemu_property/qemu_scsihw_property.rs
@@ -9,7 +9,7 @@ use crate::form::delete_empty_values;
use crate::{EditableProperty, PropertyEditorState};
pub fn qemu_scsihw_property(mobile: bool) -> EditableProperty {
- const NAME: &'static str = "scsihw";
+ const NAME: &str = "scsihw";
let mut items = IndexMap::new();
items.extend([
("lsi", "LSI 53C895A"),
diff --git a/src/form/pve/qemu_property/qemu_tpmstate_property.rs b/src/form/pve/qemu_property/qemu_tpmstate_property.rs
index b798a30..42264f6 100644
--- a/src/form/pve/qemu_property/qemu_tpmstate_property.rs
+++ b/src/form/pve/qemu_property/qemu_tpmstate_property.rs
@@ -7,8 +7,8 @@ use pwt::prelude::*;
use pwt::widget::form::{Combobox, FormContextObserver};
use pwt::widget::InputPanel;
-const IMAGE_STORAGE: &'static str = "_storage_";
-const FILE_PN: &'static str = "_file";
+const IMAGE_STORAGE: &str = "_storage_";
+const FILE_PN: &str = "_file";
use crate::form::property_string_from_parts;
use crate::form::pve::{PveStorageContentSelector, PveStorageSelector};
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 04/13] tree wide: fix clippy lint "unnecessary_lazy_evaluations"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (2 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 03/13] tree wide: fix clippy lint "redundant_static_lifetimes" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 05/13] tree wide: fix clippy lint "unwrap_or_default" Shannon Sterz
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/configuration/pve/firewall/firewall_rules_panel.rs | 2 +-
.../pve/lxc_resources_panel/reassign_volume_dialog.rs | 2 +-
.../pve/qemu_hardware_panel/reassign_disk_dialog.rs | 2 +-
src/form/pve/lxc_property/lxc_features_property.rs | 2 +-
src/form/pve/lxc_property/lxc_network_property.rs | 2 +-
src/form/pve/pve_guest_selector.rs | 2 +-
src/form/pve/qemu_property/mod.rs | 2 +-
src/form/pve/qemu_property/qemu_amd_sev_property.rs | 2 +-
src/form/pve/qemu_property/qemu_display_property.rs | 2 +-
src/form/pve/qemu_property/qemu_intel_tdx_property.rs | 2 +-
src/form/pve/qemu_property/qemu_processor_property.rs | 2 +-
src/form/pve/qemu_property/qemu_scsihw_property.rs | 2 +-
src/form/pve/qemu_property/qemu_smbios1_property.rs | 2 +-
src/layout/mobile_form.rs | 2 +-
src/property_edit_dialog.rs | 4 ++--
src/property_view/mod.rs | 2 +-
16 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/configuration/pve/firewall/firewall_rules_panel.rs b/src/configuration/pve/firewall/firewall_rules_panel.rs
index 948866d..56d687e 100644
--- a/src/configuration/pve/firewall/firewall_rules_panel.rs
+++ b/src/configuration/pve/firewall/firewall_rules_panel.rs
@@ -279,7 +279,7 @@ fn render_firewall_rule_mobile(rule: &ListFirewallRules) -> Html {
.with_child(
Container::new().with_child(
Container::new()
- .style("opacity", (rule.enable != Some(1)).then(|| "0.5"))
+ .style("opacity", (rule.enable != Some(1)).then_some("0.5"))
.with_child(&rule.action),
),
)
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 8345b72..d7c7389 100644
--- a/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
+++ b/src/configuration/pve/lxc_resources_panel/reassign_volume_dialog.rs
@@ -162,7 +162,7 @@ impl Component for LxcReassignVolumeComp {
InputPanel::new()
.mobile(props.mobile)
- .field_width((!props.mobile).then(|| "300px"))
+ .field_width((!props.mobile).then_some("300px"))
.class(pwt::css::FlexFit)
.padding_x(2)
.padding_bottom(1) // avoid scrollbar
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 c0122eb..600b095 100644
--- a/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
+++ b/src/configuration/pve/qemu_hardware_panel/reassign_disk_dialog.rs
@@ -112,7 +112,7 @@ impl Component for QemuReassignDiskPanelComp {
InputPanel::new()
.mobile(props.mobile)
- .field_width((!props.mobile).then(|| "300px"))
+ .field_width((!props.mobile).then_some("300px"))
.class(pwt::css::FlexFit)
.padding_x(2)
.padding_bottom(1) // avoid scrollbar
diff --git a/src/form/pve/lxc_property/lxc_features_property.rs b/src/form/pve/lxc_property/lxc_features_property.rs
index e969e26..3c712d1 100644
--- a/src/form/pve/lxc_property/lxc_features_property.rs
+++ b/src/form/pve/lxc_property/lxc_features_property.rs
@@ -85,7 +85,7 @@ impl Component for LxcFeaturesComp {
.class(pwt::css::FlexFit)
.padding_x(2)
.padding_bottom(1) // avoid scrollbar
- .label_width((!props.mobile).then(|| "max-content"))
+ .label_width((!props.mobile).then_some("max-content"))
.with_single_line_field(
false,
false,
diff --git a/src/form/pve/lxc_property/lxc_network_property.rs b/src/form/pve/lxc_property/lxc_network_property.rs
index 79dd675..d33267b 100644
--- a/src/form/pve/lxc_property/lxc_network_property.rs
+++ b/src/form/pve/lxc_property/lxc_network_property.rs
@@ -218,7 +218,7 @@ fn input_panel(
.mobile(mobile)
.show_advanced(advanced)
.padding_x(2)
- .field_width((!mobile).then(|| "300px"))
+ .field_width((!mobile).then_some("300px"))
.with_field(name_label, name_field)
.with_field(hwaddr_label, hwaddr_field)
.with_field(bridge_label, bridge_field)
diff --git a/src/form/pve/pve_guest_selector.rs b/src/form/pve/pve_guest_selector.rs
index f55a6a9..f4ff7ab 100644
--- a/src/form/pve/pve_guest_selector.rs
+++ b/src/form/pve/pve_guest_selector.rs
@@ -235,7 +235,7 @@ fn columns_mobile() -> Rc<Vec<DataTableHeader<ClusterResource>>> {
.class(pwt::css::AlignItems::Center)
.gap(2)
.with_child(Fa::new(icon).large_2x().class(
- (item.status.as_deref() == Some("running")).then(|| "pwt-color-primary"),
+ (item.status.as_deref() == Some("running")).then_some("pwt-color-primary"),
))
.with_child(title_subtitle_column(title, item.node.clone()))
.with_flex_spacer()
diff --git a/src/form/pve/qemu_property/mod.rs b/src/form/pve/qemu_property/mod.rs
index a1bb48c..523b845 100644
--- a/src/form/pve/qemu_property/mod.rs
+++ b/src/form/pve/qemu_property/mod.rs
@@ -219,7 +219,7 @@ pub fn qemu_startup_property(mobile: bool) -> EditableProperty {
.mobile(mobile)
.class(pwt::css::FlexFit)
.padding_x(2)
- .style("min-width", (!mobile).then(|| "500px"))
+ .style("min-width", (!mobile).then_some("500px"))
.with_field(order_label, order_field)
.with_field(up_label, up_field)
.with_field(down_label, down_field)
diff --git a/src/form/pve/qemu_property/qemu_amd_sev_property.rs b/src/form/pve/qemu_property/qemu_amd_sev_property.rs
index 9ec7683..267b708 100644
--- a/src/form/pve/qemu_property/qemu_amd_sev_property.rs
+++ b/src/form/pve/qemu_property/qemu_amd_sev_property.rs
@@ -89,7 +89,7 @@ fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
.mobile(mobile)
.show_advanced(advanced)
.label_width("max-content")
- .field_width((!mobile).then(|| "350px"))
+ .field_width((!mobile).then_some("350px"))
.class(pwt::css::FlexFit)
.padding_x(2)
.padding_bottom(1) // avoid scrollbar
diff --git a/src/form/pve/qemu_property/qemu_display_property.rs b/src/form/pve/qemu_property/qemu_display_property.rs
index 3afb1e6..0ba9b4b 100644
--- a/src/form/pve/qemu_property/qemu_display_property.rs
+++ b/src/form/pve/qemu_property/qemu_display_property.rs
@@ -135,7 +135,7 @@ impl Component for StatefulPanelComp {
InputPanel::new()
.mobile(props.mobile)
- .style("min-width", (!props.mobile).then(|| "400px"))
+ .style("min-width", (!props.mobile).then_some("400px"))
.show_advanced(advanced)
.class(pwt::css::FlexFit)
.padding_x(2)
diff --git a/src/form/pve/qemu_property/qemu_intel_tdx_property.rs b/src/form/pve/qemu_property/qemu_intel_tdx_property.rs
index d8ca8f0..f99af5d 100644
--- a/src/form/pve/qemu_property/qemu_intel_tdx_property.rs
+++ b/src/form/pve/qemu_property/qemu_intel_tdx_property.rs
@@ -70,7 +70,7 @@ fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
.mobile(mobile)
.show_advanced(advanced)
.label_width("max-content")
- .field_width((!mobile).then(|| "350px"))
+ .field_width((!mobile).then_some("350px"))
.class(pwt::css::FlexFit)
.padding_x(2)
.padding_bottom(1) // avoid scrollbar
diff --git a/src/form/pve/qemu_property/qemu_processor_property.rs b/src/form/pve/qemu_property/qemu_processor_property.rs
index 280879e..25ca465 100644
--- a/src/form/pve/qemu_property/qemu_processor_property.rs
+++ b/src/form/pve/qemu_property/qemu_processor_property.rs
@@ -144,7 +144,7 @@ fn processor_input_panel(
.with_child(
Column::new()
.class(pwt::css::FlexFit)
- .class((!advanced).then(|| pwt::css::Display::None))
+ .class((!advanced).then_some(pwt::css::Display::None))
.with_child(Row::new().padding_y(2).with_child(scheduler_view))
.with_child(
Container::new()
diff --git a/src/form/pve/qemu_property/qemu_scsihw_property.rs b/src/form/pve/qemu_property/qemu_scsihw_property.rs
index 774db55..a81f5aa 100644
--- a/src/form/pve/qemu_property/qemu_scsihw_property.rs
+++ b/src/form/pve/qemu_property/qemu_scsihw_property.rs
@@ -46,7 +46,7 @@ pub fn qemu_scsihw_property(mobile: bool) -> EditableProperty {
let mut panel = InputPanel::new()
.mobile(mobile)
.class(pwt::css::FlexFit)
- .field_width((!mobile).then(|| "250px"))
+ .field_width((!mobile).then_some("250px"))
.padding_x(2)
.padding_bottom(1); // avoid scrollbar ?!
diff --git a/src/form/pve/qemu_property/qemu_smbios1_property.rs b/src/form/pve/qemu_property/qemu_smbios1_property.rs
index 421b0ce..2ec4df6 100644
--- a/src/form/pve/qemu_property/qemu_smbios1_property.rs
+++ b/src/form/pve/qemu_property/qemu_smbios1_property.rs
@@ -78,7 +78,7 @@ fn input_panel(mobile: bool) -> RenderPropertyInputPanelFn {
InputPanel::new()
.mobile(mobile)
- .field_width((!mobile).then(|| "300px"))
+ .field_width((!mobile).then_some("300px"))
.class(pwt::css::FlexFit)
.padding_x(2)
.with_field(uuid_label, uuid_field)
diff --git a/src/layout/mobile_form.rs b/src/layout/mobile_form.rs
index 1f78885..08e56aa 100644
--- a/src/layout/mobile_form.rs
+++ b/src/layout/mobile_form.rs
@@ -26,7 +26,7 @@ pub fn label_field(
.into()
.id(label_id.clone())
.padding_bottom(PwtSpace::Em(0.3))
- .class((!enabled).then(|| "pwt-label-disabled")),
+ .class((!enabled).then_some("pwt-label-disabled")),
)
.with_child(field.label_id(label_id).disabled(!enabled))
}
diff --git a/src/property_edit_dialog.rs b/src/property_edit_dialog.rs
index 738f905..947c967 100644
--- a/src/property_edit_dialog.rs
+++ b/src/property_edit_dialog.rs
@@ -426,9 +426,9 @@ impl Component for PwtPropertyEditDialog {
.style("position", "absolute")
.style("left", "0")
.style("right", "0")
- .style("visibility", (!loading).then(|| "hidden")),
+ .style("visibility", (!loading).then_some("hidden")),
)
- .with_child(form.style("visibility", loading.then(|| "hidden")));
+ .with_child(form.style("visibility", loading.then_some("hidden")));
let on_close = {
let on_close = props.on_close.clone();
diff --git a/src/property_view/mod.rs b/src/property_view/mod.rs
index 2d86415..1bb08ab 100644
--- a/src/property_view/mod.rs
+++ b/src/property_view/mod.rs
@@ -248,7 +248,7 @@ pub fn render_loadable_panel(
.style("position", "absolute")
.style("left", "0")
.style("right", "0")
- .style("visibility", (!loading).then(|| "hidden")),
+ .style("visibility", (!loading).then_some("hidden")),
)
.with_child(panel)
.with_optional_child(
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 05/13] tree wide: fix clippy lint "unwrap_or_default"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (3 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 04/13] tree wide: fix clippy lint "unnecessary_lazy_evaluations" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 06/13] tree wide: fix clippy lint "clone_on_copy" Shannon Sterz
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/configuration/pve/lxc_network_panel.rs | 6 +++---
src/configuration/pve/qemu_hardware_panel/desktop.rs | 2 +-
src/configuration/pve/qemu_hardware_panel/mobile.rs | 2 +-
src/form/pve/lxc_property/lxc_mount_point_property.rs | 2 +-
src/form/pve/qemu_property/qemu_disk_property.rs | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/configuration/pve/lxc_network_panel.rs b/src/configuration/pve/lxc_network_panel.rs
index 701eb4a..ae42ab1 100644
--- a/src/configuration/pve/lxc_network_panel.rs
+++ b/src/configuration/pve/lxc_network_panel.rs
@@ -426,7 +426,7 @@ fn columns() -> Rc<Vec<DataTableHeader<NetworkEntry>>> {
DataTableColumn::new(tr!("Bridge"))
.width("minmax(80px, auto)")
.get_property_owned(|item: &NetworkEntry| {
- item.config.bridge.clone().unwrap_or(String::new())
+ item.config.bridge.clone().unwrap_or_default()
})
.into(),
DataTableColumn::new(tr!("Firewall"))
@@ -448,7 +448,7 @@ fn columns() -> Rc<Vec<DataTableHeader<NetworkEntry>>> {
DataTableColumn::new(tr!("VLAN Tag"))
.width("minmax(80px, auto)")
.render(|item: &NetworkEntry| {
- html! { item.config.tag.map(|tag| tag.to_string()).unwrap_or(String::new())}
+ html! { item.config.tag.map(|tag| tag.to_string()).unwrap_or_default()}
})
.into(),
DataTableColumn::new(tr!("MAC address"))
@@ -472,7 +472,7 @@ fn columns() -> Rc<Vec<DataTableHeader<NetworkEntry>>> {
DataTableColumn::new(tr!("MTU"))
.width("minmax(80px, auto)")
.render(|item: &NetworkEntry| {
- html! { item.config.mtu.map(|mtu| mtu.to_string()).unwrap_or(String::new())}
+ html! { item.config.mtu.map(|mtu| mtu.to_string()).unwrap_or_default()}
})
.into(),
DataTableColumn::new(tr!("Disconnected"))
diff --git a/src/configuration/pve/qemu_hardware_panel/desktop.rs b/src/configuration/pve/qemu_hardware_panel/desktop.rs
index 9bc33fb..4f9b747 100644
--- a/src/configuration/pve/qemu_hardware_panel/desktop.rs
+++ b/src/configuration/pve/qemu_hardware_panel/desktop.rs
@@ -425,7 +425,7 @@ impl PendingPropertyView for PveQemuHardwarePanel {
let username = crate::http_get_auth()
.map(|info| info.userid.clone())
- .unwrap_or(String::new());
+ .unwrap_or_default();
let user_is_root = props.remote.is_none() && username == "root@pam";
let PvePendingConfiguration {
diff --git a/src/configuration/pve/qemu_hardware_panel/mobile.rs b/src/configuration/pve/qemu_hardware_panel/mobile.rs
index 9946ce1..46b33e4 100644
--- a/src/configuration/pve/qemu_hardware_panel/mobile.rs
+++ b/src/configuration/pve/qemu_hardware_panel/mobile.rs
@@ -742,7 +742,7 @@ impl PendingPropertyView for PveQemuHardwarePanel {
let username = crate::http_get_auth()
.map(|info| info.userid.clone())
- .unwrap_or(String::new());
+ .unwrap_or_default();
let user_is_root = props.remote.is_none() && username == "root@pam";
let editor_url =
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 b6ed449..c0dd36f 100644
--- a/src/form/pve/lxc_property/lxc_mount_point_property.rs
+++ b/src/form/pve/lxc_property/lxc_mount_point_property.rs
@@ -81,7 +81,7 @@ impl MountPointComp {
.map(|s| s.to_string())
})
.flatten()
- .unwrap_or(String::new());
+ .unwrap_or_default();
self.used_mount_points = extract_used_mount_points(&props.state.record);
diff --git a/src/form/pve/qemu_property/qemu_disk_property.rs b/src/form/pve/qemu_property/qemu_disk_property.rs
index dc9ec47..9c8f7e0 100644
--- a/src/form/pve/qemu_property/qemu_disk_property.rs
+++ b/src/form/pve/qemu_property/qemu_disk_property.rs
@@ -118,7 +118,7 @@ impl DiskPanelComp {
.map(|s| s.to_string())
})
.flatten()
- .unwrap_or(String::new());
+ .unwrap_or_default();
self.used_devices = extract_used_devices(&props.state.record);
}
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 06/13] tree wide: fix clippy lint "clone_on_copy"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (4 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 05/13] tree wide: fix clippy lint "unwrap_or_default" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 07/13] tree wide: fix clippy lint "collapsible_else_if" Shannon Sterz
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/form/pve/lxc_property/lxc_mount_point_property.rs | 2 +-
src/form/pve/pve_guest_selector.rs | 4 ++--
src/form/pve/pve_storage_content_selector.rs | 6 +++---
src/form/pve/qemu_disk_format_selector.rs | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
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 c0dd36f..379577d 100644
--- a/src/form/pve/lxc_property/lxc_mount_point_property.rs
+++ b/src/form/pve/lxc_property/lxc_mount_point_property.rs
@@ -416,7 +416,7 @@ fn mount_point_property(
move |mut record: Value| {
let used_mount_points = extract_used_mount_points(&record);
let default_mount_point = first_unused_mount_point(&used_mount_points);
- record[MOUNT_POINT_ID] = default_mount_point.clone().into();
+ record[MOUNT_POINT_ID] = default_mount_point.into();
if unused_disk.is_none() {
if let Some(name) = &name {
diff --git a/src/form/pve/pve_guest_selector.rs b/src/form/pve/pve_guest_selector.rs
index f4ff7ab..e1fcf2d 100644
--- a/src/form/pve/pve_guest_selector.rs
+++ b/src/form/pve/pve_guest_selector.rs
@@ -141,8 +141,8 @@ impl PveGuestSelectorComp {
let props = ctx.props();
let remote = props.remote.clone();
let guest_type = props.guest_type;
- let templates = props.templates.clone();
- let exclude_guest = props.exclude_guest.clone();
+ let templates = props.templates;
+ let exclude_guest = props.exclude_guest;
(move || Self::get_guest_list(remote.clone(), guest_type, exclude_guest, templates)).into()
}
}
diff --git a/src/form/pve/pve_storage_content_selector.rs b/src/form/pve/pve_storage_content_selector.rs
index fdb3d96..9151851 100644
--- a/src/form/pve/pve_storage_content_selector.rs
+++ b/src/form/pve/pve_storage_content_selector.rs
@@ -126,15 +126,15 @@ impl PveStorageContentSelectorComp {
let props = ctx.props();
let node = props.node.clone();
let storage = props.storage.clone();
- let content_filter = props.content_filter.clone();
+ let content_filter = props.content_filter;
let vmid_filter = props.vmid_filter;
(move || {
Self::get_storage_content(
node.clone().unwrap_or("localhost".into()),
storage.clone(),
- content_filter.clone(),
- vmid_filter.clone(),
+ content_filter,
+ vmid_filter,
)
})
.into()
diff --git a/src/form/pve/qemu_disk_format_selector.rs b/src/form/pve/qemu_disk_format_selector.rs
index 5b26d2f..99d3642 100644
--- a/src/form/pve/qemu_disk_format_selector.rs
+++ b/src/form/pve/qemu_disk_format_selector.rs
@@ -147,7 +147,7 @@ impl Component for QemuDiskFormatComp {
.read()
.iter()
.find(|item| *item.format_text == *key)
- .map(|entry| entry.format.clone());
+ .map(|entry| entry.format);
if let Some(on_change) = &on_change {
on_change.emit(format);
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 07/13] tree wide: fix clippy lint "collapsible_else_if"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (5 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 06/13] tree wide: fix clippy lint "clone_on_copy" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 08/13] tree wide: fix various minor clippy lints Shannon Sterz
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/form/pve/hotplug_feature_selector.rs | 8 +++----
.../lxc_property/lxc_mount_point_property.rs | 24 ++++++++-----------
.../pve/qemu_property/qemu_disk_property.rs | 16 +++++--------
3 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/src/form/pve/hotplug_feature_selector.rs b/src/form/pve/hotplug_feature_selector.rs
index 45e4166..c0322d0 100644
--- a/src/form/pve/hotplug_feature_selector.rs
+++ b/src/form/pve/hotplug_feature_selector.rs
@@ -85,12 +85,10 @@ pub fn normalize_hotplug_value(value: &Value) -> Value {
Value::String(s) => {
if s == "0" {
"".into()
+ } else if s == "1" {
+ "disk,network,usb".into()
} else {
- if s == "1" {
- "disk,network,usb".into()
- } else {
- s.clone().into()
- }
+ s.clone().into()
}
}
_ => value.clone(),
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 379577d..f02d84f 100644
--- a/src/form/pve/lxc_property/lxc_mount_point_property.rs
+++ b/src/form/pve/lxc_property/lxc_mount_point_property.rs
@@ -267,14 +267,12 @@ impl Component for MountPointComp {
if props.unused_disk.is_some() {
panel.add_custom_child(file_info_child);
panel.add_field(mount_point_id_label, mount_point_id_field);
+ } else if self.is_create {
+ panel.add_field(mount_point_id_label, mount_point_id_field);
+ panel.add_field(storage_label, storage_field);
+ panel.add_field(disk_size_label, disk_size_field);
} else {
- if self.is_create {
- panel.add_field(mount_point_id_label, mount_point_id_field);
- panel.add_field(storage_label, storage_field);
- panel.add_field(disk_size_label, disk_size_field);
- } else {
- panel.add_custom_child(file_info_child);
- }
+ panel.add_custom_child(file_info_child);
}
if !props.rootfs {
@@ -309,14 +307,12 @@ impl Component for MountPointComp {
if props.unused_disk.is_some() {
panel.add_field(mount_point_id_label, mount_point_id_field);
panel.add_custom_child(file_info_child);
+ } else if self.is_create {
+ panel.add_field(mount_point_id_label, mount_point_id_field);
+ panel.add_field(storage_label, storage_field);
+ panel.add_field(disk_size_label, disk_size_field);
} else {
- if self.is_create {
- panel.add_field(mount_point_id_label, mount_point_id_field);
- panel.add_field(storage_label, storage_field);
- panel.add_field(disk_size_label, disk_size_field);
- } else {
- panel.add_custom_child(file_info_child);
- }
+ panel.add_custom_child(file_info_child);
}
if !props.rootfs {
diff --git a/src/form/pve/qemu_property/qemu_disk_property.rs b/src/form/pve/qemu_property/qemu_disk_property.rs
index 9c8f7e0..dfdf9ea 100644
--- a/src/form/pve/qemu_property/qemu_disk_property.rs
+++ b/src/form/pve/qemu_property/qemu_disk_property.rs
@@ -297,12 +297,10 @@ impl Component for DiskPanelComp {
if props.unused_disk.is_some() {
panel.add_custom_child(file_info_child);
add_bus_device_selector(&mut panel);
+ } else if self.is_create {
+ add_bus_device_selector(&mut panel);
} else {
- if self.is_create {
- add_bus_device_selector(&mut panel);
- } else {
- panel.add_custom_child(file_info_child);
- }
+ panel.add_custom_child(file_info_child);
}
panel.add_field(cache_label, cache_field);
@@ -340,12 +338,10 @@ impl Component for DiskPanelComp {
.read_only(true)
.value(self.unused_volume.clone()),
);
+ } else if self.is_create {
+ add_bus_device_selector(&mut panel);
} else {
- if self.is_create {
- add_bus_device_selector(&mut panel);
- } else {
- panel.add_custom_child(file_info_child);
- }
+ panel.add_custom_child(file_info_child);
}
panel.add_right_field(cache_label, cache_field);
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 08/13] tree wide: fix various minor clippy lints
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (6 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 07/13] tree wide: fix clippy lint "collapsible_else_if" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 09/13] tree wide: fix clippy lint "manual_strip" Shannon Sterz
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
such as:
* useless_format
* unused_unit
* single_match
* search_is_some
* redundant_field_names
* redundant_closure
* partialeq_to_none
* needless_return
* needless_borrows_for_generic_args
* needless_borrow
* needless_bool
* map_flatten
* manual_map
* if_same_then_else
* from_over_into
* explicit_auto_deref
* collapsible_if
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
.../pve/firewall/firewall_rules_panel.rs | 2 +-
src/configuration/pve/lxc_network_panel.rs | 7 +--
.../pve/lxc_resources_panel/desktop.rs | 2 +-
.../pve/lxc_resources_panel/mobile.rs | 2 +-
src/configuration/pve/move_disk_dialog.rs | 2 +-
.../pve/qemu_hardware_panel/desktop.rs | 2 +-
.../pve/qemu_hardware_panel/mobile.rs | 2 +-
src/editable_property.rs | 2 +-
src/form/pve/boot_device_list.rs | 6 +-
.../log_ratelimit_selector.rs | 6 +-
src/form/pve/hotplug_feature_selector.rs | 4 +-
src/form/pve/lxc_mount_options_selector.rs | 4 +-
.../lxc_property/lxc_mount_point_property.rs | 32 ++++-------
src/form/pve/pve_guest_selector.rs | 2 +-
src/form/pve/pve_network_selector.rs | 5 +-
src/form/pve/qemu_cpu_flags_list.rs | 8 +--
.../pve/qemu_disk_size_format_selector.rs | 6 +-
.../pve/qemu_property/qemu_disk_property.rs | 55 ++++++++-----------
.../qemu_property/qemu_display_property.rs | 2 +-
.../pve/qemu_property/qemu_memory_property.rs | 15 +++--
.../qemu_spice_enhancement_property.rs | 4 +-
src/log_view.rs | 2 +-
src/utils/task_descriptions.rs | 4 +-
23 files changed, 74 insertions(+), 102 deletions(-)
diff --git a/src/configuration/pve/firewall/firewall_rules_panel.rs b/src/configuration/pve/firewall/firewall_rules_panel.rs
index 56d687e..3f9a9d0 100644
--- a/src/configuration/pve/firewall/firewall_rules_panel.rs
+++ b/src/configuration/pve/firewall/firewall_rules_panel.rs
@@ -260,7 +260,7 @@ fn render_firewall_rule_mobile(rule: &ListFirewallRules) -> Html {
let prefix = Column::new()
.gap(1)
- .with_child(Container::new().with_child(&rule.pos))
+ .with_child(Container::new().with_child(rule.pos))
.with_child(Container::new().with_child(&rule.ty));
tile.add_child(prefix);
diff --git a/src/configuration/pve/lxc_network_panel.rs b/src/configuration/pve/lxc_network_panel.rs
index ae42ab1..200754d 100644
--- a/src/configuration/pve/lxc_network_panel.rs
+++ b/src/configuration/pve/lxc_network_panel.rs
@@ -233,10 +233,9 @@ impl LoadableComponent for LxcNetworkComp {
move |_| link.change_view(Some(ViewState::Add))
}))
.with_child({
- let msg = match &selected_key {
- Some(key) => Some(super::guest::confirm_remove_message(&key.to_string())),
- None => None,
- };
+ let msg = selected_key
+ .as_ref()
+ .map(|key| super::guest::confirm_remove_message(&key.to_string()));
ConfirmButton::new(tr!("Remove"))
.disabled(disable_remove)
.confirm_message(msg)
diff --git a/src/configuration/pve/lxc_resources_panel/desktop.rs b/src/configuration/pve/lxc_resources_panel/desktop.rs
index 2b16133..a70840f 100644
--- a/src/configuration/pve/lxc_resources_panel/desktop.rs
+++ b/src/configuration/pve/lxc_resources_panel/desktop.rs
@@ -167,7 +167,7 @@ impl PveLxcResourcesPanel {
Some(Value::String(volume)) => volume.clone(),
_ => name.to_string(),
};
- confirm_delete_volume(&*name, &volume, false)
+ confirm_delete_volume(&name, &volume, false)
.on_close(on_done)
.on_confirm({
let on_confirm = on_confirm.clone();
diff --git a/src/configuration/pve/lxc_resources_panel/mobile.rs b/src/configuration/pve/lxc_resources_panel/mobile.rs
index a510565..75c8579 100644
--- a/src/configuration/pve/lxc_resources_panel/mobile.rs
+++ b/src/configuration/pve/lxc_resources_panel/mobile.rs
@@ -242,7 +242,7 @@ impl PveLxcResourcesPanel {
) -> ListTile {
let props = ctx.props();
let menu = self.disk_menu(ctx, name, false, true, false).with_item({
- let volume = record[name].as_str().unwrap_or(&name);
+ let volume = record[name].as_str().unwrap_or(name);
let dialog: Html = confirm_delete_volume(name, volume, true)
.on_close({
let link = ctx.link().clone();
diff --git a/src/configuration/pve/move_disk_dialog.rs b/src/configuration/pve/move_disk_dialog.rs
index 9cd1bde..57d4549 100644
--- a/src/configuration/pve/move_disk_dialog.rs
+++ b/src/configuration/pve/move_disk_dialog.rs
@@ -131,7 +131,7 @@ pub fn move_disk_dialog(
node: node.clone(),
remote: remote.clone(),
guest_type,
- mobile: mobile,
+ mobile,
};
VComp::new::<MoveDiskPanelComp>(Rc::new(props), None).into()
}
diff --git a/src/configuration/pve/qemu_hardware_panel/desktop.rs b/src/configuration/pve/qemu_hardware_panel/desktop.rs
index 4f9b747..1385d9e 100644
--- a/src/configuration/pve/qemu_hardware_panel/desktop.rs
+++ b/src/configuration/pve/qemu_hardware_panel/desktop.rs
@@ -170,7 +170,7 @@ impl PveQemuHardwarePanel {
_ => name.to_string(),
};
let on_confirm = on_confirm.clone();
- confirm_delete_volume(&*name, &volume, false)
+ confirm_delete_volume(&name, &volume, false)
.on_close(on_done)
.on_confirm(move |_| on_confirm.emit(()))
.on_confirm({
diff --git a/src/configuration/pve/qemu_hardware_panel/mobile.rs b/src/configuration/pve/qemu_hardware_panel/mobile.rs
index 46b33e4..432ff60 100644
--- a/src/configuration/pve/qemu_hardware_panel/mobile.rs
+++ b/src/configuration/pve/qemu_hardware_panel/mobile.rs
@@ -379,7 +379,7 @@ impl PveQemuHardwarePanel {
) -> ListTile {
let props = ctx.props();
let menu = self.disk_menu(ctx, name, true, false).with_item({
- let volume = record[name].as_str().unwrap_or(&name);
+ let volume = record[name].as_str().unwrap_or(name);
let dialog: Html = confirm_delete_volume(name, volume, true)
.on_close({
let link = ctx.link().clone();
diff --git a/src/editable_property.rs b/src/editable_property.rs
index b1e124c..dac775a 100644
--- a/src/editable_property.rs
+++ b/src/editable_property.rs
@@ -135,7 +135,7 @@ impl EditableProperty {
pub fn new(name: impl IntoPropValue<Option<AttrValue>>, title: impl Into<AttrValue>) -> Self {
let name = name.into_prop_value();
Self {
- name: name,
+ name,
revert_keys: None,
title: title.into(),
required: false,
diff --git a/src/form/pve/boot_device_list.rs b/src/form/pve/boot_device_list.rs
index c0d8808..12d9ad7 100644
--- a/src/form/pve/boot_device_list.rs
+++ b/src/form/pve/boot_device_list.rs
@@ -60,7 +60,7 @@ pub struct PveBootDeviceField {
fn add_disabled_devices(list: &mut Vec<DeviceEntry>, boot_devices: &[(String, String)]) {
let mut disabled_list = Vec::new();
for (device, value) in boot_devices {
- if list.iter().find(|i| &i.name == device).is_none() {
+ if !list.iter().any(|i| &i.name == device) {
disabled_list.push(DeviceEntry {
enabled: false,
name: device.clone(),
@@ -191,9 +191,7 @@ impl ManagedField for PveBootDeviceField {
type Properties = BootDeviceList;
type ValidateClosure = ();
- fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {
- ()
- }
+ fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {}
fn validator(_props: &Self::ValidateClosure, value: &Value) -> Result<Value, Error> {
let value = match value {
diff --git a/src/form/pve/firewall_property/log_ratelimit_selector.rs b/src/form/pve/firewall_property/log_ratelimit_selector.rs
index 36f92b3..1a9fc51 100644
--- a/src/form/pve/firewall_property/log_ratelimit_selector.rs
+++ b/src/form/pve/firewall_property/log_ratelimit_selector.rs
@@ -106,9 +106,9 @@ impl Component for LogRatelimitSelectorComp {
}
}
-impl Into<VNode> for LogRatelimitSelector {
- fn into(self) -> VNode {
- let comp = VComp::new::<LogRatelimitSelectorComp>(Rc::new(self), None);
+impl From<LogRatelimitSelector> for VNode {
+ fn from(val: LogRatelimitSelector) -> Self {
+ let comp = VComp::new::<LogRatelimitSelectorComp>(Rc::new(val), None);
VNode::from(comp)
}
}
diff --git a/src/form/pve/hotplug_feature_selector.rs b/src/form/pve/hotplug_feature_selector.rs
index c0322d0..d16c687 100644
--- a/src/form/pve/hotplug_feature_selector.rs
+++ b/src/form/pve/hotplug_feature_selector.rs
@@ -125,9 +125,7 @@ impl ManagedField for PveHotplugFeatureMaster {
type Properties = HotplugFeatureSelector;
type ValidateClosure = ();
- fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {
- ()
- }
+ fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {}
fn validator(_props: &Self::ValidateClosure, value: &Value) -> Result<Value, Error> {
let value = match value {
diff --git a/src/form/pve/lxc_mount_options_selector.rs b/src/form/pve/lxc_mount_options_selector.rs
index 7a8d0a5..19f3dbf 100644
--- a/src/form/pve/lxc_mount_options_selector.rs
+++ b/src/form/pve/lxc_mount_options_selector.rs
@@ -69,9 +69,7 @@ impl ManagedField for LxcMountOptionsMaster {
type Properties = LxcMountOptionsSelector;
type ValidateClosure = ();
- fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {
- ()
- }
+ fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {}
fn validator(_props: &Self::ValidateClosure, value: &Value) -> Result<Value, Error> {
let value = match value {
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 f02d84f..36f36a0 100644
--- a/src/form/pve/lxc_property/lxc_mount_point_property.rs
+++ b/src/form/pve/lxc_property/lxc_mount_point_property.rs
@@ -75,12 +75,11 @@ impl MountPointComp {
self.unused_volume = props
.unused_disk
.as_ref()
- .map(|unused_disk| {
+ .and_then(|unused_disk| {
props.state.record[unused_disk]
.as_str()
.map(|s| s.to_string())
})
- .flatten()
.unwrap_or_default();
self.used_mount_points = extract_used_mount_points(&props.state.record);
@@ -154,10 +153,8 @@ impl Component for MountPointComp {
Some(Value::String(volume)) => {
if volume.starts_with("/dev/") {
false
- } else if volume_storage(volume).is_some() {
- false
} else {
- true
+ volume_storage(volume).is_none()
}
}
_ => false,
@@ -449,17 +446,15 @@ fn mount_point_property(
}
_ => bail!("got invalid value for unused volume"),
}
- } else if is_create {
- if data[VOLUME_PN].is_null() {
- let image_storage = form_ctx.read().get_field_text(IMAGE_STORAGE);
- let image_size =
- match form_ctx.read().get_last_valid_value(DISK_SIZE_FIELD_NAME) {
- Some(Value::Number(size)) => size.as_f64().unwrap(),
- _ => bail!("got invalid disk size"),
- };
- let image = format!("{image_storage}:{image_size}");
- data[VOLUME_PN] = image.into();
- }
+ } else if is_create && data[VOLUME_PN].is_null() {
+ let image_storage = form_ctx.read().get_field_text(IMAGE_STORAGE);
+ let image_size =
+ match form_ctx.read().get_last_valid_value(DISK_SIZE_FIELD_NAME) {
+ Some(Value::Number(size)) => size.as_f64().unwrap(),
+ _ => bail!("got invalid disk size"),
+ };
+ let image = format!("{image_storage}:{image_size}");
+ data[VOLUME_PN] = image.into();
}
if let Some((_, _, Some(Value::Bool(no_replicate)))) =
form_ctx.read().get_field_data(NOREPLICATE_FIELD_NAME)
@@ -586,10 +581,7 @@ fn volume_storage(volume: &str) -> Option<String> {
static VOLUME_MATCH: Regex = Regex::new(r#"^([a-zA-Z][a-zA-Z0-9\-_.]*[a-zA-Z0-9]):"#).unwrap();
}
match VOLUME_MATCH.with(|r| r.captures(volume)) {
- Some(caps) => match caps.get(1) {
- Some(storage) => Some(storage.as_str().into()),
- None => None,
- },
+ Some(caps) => caps.get(1).map(|storage| storage.as_str().into()),
None => None,
}
}
diff --git a/src/form/pve/pve_guest_selector.rs b/src/form/pve/pve_guest_selector.rs
index e1fcf2d..0e9ea76 100644
--- a/src/form/pve/pve_guest_selector.rs
+++ b/src/form/pve/pve_guest_selector.rs
@@ -103,7 +103,7 @@ impl PveGuestSelectorComp {
percent_encode_component(remote),
)
} else {
- format!("/cluster/resources")
+ "/cluster/resources".to_string()
};
let param = if remote.is_some() {
json!({ "kind": ClusterResourceKind::Vm })
diff --git a/src/form/pve/pve_network_selector.rs b/src/form/pve/pve_network_selector.rs
index 1c9d170..e555c5d 100644
--- a/src/form/pve/pve_network_selector.rs
+++ b/src/form/pve/pve_network_selector.rs
@@ -86,10 +86,7 @@ impl PveNetworkSelectorComp {
format!("/nodes/{}/network", percent_encode_component(&node))
};
- let param = match ty {
- Some(ty) => Some(json!({"type": ty})),
- None => None,
- };
+ let param = ty.map(|ty| json!({"type": ty}));
let mut interfaces: Vec<NetworkInterface> = http_get(url, param).await?;
interfaces.sort_by(|a, b| a.iface.cmp(&b.iface));
diff --git a/src/form/pve/qemu_cpu_flags_list.rs b/src/form/pve/qemu_cpu_flags_list.rs
index becdaf3..048e268 100644
--- a/src/form/pve/qemu_cpu_flags_list.rs
+++ b/src/form/pve/qemu_cpu_flags_list.rs
@@ -87,9 +87,7 @@ impl ManagedField for QemuCpuFlagsField {
type Properties = QemuCpuFlags;
type ValidateClosure = ();
- fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {
- ()
- }
+ fn validation_args(_props: &Self::Properties) -> Self::ValidateClosure {}
fn validator(_props: &Self::ValidateClosure, value: &Value) -> Result<Value, Error> {
Ok(value.clone())
@@ -103,7 +101,7 @@ impl ManagedField for QemuCpuFlagsField {
("spec-ctrl", tr!("Allows improved Spectre mitigation with Intel CPUs")),
("ssbd", tr!("Protection for \"Speculative Store Bypass\" for Intel models")),
("ibpb", tr!("Allows improved Spectre mitigation with AMD CPUs")),
- ("virt-ssbd", tr!("Basis for \"Speculative Store Bypass\" protection for AMD models")),
+ ("virt-ssbd", tr!("Basis for \"Speculative Store Bypass\" protection for AMD models")),
("amd-ssbd", tr!("Improves Spectre mitigation performance with AMD CPUs, best used with \"virt-ssbd\"")),
("amd-no-ssb", tr!("Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs")),
("pdpe1gb", tr!("Allow guest OS to use 1GB size pages, if host HW supports it")),
@@ -193,7 +191,7 @@ impl ManagedField for QemuCpuFlagsField {
)
.with_child(
RadioButton::new("default")
- .checked(item.enabled == None)
+ .checked(item.enabled.is_none())
.on_input(ctx.link().callback({
let name = name.to_string();
move |_| Msg::Set(name.clone(), None)
diff --git a/src/form/pve/qemu_disk_size_format_selector.rs b/src/form/pve/qemu_disk_size_format_selector.rs
index d981f1c..d689b54 100644
--- a/src/form/pve/qemu_disk_size_format_selector.rs
+++ b/src/form/pve/qemu_disk_size_format_selector.rs
@@ -178,9 +178,9 @@ impl Component for QemuDiskSizeFormatComp {
}
}
-impl Into<VNode> for QemuDiskSizeFormatSelector {
- fn into(self) -> VNode {
- let comp = VComp::new::<QemuDiskSizeFormatComp>(Rc::new(self), None);
+impl From<QemuDiskSizeFormatSelector> for VNode {
+ fn from(val: QemuDiskSizeFormatSelector) -> Self {
+ let comp = VComp::new::<QemuDiskSizeFormatComp>(Rc::new(val), None);
VNode::from(comp)
}
}
diff --git a/src/form/pve/qemu_property/qemu_disk_property.rs b/src/form/pve/qemu_property/qemu_disk_property.rs
index dfdf9ea..c1df4f3 100644
--- a/src/form/pve/qemu_property/qemu_disk_property.rs
+++ b/src/form/pve/qemu_property/qemu_disk_property.rs
@@ -112,12 +112,11 @@ impl DiskPanelComp {
self.unused_volume = props
.unused_disk
.as_ref()
- .map(|unused_disk| {
+ .and_then(|unused_disk| {
props.state.record[unused_disk]
.as_str()
.map(|s| s.to_string())
})
- .flatten()
.unwrap_or_default();
self.used_devices = extract_used_devices(&props.state.record);
@@ -408,13 +407,13 @@ pub fn qemu_disk_property(
Some(name) => {
if name.starts_with("unused") {
let mut title = tr!("Unused Disk");
- if let Some(id) = parse_unused_key(&name) {
+ if let Some(id) = parse_unused_key(name) {
title = title + " " + &id.to_string();
}
(Some(name.clone()), title)
} else {
- (None, tr!("Hard Disk") + " (" + &name + ")")
+ (None, tr!("Hard Disk") + " (" + name + ")")
}
}
None => (None, tr!("Hard Disk")),
@@ -447,11 +446,9 @@ pub fn qemu_disk_property(
record[BUS_DEVICE] = default_device.clone().into();
if let Some(name) = &name {
- if unused_disk.is_none() {
- if !name.starts_with("unused") {
- flatten_device_data(&mut record, name)?;
- record[BUS_DEVICE] = name.clone().into();
- }
+ if unused_disk.is_none() && !name.starts_with("unused") {
+ flatten_device_data(&mut record, name)?;
+ record[BUS_DEVICE] = name.clone().into();
}
}
Ok(record)
@@ -475,26 +472,24 @@ pub fn qemu_disk_property(
}
_ => bail!("got invalid value for unused volume"),
}
- } else if is_create {
- if data[FILE_PN].is_null() {
- let image_storage = form_ctx.read().get_field_text(IMAGE_STORAGE);
- let image_size = match form_ctx
- .read()
- .get_last_valid_value(QemuDiskSizeFormatSelector::DISK_SIZE)
- {
- Some(Value::Number(size)) => size.as_f64().unwrap(),
- _ => bail!("got invalid disk size"),
- };
- let image = format!("{image_storage}:{image_size}");
- data[FILE_PN] = image.into();
+ } else if is_create && data[FILE_PN].is_null() {
+ let image_storage = form_ctx.read().get_field_text(IMAGE_STORAGE);
+ let image_size = match form_ctx
+ .read()
+ .get_last_valid_value(QemuDiskSizeFormatSelector::DISK_SIZE)
+ {
+ Some(Value::Number(size)) => size.as_f64().unwrap(),
+ _ => bail!("got invalid disk size"),
+ };
+ let image = format!("{image_storage}:{image_size}");
+ data[FILE_PN] = image.into();
- let image_format = form_ctx
- .read()
- .get_field_text(QemuDiskSizeFormatSelector::DISK_FORMAT);
+ let image_format = form_ctx
+ .read()
+ .get_field_text(QemuDiskSizeFormatSelector::DISK_FORMAT);
- if !image_format.is_empty() {
- data["_format"] = Value::String(image_format);
- }
+ if !image_format.is_empty() {
+ data["_format"] = Value::String(image_format);
}
}
@@ -687,10 +682,8 @@ pub fn qemu_cdrom_property(
let form_ctx = state.form_ctx;
let image_storage = form_ctx.read().get_field_text(IMAGE_STORAGE);
let file = form_ctx.read().get_field_text(FILE_PN);
- if !image_storage.is_empty() {
- if !file.starts_with(&(image_storage + ":")) {
- form_ctx.write().set_field_value(FILE_PN, "".into());
- }
+ if !image_storage.is_empty() && !file.starts_with(&(image_storage + ":")) {
+ form_ctx.write().set_field_value(FILE_PN, "".into());
}
})
}
diff --git a/src/form/pve/qemu_property/qemu_display_property.rs b/src/form/pve/qemu_property/qemu_display_property.rs
index 0ba9b4b..a0a216e 100644
--- a/src/form/pve/qemu_property/qemu_display_property.rs
+++ b/src/form/pve/qemu_property/qemu_display_property.rs
@@ -36,7 +36,7 @@ fn renderer(_name: &str, value: &Value, _record: &Value) -> Html {
};
if let Some(QemuConfigVgaClipboard::Vnc) = vga.clipboard {
- inner.push(format!("clipboard=vnc"));
+ inner.push("clipboard=vnc".to_string());
};
if !inner.is_empty() {
let inner = inner.join(", ");
diff --git a/src/form/pve/qemu_property/qemu_memory_property.rs b/src/form/pve/qemu_property/qemu_memory_property.rs
index 9a8d50a..3cda41e 100644
--- a/src/form/pve/qemu_property/qemu_memory_property.rs
+++ b/src/form/pve/qemu_property/qemu_memory_property.rs
@@ -180,15 +180,14 @@ pub fn qemu_memory_property(mobile: bool) -> EditableProperty {
let old_memory = form_ctx.read().get_field_value("_old_memory");
let balloon = form_ctx.read().get_last_valid_value("balloon");
- match (&old_memory, ¤t_memory, &balloon) {
- (Some(old_memory), Some(current_memory), Some(balloon)) => {
- if balloon == old_memory && old_memory != current_memory {
- form_ctx
- .write()
- .set_field_value("balloon", current_memory.clone());
- }
+ if let (Some(old_memory), Some(current_memory), Some(balloon)) =
+ (&old_memory, ¤t_memory, &balloon)
+ {
+ if balloon == old_memory && old_memory != current_memory {
+ form_ctx
+ .write()
+ .set_field_value("balloon", current_memory.clone());
}
- _ => {}
}
if let Some(current_memory) = current_memory {
diff --git a/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs b/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs
index 993fe61..c6be8a7 100644
--- a/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs
+++ b/src/form/pve/qemu_property/qemu_spice_enhancement_property.rs
@@ -85,9 +85,9 @@ pub fn qemu_spice_enhancement_property(mobile: bool) -> EditableProperty {
output.push(tr!("Video Streaming") + ": " + &videostreaming.to_string());
}
if output.is_empty() {
- return tr!("none").into();
+ tr!("none").into()
} else {
- return output.join(", ").into();
+ output.join(", ").into()
}
}
Ok(None::<_>) => tr!("none").into(),
diff --git a/src/log_view.rs b/src/log_view.rs
index 05acf3d..20f8f77 100644
--- a/src/log_view.rs
+++ b/src/log_view.rs
@@ -478,7 +478,7 @@ impl Component for PwtLogView {
tag.set_style("line-height", format!("{line_height}px"));
}
- let page_ref = page_ref.take().unwrap_or_else(|| NodeRef::default());
+ let page_ref = page_ref.take().unwrap_or_default();
for item in page.lines.iter() {
tag.add_child(format!("{}\n", item.t));
diff --git a/src/utils/task_descriptions.rs b/src/utils/task_descriptions.rs
index 09156ed..13cb3df 100644
--- a/src/utils/task_descriptions.rs
+++ b/src/utils/task_descriptions.rs
@@ -364,10 +364,10 @@ fn render_prune_job_worker_id(id: Option<String>, what: &str) -> String {
);
}
}
- return format!(
+ format!(
"{what} on {ds_translated} {id}",
ds_translated = tr! {"Datastore"}
- );
+ )
}
proxmox_schema::const_regex! {
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 09/13] tree wide: fix clippy lint "manual_strip"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (7 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 08/13] tree wide: fix various minor clippy lints Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 10/13] lxc_property/qemu_property: fix clippy lint "match_like_matches_macro" Shannon Sterz
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
.../pve/lxc_property/lxc_network_property.rs | 4 ++--
src/form/pve/mod.rs | 4 ++--
src/form/pve/qemu_cpu_flags_list.rs | 8 ++++----
src/form/pve/qemu_machine_version_selector.rs | 18 ++++++++++--------
4 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/src/form/pve/lxc_property/lxc_network_property.rs b/src/form/pve/lxc_property/lxc_network_property.rs
index d33267b..f3e582a 100644
--- a/src/form/pve/lxc_property/lxc_network_property.rs
+++ b/src/form/pve/lxc_property/lxc_network_property.rs
@@ -43,8 +43,8 @@ fn get_schema(name: &str) -> &'static Schema {
}
fn net_property_id(name: &str) -> Option<usize> {
- if name.starts_with("net") {
- if let Ok(id) = name[3..].parse::<usize>() {
+ if let Some(name) = name.strip_prefix("net") {
+ if let Ok(id) = name.parse::<usize>() {
return Some(id);
}
}
diff --git a/src/form/pve/mod.rs b/src/form/pve/mod.rs
index 0be5e6f..c92530a 100644
--- a/src/form/pve/mod.rs
+++ b/src/form/pve/mod.rs
@@ -88,8 +88,8 @@ pub enum PveGuestType {
}
fn parse_unused_key(key: &str) -> Option<usize> {
- if key.starts_with("unused") {
- if let Ok(id) = key[6..].parse::<usize>() {
+ if let Some(key) = key.strip_prefix("unused") {
+ if let Ok(id) = key.parse::<usize>() {
return Some(id);
}
}
diff --git a/src/form/pve/qemu_cpu_flags_list.rs b/src/form/pve/qemu_cpu_flags_list.rs
index 048e268..bfcac50 100644
--- a/src/form/pve/qemu_cpu_flags_list.rs
+++ b/src/form/pve/qemu_cpu_flags_list.rs
@@ -55,10 +55,10 @@ fn parse_flags(flags: &str) -> HashMap<String, bool> {
.filter_map(|flag| {
if flag.is_empty() {
None
- } else if flag.starts_with("+") {
- Some((flag[1..].to_string(), true))
- } else if flag.starts_with("-") {
- Some((flag[1..].to_string(), false))
+ } else if let Some(flag) = flag.strip_prefix("+") {
+ Some((flag.to_string(), true))
+ } else if let Some(flag) = flag.strip_prefix("-") {
+ Some((flag.to_string(), false))
} else {
log::error!("unable to parse cpu flag '{flag}' - missing prefix");
None
diff --git a/src/form/pve/qemu_machine_version_selector.rs b/src/form/pve/qemu_machine_version_selector.rs
index 746aba7..d8a3640 100644
--- a/src/form/pve/qemu_machine_version_selector.rs
+++ b/src/form/pve/qemu_machine_version_selector.rs
@@ -173,18 +173,20 @@ fn extract_version_text(id: &str) -> String {
if id == "pc" || id == "q35" {
return tr!("Latest");
}
- if id.starts_with("pc-q35-") {
- return id[7..].to_string();
+
+ if let Some(id) = id.strip_prefix("pc-q35-") {
+ return id.to_string();
}
- if id.starts_with("pc-i440fx-") {
- return id[10..].to_string();
+ if let Some(id) = id.strip_prefix("pc-i440fx-") {
+ return id.to_string();
}
- if id.starts_with("pc-") {
- return id[3..].to_string();
+ if let Some(id) = id.strip_prefix("pc-") {
+ return id.to_string();
}
- if id.starts_with("virt-") {
- return id[5..].to_string();
+ if let Some(id) = id.strip_prefix("virt-") {
+ return id.to_string();
}
+
id.to_string()
}
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 10/13] lxc_property/qemu_property: fix clippy lint "match_like_matches_macro"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (8 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 09/13] tree wide: fix clippy lint "manual_strip" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 11/13] firewall_property: fix clippy lint "redundant_guards" Shannon Sterz
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/form/pve/lxc_property/lxc_features_property.rs | 5 +----
src/form/pve/qemu_property/qemu_efidisk_property.rs | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/form/pve/lxc_property/lxc_features_property.rs b/src/form/pve/lxc_property/lxc_features_property.rs
index 3c712d1..83ddcbb 100644
--- a/src/form/pve/lxc_property/lxc_features_property.rs
+++ b/src/form/pve/lxc_property/lxc_features_property.rs
@@ -59,10 +59,7 @@ impl Component for LxcFeaturesComp {
fn view(&self, ctx: &Context<Self>) -> Html {
let props = ctx.props();
- let unpriviledged = match props.state.record["unprivileged"] {
- Value::Bool(true) => true,
- _ => false,
- };
+ let unpriviledged = matches!(props.state.record["unprivileged"], Value::Bool(true));
let unprivileged_hint = |msg: String| {
if !unpriviledged {
diff --git a/src/form/pve/qemu_property/qemu_efidisk_property.rs b/src/form/pve/qemu_property/qemu_efidisk_property.rs
index 83e028e..3497238 100644
--- a/src/form/pve/qemu_property/qemu_efidisk_property.rs
+++ b/src/form/pve/qemu_property/qemu_efidisk_property.rs
@@ -89,10 +89,7 @@ impl Component for QemuEfidiskPanelComp {
let hint = |msg: String| Container::new().class("pwt-color-warning").with_child(msg);
let bios = serde_json::from_value::<Option<QemuConfigBios>>(state.record["bios"].clone());
- let show_bios_hint = match bios {
- Ok(Some(QemuConfigBios::Ovmf)) => false,
- _ => true,
- };
+ let show_bios_hint = matches!(bios, Ok(Some(QemuConfigBios::Ovmf)));
// disable selector if there is no real choice
let disable_format_selector = supported_formats.len() <= 1;
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 11/13] firewall_property: fix clippy lint "redundant_guards"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (9 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 10/13] lxc_property/qemu_property: fix clippy lint "match_like_matches_macro" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 12/13] qemu_property: fix clippy lint "redundant_pattern_matching" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 13/13] cargo.toml: globally ignore certain clippy lints Shannon Sterz
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/form/pve/firewall_property/mod.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/form/pve/firewall_property/mod.rs b/src/form/pve/firewall_property/mod.rs
index 5ab6de8..8efb22c 100644
--- a/src/form/pve/firewall_property/mod.rs
+++ b/src/form/pve/firewall_property/mod.rs
@@ -37,7 +37,7 @@ pub fn cluster_enable_property(mobile: bool) -> EditableProperty {
.required(true)
.load_hook(|mut record: Value| {
let enable = match record["enable"].as_u64() {
- Some(n) if n == 0 => false,
+ Some(0) => false,
Some(_) => true,
None => false,
};
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 12/13] qemu_property: fix clippy lint "redundant_pattern_matching"
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (10 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 11/13] firewall_property: fix clippy lint "redundant_guards" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 13/13] cargo.toml: globally ignore certain clippy lints Shannon Sterz
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
see:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
src/form/pve/qemu_property/qemu_disk_property.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/form/pve/qemu_property/qemu_disk_property.rs b/src/form/pve/qemu_property/qemu_disk_property.rs
index c1df4f3..8e64b10 100644
--- a/src/form/pve/qemu_property/qemu_disk_property.rs
+++ b/src/form/pve/qemu_property/qemu_disk_property.rs
@@ -503,7 +503,7 @@ pub fn extract_used_devices(record: &Value) -> HashSet<String> {
let mut list = HashSet::new();
if let Some(map) = record.as_object() {
for key in map.keys() {
- if let Ok(_) = parse_qemu_controller_name(key) {
+ if parse_qemu_controller_name(key).is_ok() {
list.insert(key.to_string());
}
}
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH yew-comp v2 13/13] cargo.toml: globally ignore certain clippy lints
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
` (11 preceding siblings ...)
2026-03-09 15:29 ` [PATCH yew-comp v2 12/13] qemu_property: fix clippy lint "redundant_pattern_matching" Shannon Sterz
@ 2026-03-09 15:29 ` Shannon Sterz
12 siblings, 0 replies; 14+ messages in thread
From: Shannon Sterz @ 2026-03-09 15:29 UTC (permalink / raw)
To: yew-devel
these three lints are rarely useful in this repository. so disable
them here to avoid unnecessarily noisy clippy output.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
Cargo.toml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Cargo.toml b/Cargo.toml
index a637f7a..fadcfc5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -104,3 +104,8 @@ network = [
rrd = [
"dep:proxmox-rrd-api-types"
]
+
+[lints.clippy]
+too_many_arguments = "allow"
+enum_variant_names = "allow"
+large_enum_variant = "allow"
--
2.47.3
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-09 15:30 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-09 15:29 [PATCH yew-comp v2 00/13] clippy clean up for proxmox-yew-comp Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 01/13] tree wide: fix clippy lint "useless_conversion" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 02/13] tree wide: fix clippy lint "new_without_default" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 03/13] tree wide: fix clippy lint "redundant_static_lifetimes" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 04/13] tree wide: fix clippy lint "unnecessary_lazy_evaluations" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 05/13] tree wide: fix clippy lint "unwrap_or_default" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 06/13] tree wide: fix clippy lint "clone_on_copy" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 07/13] tree wide: fix clippy lint "collapsible_else_if" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 08/13] tree wide: fix various minor clippy lints Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 09/13] tree wide: fix clippy lint "manual_strip" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 10/13] lxc_property/qemu_property: fix clippy lint "match_like_matches_macro" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 11/13] firewall_property: fix clippy lint "redundant_guards" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 12/13] qemu_property: fix clippy lint "redundant_pattern_matching" Shannon Sterz
2026-03-09 15:29 ` [PATCH yew-comp v2 13/13] cargo.toml: globally ignore certain clippy lints Shannon Sterz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox