From 1c3f1e7cdf4945fe742f25f5cab93bfc516a1719 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval Date: Mon, 12 Feb 2024 14:17:32 +0100 Subject: [PATCH] datastore: use is_{err, some} rather than match {Ok, Some}(_) 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 --- 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)?