all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] tree-wide: make hidden lifetimes explicit
@ 2025-11-03  9:33 Fabian Grünbichler
  2025-11-03  9:33 ` [pbs-devel] [PATCH proxmox-backup 2/2] pbs-client: fix unnecessary unwrap Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2025-11-03  9:33 UTC (permalink / raw)
  To: pbs-devel

fixes mismatched-lifetime-syntaxes lint enabled by default in recent rustc versions.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

 https://doc.rust-lang.org/1.90.0/rustc/lints/listing/warn-by-default.html#mismatched-lifetime-syntaxes

 pbs-client/src/pxar/dir_stack.rs     | 12 ++++++------
 pbs-datastore/src/snapshot_reader.rs |  4 ++--
 pbs-pxar-fuse/src/lib.rs             |  9 +++++++--
 pbs-tape/src/sg_tape.rs              |  4 ++--
 pbs-tools/src/crypt_config.rs        |  2 +-
 src/config/node.rs                   |  2 +-
 6 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/pbs-client/src/pxar/dir_stack.rs b/pbs-client/src/pxar/dir_stack.rs
index 43c48f5a6..df5ebd630 100644
--- a/pbs-client/src/pxar/dir_stack.rs
+++ b/pbs-client/src/pxar/dir_stack.rs
@@ -36,10 +36,10 @@ impl PxarDir {
     }
 
     fn create_dir(
-        &mut self,
+        &'_ mut self,
         parent: RawFd,
         allow_existing_dirs: bool,
-    ) -> Result<BorrowedFd, Error> {
+    ) -> Result<BorrowedFd<'_>, Error> {
         if let Err(err) = mkdirat(
             Some(parent),
             self.file_name.as_os_str(),
@@ -53,7 +53,7 @@ impl PxarDir {
         self.open_dir(parent)
     }
 
-    fn open_dir(&mut self, parent: RawFd) -> Result<BorrowedFd, Error> {
+    fn open_dir(&'_ mut self, parent: RawFd) -> Result<BorrowedFd<'_>, Error> {
         let dir = Dir::openat(
             Some(parent),
             self.file_name.as_os_str(),
@@ -68,7 +68,7 @@ impl PxarDir {
         Ok(fd)
     }
 
-    pub fn try_as_borrowed_fd(&self) -> Option<BorrowedFd> {
+    pub fn try_as_borrowed_fd(&'_ self) -> Option<BorrowedFd<'_>> {
         // Once `nix` adds `AsFd` support use `.as_fd()` instead.
         self.dir
             .as_ref()
@@ -120,7 +120,7 @@ impl PxarDirStack {
         Ok(out)
     }
 
-    pub fn last_dir_fd(&mut self, allow_existing_dirs: bool) -> Result<BorrowedFd, Error> {
+    pub fn last_dir_fd(&'_ mut self, allow_existing_dirs: bool) -> Result<BorrowedFd<'_>, Error> {
         // should not be possible given the way we use it:
         assert!(!self.dirs.is_empty(), "PxarDirStack underrun");
 
@@ -147,7 +147,7 @@ impl PxarDirStack {
         Ok(())
     }
 
-    pub fn root_dir_fd(&self) -> Result<BorrowedFd, Error> {
+    pub fn root_dir_fd(&'_ self) -> Result<BorrowedFd<'_>, Error> {
         // should not be possible given the way we use it:
         assert!(!self.dirs.is_empty(), "PxarDirStack underrun");
 
diff --git a/pbs-datastore/src/snapshot_reader.rs b/pbs-datastore/src/snapshot_reader.rs
index 1e6112fe8..e4608ea56 100644
--- a/pbs-datastore/src/snapshot_reader.rs
+++ b/pbs-datastore/src/snapshot_reader.rs
@@ -122,9 +122,9 @@ impl SnapshotReader {
 
     /// Returns an iterator for all chunks not skipped by `skip_fn`.
     pub fn chunk_iterator<F: Fn(&[u8; 32]) -> bool>(
-        &self,
+        &'_ self,
         skip_fn: F,
-    ) -> Result<SnapshotChunkIterator<F>, Error> {
+    ) -> Result<SnapshotChunkIterator<'_, F>, Error> {
         SnapshotChunkIterator::new(self, skip_fn)
     }
 }
diff --git a/pbs-pxar-fuse/src/lib.rs b/pbs-pxar-fuse/src/lib.rs
index 4322c06eb..132c6bec8 100644
--- a/pbs-pxar-fuse/src/lib.rs
+++ b/pbs-pxar-fuse/src/lib.rs
@@ -406,7 +406,7 @@ impl SessionImpl {
         }
     }
 
-    fn get_lookup(&self, inode: u64) -> Result<LookupRef, Error> {
+    fn get_lookup(&'_ self, inode: u64) -> Result<LookupRef<'_>, Error> {
         let lookups = self.lookups.read().unwrap();
         if let Some(lookup) = lookups.get(&inode) {
             return Ok(lookup.get_ref(self));
@@ -447,7 +447,12 @@ impl SessionImpl {
         }
     }
 
-    fn make_lookup(&self, parent: u64, inode: u64, entry: &FileEntry) -> Result<LookupRef, Error> {
+    fn make_lookup(
+        &'_ self,
+        parent: u64,
+        inode: u64,
+        entry: &FileEntry,
+    ) -> Result<LookupRef<'_>, Error> {
         let lookups = self.lookups.read().unwrap();
         if let Some(lookup) = lookups.get(&inode) {
             return Ok(lookup.get_ref(self));
diff --git a/pbs-tape/src/sg_tape.rs b/pbs-tape/src/sg_tape.rs
index 15c56edfe..570dd2845 100644
--- a/pbs-tape/src/sg_tape.rs
+++ b/pbs-tape/src/sg_tape.rs
@@ -848,12 +848,12 @@ impl SgTape {
         Ok(transfer_len)
     }
 
-    pub fn open_writer(&mut self) -> BlockedWriter<SgTapeWriter> {
+    pub fn open_writer(&'_ mut self) -> BlockedWriter<SgTapeWriter<'_>> {
         let writer = SgTapeWriter::new(self);
         BlockedWriter::new(writer)
     }
 
-    pub fn open_reader(&mut self) -> Result<BlockedReader<SgTapeReader>, BlockReadError> {
+    pub fn open_reader(&'_ mut self) -> Result<BlockedReader<SgTapeReader<'_>>, BlockReadError> {
         let reader = SgTapeReader::new(self);
         BlockedReader::open(reader)
     }
diff --git a/pbs-tools/src/crypt_config.rs b/pbs-tools/src/crypt_config.rs
index 6ea46b577..36a75c8b8 100644
--- a/pbs-tools/src/crypt_config.rs
+++ b/pbs-tools/src/crypt_config.rs
@@ -84,7 +84,7 @@ impl CryptConfig {
     }
 
     /// Returns an openssl Signer using SHA256
-    pub fn data_signer(&self) -> openssl::sign::Signer {
+    pub fn data_signer(&'_ self) -> openssl::sign::Signer<'_> {
         openssl::sign::Signer::new(MessageDigest::sha256(), &self.id_pkey).unwrap()
     }
 
diff --git a/src/config/node.rs b/src/config/node.rs
index 96d1eb40a..d2d6e383d 100644
--- a/src/config/node.rs
+++ b/src/config/node.rs
@@ -252,7 +252,7 @@ impl NodeConfig {
         AcmeClient::load(&account).await
     }
 
-    pub fn acme_domains(&self) -> AcmeDomainIter {
+    pub fn acme_domains(&'_ self) -> AcmeDomainIter<'_> {
         AcmeDomainIter::new(self)
     }
 
-- 
2.47.3



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] [PATCH proxmox-backup 2/2] pbs-client: fix unnecessary unwrap
  2025-11-03  9:33 [pbs-devel] [PATCH proxmox-backup 1/2] tree-wide: make hidden lifetimes explicit Fabian Grünbichler
@ 2025-11-03  9:33 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2025-11-03  9:33 UTC (permalink / raw)
  To: pbs-devel

detected by clippy, but not auto-fixable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    with edition 2024, the nested ifs could be combined again - but that requires
    more changes and would also make backporting to PBS 3 harder..

    best viewed with -w

 pbs-client/src/http_client.rs | 55 +++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 25 deletions(-)

diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs
index 8bddf8940..4599bf226 100644
--- a/pbs-client/src/http_client.rs
+++ b/pbs-client/src/http_client.rs
@@ -425,11 +425,11 @@ impl HttpClient {
                 ) {
                     Ok(None) => true,
                     Ok(Some(fingerprint)) => {
-                        if fingerprint_cache && prefix.is_some() {
-                            if let Err(err) =
-                                store_fingerprint(prefix.as_ref().unwrap(), &server, &fingerprint)
-                            {
-                                error!("{}", err);
+                        if fingerprint_cache {
+                            if let Some(ref prefix) = prefix {
+                                if let Err(err) = store_fingerprint(prefix, &server, &fingerprint) {
+                                    error!("{}", err);
+                                }
                             }
                         }
                         *verified_fingerprint.lock().unwrap() = Some(fingerprint);
@@ -535,16 +535,18 @@ impl HttpClient {
                 .await
                 {
                     Ok(auth) => {
-                        if use_ticket_cache && prefix2.is_some() {
-                            if let Err(err) = store_ticket_info(
-                                prefix2.as_ref().unwrap(),
-                                &server2,
-                                &auth.auth_id.to_string(),
-                                &auth.ticket,
-                                &auth.token,
-                            ) {
-                                if std::io::stdout().is_terminal() {
-                                    error!("storing login ticket failed: {}", err);
+                        if use_ticket_cache {
+                            if let Some(ref prefix) = prefix2 {
+                                if let Err(err) = store_ticket_info(
+                                    prefix,
+                                    &server2,
+                                    &auth.auth_id.to_string(),
+                                    &auth.ticket,
+                                    &auth.token,
+                                ) {
+                                    if std::io::stdout().is_terminal() {
+                                        error!("storing login ticket failed: {}", err);
+                                    }
                                 }
                             }
                         }
@@ -572,19 +574,22 @@ impl HttpClient {
             let authinfo = auth.clone();
 
             move |auth| {
-                if use_ticket_cache && prefix.is_some() {
-                    if let Err(err) = store_ticket_info(
-                        prefix.as_ref().unwrap(),
-                        &server,
-                        &auth.auth_id.to_string(),
-                        &auth.ticket,
-                        &auth.token,
-                    ) {
-                        if std::io::stdout().is_terminal() {
-                            error!("storing login ticket failed: {}", err);
+                if use_ticket_cache {
+                    if let Some(ref prefix) = prefix {
+                        if let Err(err) = store_ticket_info(
+                            prefix,
+                            &server,
+                            &auth.auth_id.to_string(),
+                            &auth.ticket,
+                            &auth.token,
+                        ) {
+                            if std::io::stdout().is_terminal() {
+                                error!("storing login ticket failed: {}", err);
+                            }
                         }
                     }
                 }
+
                 *authinfo.write().unwrap() = auth;
                 tokio::spawn(renewal_future);
             }
-- 
2.47.3



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-03  9:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-03  9:33 [pbs-devel] [PATCH proxmox-backup 1/2] tree-wide: make hidden lifetimes explicit Fabian Grünbichler
2025-11-03  9:33 ` [pbs-devel] [PATCH proxmox-backup 2/2] pbs-client: fix unnecessary unwrap Fabian Grünbichler

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal