[pbs-devel] [PATCH proxmox 9/9] manual clippy fixes

Maximiliano Sandoval m.sandoval at proxmox.com
Tue Mar 4 15:40:51 CET 2025


- The create_new change is fine since this is a test.
- The api breakage of sort_package_list is OK since the function does
  not have any user outside of proxmox-apt

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 proxmox-apt/src/cache.rs       | 2 +-
 proxmox-sys/tests/xattr.rs     | 2 +-
 proxmox-tfa/src/api/methods.rs | 5 +----
 proxmox-tfa/src/totp.rs        | 2 +-
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/proxmox-apt/src/cache.rs b/proxmox-apt/src/cache.rs
index 1c04481f..5ad81f8f 100644
--- a/proxmox-apt/src/cache.rs
+++ b/proxmox-apt/src/cache.rs
@@ -291,7 +291,7 @@ where
     None
 }
 
-pub fn sort_package_list(packages: &mut Vec<APTUpdateInfo>) {
+pub fn sort_package_list(packages: &mut [APTUpdateInfo]) {
     let cache = apt_pkg_native::Cache::get_singleton();
     packages.sort_by(|left, right| {
         cache
diff --git a/proxmox-sys/tests/xattr.rs b/proxmox-sys/tests/xattr.rs
index 02d43934..e8e77b10 100644
--- a/proxmox-sys/tests/xattr.rs
+++ b/proxmox-sys/tests/xattr.rs
@@ -13,7 +13,7 @@ fn test_fsetxattr_fgetxattr() {
 
     let file = OpenOptions::new()
         .write(true)
-        .create(true)
+        .create_new(true)
         .open(&path)
         .unwrap();
 
diff --git a/proxmox-tfa/src/api/methods.rs b/proxmox-tfa/src/api/methods.rs
index e60a8f65..3d7e70ba 100644
--- a/proxmox-tfa/src/api/methods.rs
+++ b/proxmox-tfa/src/api/methods.rs
@@ -98,10 +98,7 @@ pub fn list_user_tfa(config: &TfaConfig, userid: &str) -> Result<Vec<TypedTfaInf
 ///
 /// In case this returns `None` a `NOT_FOUND` http error should be returned.
 pub fn get_tfa_entry(config: &TfaConfig, userid: &str, id: &str) -> Option<TypedTfaInfo> {
-    let user_data = match config.users.get(userid) {
-        Some(u) => u,
-        None => return None,
-    };
+    let user_data = config.users.get(userid)?;
 
     Some(
         match {
diff --git a/proxmox-tfa/src/totp.rs b/proxmox-tfa/src/totp.rs
index d880fe93..1524fdfc 100644
--- a/proxmox-tfa/src/totp.rs
+++ b/proxmox-tfa/src/totp.rs
@@ -546,7 +546,7 @@ impl PartialEq<&str> for TotpValue {
     fn eq(&self, other: &&str) -> bool {
         // Since we use `from_str_radix` with a radix of 10 explicitly, we can check the number of
         // bytes against the number of digits.
-        if other.as_bytes().len() != (self.digits as usize) {
+        if other.len() != (self.digits as usize) {
             return false;
         }
 
-- 
2.39.5





More information about the pbs-devel mailing list