[pdm-devel] [PATCH proxmox-yew-comp 10/15] remove redundant pattern matching

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Jan 13 15:27:20 CET 2025


Fixes:

warning: redundant pattern matching, consider using `is_err()`
   --> src/rrd_timeframe_selector.rs:116:20
    |
116 |             if let Err(_) = store.set_item("ProxmoxRRDTimeframe", &timeframe_str) {
    |             -------^^^^^^-------------------------------------------------------- help: try: `if store.set_item("ProxmoxRRDTimeframe", &timeframe_str).is_err()`
    |
    = note: this will change drop order of the result, as well as all temporaries
    = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
    = note: `#[warn(clippy::redundant_pattern_matching)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 src/rrd_timeframe_selector.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/rrd_timeframe_selector.rs b/src/rrd_timeframe_selector.rs
index 00f22ab..a027046 100644
--- a/src/rrd_timeframe_selector.rs
+++ b/src/rrd_timeframe_selector.rs
@@ -113,7 +113,10 @@ impl RRDTimeframe {
     pub fn store(&self) {
         if let Some(store) = local_storage() {
             let timeframe_str = self.serialize();
-            if let Err(_) = store.set_item("ProxmoxRRDTimeframe", &timeframe_str) {
+            if store
+                .set_item("ProxmoxRRDTimeframe", &timeframe_str)
+                .is_err()
+            {
                 log::error!("RRDTimeframe::store - set_item failed");
             } else {
                 emit_rrd_timeframe_changed_event();
-- 
2.39.5





More information about the pdm-devel mailing list