[pbs-devel] [PATCH proxmox-backup 1/2] tree-wide: make hidden lifetimes explicit
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Nov 3 10:33:33 CET 2025
fixes mismatched-lifetime-syntaxes lint enabled by default in recent rustc versions.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at 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
More information about the pbs-devel
mailing list