From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 9/9] manual clippy fixes
Date: Tue, 4 Mar 2025 15:40:51 +0100 [thread overview]
Message-ID: <20250304144051.585163-9-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20250304144051.585163-1-m.sandoval@proxmox.com>
- 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@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
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-03-04 14:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-04 14:40 [pbs-devel] [PATCH proxmox 1/9] mark extern C blocks as unsafe Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 2/9] daemon: set_var is now unsafe Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 3/9] mark blocks inside unsafe fns unsafe Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 4/9] broadcast_future: accommodate to edition 2024 changes to RPIT Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 5/9] procfs: add variable bindings for std::fs::read Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 6/9] port to edition 2024 Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 7/9] run rustfmt with " Maximiliano Sandoval
2025-03-04 14:40 ` [pbs-devel] [PATCH proxmox 8/9] run cargo clippy --fix Maximiliano Sandoval
2025-03-04 14:40 ` Maximiliano Sandoval [this message]
2025-03-19 11:34 ` [pbs-devel] partially-applied: [PATCH proxmox 1/9] mark extern C blocks as unsafe Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250304144051.585163-9-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.