public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [PATCH yew-mobile-gui v2 11/21] tree-wide: fix several clippy lints
Date: Fri,  8 May 2026 17:57:12 +0200	[thread overview]
Message-ID: <20260508155722.464564-12-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260508155722.464564-1-s.sterz@proxmox.com>

this fixes the following clippy lints:

* let_and_return
* just_underscores_and_digits
* manual_map
* match_like_matches_macro
* missing_const_for_thread_local
* needless_return
* redundant_closure
* unnecessary_to_owned

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/main.rs                                   |  4 ++--
 src/pages/page_configuartion.rs               |  2 +-
 src/pages/page_qemu_status/dashboard_panel.rs |  5 ++---
 src/pages/page_resources.rs                   |  4 ++--
 src/widgets/task_list_button.rs               | 21 +++++++------------
 src/widgets/tasks_panel.rs                    |  2 +-
 6 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 3b22e41..74d4044 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -344,12 +344,12 @@ impl Component for PveMobileApp {
             if auth {
                 switch(path)
             } else {
-                return vec![
+                vec![
                     PageLogin::new()
                         .consent_text(consent_text.clone())
                         .on_login(link.callback(Msg::Login))
                         .into(),
-                ];
+                ]
             }
         };
 
diff --git a/src/pages/page_configuartion.rs b/src/pages/page_configuartion.rs
index 46077c8..73c9eac 100644
--- a/src/pages/page_configuartion.rs
+++ b/src/pages/page_configuartion.rs
@@ -72,7 +72,7 @@ impl PvePageConfiguration {
         List::new(CONFIGS.len() as u64, move |pos| {
             let item = CONFIGS[pos as usize];
 
-            icon_list_tile(Fa::new(item.0.to_string()), item.1.to_string(), (), ())
+            icon_list_tile(Fa::new(item.0), item.1.to_string(), (), ())
                 .interactive(true)
                 .onclick({
                     let navigator = navigator.clone();
diff --git a/src/pages/page_qemu_status/dashboard_panel.rs b/src/pages/page_qemu_status/dashboard_panel.rs
index 27098f4..dc5a8c5 100644
--- a/src/pages/page_qemu_status/dashboard_panel.rs
+++ b/src/pages/page_qemu_status/dashboard_panel.rs
@@ -336,9 +336,8 @@ impl Component for PveQemuDashboardPanel {
                             if let Value::Object(map) = &mut data {
                                 map.retain(|_k, v| v != &Value::Null);
                             }
-                            let data = serde_json::from_value::<QemuStatus>(data)
-                                .map_err(|err| err.into());
-                            data
+
+                            serde_json::from_value::<QemuStatus>(data).map_err(|err| err.into())
                         }
                         Err(err) => Err(err),
                     };
diff --git a/src/pages/page_resources.rs b/src/pages/page_resources.rs
index fdd9af4..469bbf3 100644
--- a/src/pages/page_resources.rs
+++ b/src/pages/page_resources.rs
@@ -90,7 +90,7 @@ fn filter_match(item: &ClusterResource, filter: &ResourceFilter) -> bool {
 }
 
 thread_local! {
-    static RESOURCES: RefCell<Option<Result<Vec<ClusterResource>, Error>>> = RefCell::new(None);
+    static RESOURCES: RefCell<Option<Result<Vec<ClusterResource>, Error>>> = const { RefCell::new(None) };
 }
 pub struct PvePageResources {
     reload_timeout: Option<Timeout>,
@@ -303,7 +303,7 @@ impl PvePageResources {
     fn create_top_bar(&self, ctx: &Context<Self>) -> Html {
         let mut search = Field::new()
             .value(self.filter.name.clone())
-            .on_change(ctx.link().callback(|value| Msg::SetTextFilter(value)))
+            .on_change(ctx.link().callback(Msg::SetTextFilter))
             .class(pwt::css::Flex::Fill);
 
         search.add_trigger(
diff --git a/src/widgets/task_list_button.rs b/src/widgets/task_list_button.rs
index d449428..3b28162 100644
--- a/src/widgets/task_list_button.rs
+++ b/src/widgets/task_list_button.rs
@@ -133,12 +133,10 @@ impl Component for ProxmoxTaskListButton {
                 if Some(&upid) != self.running_upid.as_ref() {
                     return false;
                 }
-                let running = match &result {
-                    Ok(status) if status.status == IsRunning::Running => true,
-                    _ => false,
-                };
 
-                if running {
+                if let Ok(status) = &result
+                    && status.status == IsRunning::Running
+                {
                     let link = ctx.link().clone();
                     self.check_task_status_timeout = Some(Timeout::new(1000, move || {
                         link.send_message(Msg::CheckTaskStatus);
@@ -165,14 +163,11 @@ impl Component for ProxmoxTaskListButton {
     fn view(&self, ctx: &Context<Self>) -> Html {
         let props = ctx.props();
 
-        let content = match &self.last_task_status {
-            Some(last_task_status) => Some(
-                Container::new()
-                    .class("pwt-font-size-title-medium")
-                    .with_child(last_task_status),
-            ),
-            None => None,
-        };
+        let content = self.last_task_status.as_ref().map(|last_task_status| {
+            Container::new()
+                .class("pwt-font-size-title-medium")
+                .with_child(last_task_status)
+        });
 
         Column::new()
             .gap(2)
diff --git a/src/widgets/tasks_panel.rs b/src/widgets/tasks_panel.rs
index 36f8c29..326aaef 100644
--- a/src/widgets/tasks_panel.rs
+++ b/src/widgets/tasks_panel.rs
@@ -57,7 +57,7 @@ fn task_icon(task: &ListTasksResponse) -> Fa {
 
     match task.status.as_deref() {
         Some("OK") => Fa::new("info-circle").class(pwt::css::FontColor::Primary),
-        Some(__) => Fa::new("exclamation-triangle").class(pwt::css::FontColor::Error),
+        Some(_) => Fa::new("exclamation-triangle").class(pwt::css::FontColor::Error),
         _ => Fa::new("question"),
     }
 }
-- 
2.47.3





  parent reply	other threads:[~2026-05-08 15:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 15:57 [PATCH yew-comp/yew-mobile-gui v2 00/21] firewall tabs and clean up for pve-yew-mobile-gui Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-comp v2 01/21] firewall rules panel: correct the url for the pve cluster firewall rules Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 02/21] cargo.toml: globally ignore certain clippy lints Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 03/21] main: avoid unnecessary clones Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 04/21] tree-wide: collapse if statements Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 05/21] tree-wide: implement the `From` trait instead of the `Into` trait Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 06/21] tree-wide: implement `Default` for types with an `new()` constructor Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 07/21] tree-wide: remove unnecessary lazy evaluations Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 08/21] tree-wide: remove needless borrows Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 09/21] configuration page: remove redundant static lifetimes Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 10/21] resources/configuration page: remove useless `.into()` calls Shannon Sterz
2026-05-08 15:57 ` Shannon Sterz [this message]
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 12/21] dashboard: use proper plural translation string instead of "CPU(s)" Shannon Sterz
2026-05-08 16:11   ` Shan Shaji
2026-05-08 16:13   ` Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 13/21] configuration: clarify that "Firewall" shows the cluster's firewall Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 14/21] cluster/qemu firewall: use rules panel and comment out unused tabs Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 15/21] qemu status page: align icons better with tabs Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 16/21] lxc page: align layout for lxc guest with qemu guests Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 17/21] lxc: add support for a rudimentary firewall tab for lxc guests Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 18/21] node status: align layout for node status with guest pages Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 19/21] node: add a rudimentary firewall tab for cluster nodes Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 20/21] api types: remove unused file Shannon Sterz
2026-05-08 15:57 ` [PATCH yew-mobile-gui v2 21/21] resources page: map subscription level analogous to dashboard Shannon Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260508155722.464564-12-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=yew-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal