[pbs-devel] [PATCH backup 07/13] datastore: use is_{err, some} rather than match {Ok, Some}(_)

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Feb 12 14:17:32 CET 2024


Fixes the clippy lint:

```
warning: redundant pattern matching, consider using `is_ok()`
    --> pbs-datastore/src/datastore.rs:1025:10
     |
1025 |         !matches!(self.inner.gc_mutex.try_lock(), Ok(_))
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.inner.gc_mutex.try_lock().is_ok()`
     |
     = 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>
---
 pbs-datastore/src/datastore.rs | 2 +-
 src/api2/config/access/ldap.rs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index de948821..2f0e5279 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1022,7 +1022,7 @@ impl DataStore {
     }
 
     pub fn garbage_collection_running(&self) -> bool {
-        !matches!(self.inner.gc_mutex.try_lock(), Ok(_))
+        self.inner.gc_mutex.try_lock().is_err()
     }
 
     pub fn garbage_collection(
diff --git a/src/api2/config/access/ldap.rs b/src/api2/config/access/ldap.rs
index 911142a0..e60dc9c1 100644
--- a/src/api2/config/access/ldap.rs
+++ b/src/api2/config/access/ldap.rs
@@ -337,7 +337,7 @@ pub fn update_ldap_realm(
         config.user_classes = Some(user_classes);
     }
 
-    let ldap_config = if let Some(_) = password {
+    let ldap_config = if password.is_some() {
         LdapAuthenticator::api_type_to_config_with_password(&config, password.clone())?
     } else {
         LdapAuthenticator::api_type_to_config(&config)?
-- 
2.39.2





More information about the pbs-devel mailing list