[pbs-devel] [PATCH proxmox-backup v2 14/14] bin/proxmox-restore-daemon: clippy fixes

Dominik Csapak d.csapak at proxmox.com
Fri Apr 16 12:29:10 CEST 2021


fixes:
* unnecessary reference
* unnecessary return
* absurd extreme comparisons

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/bin/proxmox_restore_daemon/auth.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/bin/proxmox_restore_daemon/auth.rs b/src/bin/proxmox_restore_daemon/auth.rs
index 0973849e..1cf5a2c4 100644
--- a/src/bin/proxmox_restore_daemon/auth.rs
+++ b/src/bin/proxmox_restore_daemon/auth.rs
@@ -22,13 +22,13 @@ impl ApiAuth for StaticAuth {
         _user_info: &CachedUserInfo,
     ) -> Result<Authid, AuthError> {
         match headers.get(hyper::header::AUTHORIZATION) {
-            Some(header) if header.to_str().unwrap_or("") == &self.ticket => {
+            Some(header) if header.to_str().unwrap_or("") == self.ticket => {
                 Ok(Authid::root_auth_id().to_owned())
             }
             _ => {
-                return Err(AuthError::Generic(format_err!(
+                Err(AuthError::Generic(format_err!(
                     "invalid file restore ticket provided"
-                )));
+                )))
             }
         }
     }
@@ -38,7 +38,7 @@ pub fn ticket_auth() -> Result<StaticAuth, Error> {
     let mut ticket_file = File::open(TICKET_FILE)?;
     let mut ticket = String::new();
     let len = ticket_file.read_to_string(&mut ticket)?;
-    if len <= 0 {
+    if len == 0 {
         bail!("invalid ticket: cannot be empty");
     }
     Ok(StaticAuth { ticket })
-- 
2.20.1






More information about the pbs-devel mailing list