[pbs-devel] [PATCH proxmox 09/18] remove unneeded returns

Maximiliano Sandoval m.sandoval at proxmox.com
Wed Jun 26 12:45:05 CEST 2024


Fixes the clippy warning:

warning: unneeded `return` statement
   --> proxmox-tfa/src/api/mod.rs:468:17
    |
468 | /                 return TfaResult::Failure {
469 | |                     needs_saving: true,
470 | |                     tfa_limit_reached,
471 | |                     totp_limit_reached,
472 | |                 };
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    = note: `#[warn(clippy::needless_return)]` on by default
help: remove `return`
    |
468 ~                 TfaResult::Failure {
469 +                     needs_saving: true,
470 +                     tfa_limit_reached,
471 +                     totp_limit_reached,
472 ~                 }
    |

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-notify/src/context/pbs.rs | 2 +-
 proxmox-notify/src/context/pve.rs | 2 +-
 proxmox-tfa/src/api/mod.rs        | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/proxmox-notify/src/context/pbs.rs b/proxmox-notify/src/context/pbs.rs
index 2de305f5..09c555e4 100644
--- a/proxmox-notify/src/context/pbs.rs
+++ b/proxmox-notify/src/context/pbs.rs
@@ -101,7 +101,7 @@ impl Context for PBSContext {
     }
 
     fn default_config(&self) -> &'static str {
-        return DEFAULT_CONFIG;
+        DEFAULT_CONFIG
     }
 
     fn lookup_template(
diff --git a/proxmox-notify/src/context/pve.rs b/proxmox-notify/src/context/pve.rs
index 647f7c89..d49ab27c 100644
--- a/proxmox-notify/src/context/pve.rs
+++ b/proxmox-notify/src/context/pve.rs
@@ -51,7 +51,7 @@ impl Context for PVEContext {
     }
 
     fn default_config(&self) -> &'static str {
-        return DEFAULT_CONFIG;
+        DEFAULT_CONFIG
     }
 
     fn lookup_template(
diff --git a/proxmox-tfa/src/api/mod.rs b/proxmox-tfa/src/api/mod.rs
index 1437aa1b..7f4bbb31 100644
--- a/proxmox-tfa/src/api/mod.rs
+++ b/proxmox-tfa/src/api/mod.rs
@@ -465,11 +465,11 @@ impl TfaConfig {
                         Some(proxmox_time::epoch_i64() + access.tfa_failure_lock_time());
                 }
 
-                return TfaResult::Failure {
+                TfaResult::Failure {
                     needs_saving: true,
                     tfa_limit_reached,
                     totp_limit_reached,
-                };
+                }
             }
         }
     }
-- 
2.39.2





More information about the pbs-devel mailing list