From 539e0442b57eb156601614d516526271ffa5f9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 11 Aug 2025 09:55:04 +0200 Subject: [PATCH 1/2] chore: Fix lifetime elision warnings with rustc 1.89 --- src/heads.rs | 2 +- src/ranger.rs | 1 + src/store/fs.rs | 11 +++++++---- src/store/fs/bounds.rs | 8 ++++---- src/store/fs/tables.rs | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/heads.rs b/src/heads.rs index baa923ae..79e9429e 100644 --- a/src/heads.rs +++ b/src/heads.rs @@ -61,7 +61,7 @@ impl AuthorHeads { } /// Create an iterator over the entries in this state. - pub fn iter(&self) -> std::collections::btree_map::Iter { + pub fn iter(&self) -> std::collections::btree_map::Iter<'_, AuthorId, Timestamp> { self.heads.iter() } diff --git a/src/ranger.rs b/src/ranger.rs index ca79cee4..f6c4bbe8 100644 --- a/src/ranger.rs +++ b/src/ranger.rs @@ -224,6 +224,7 @@ impl Message { } } +#[allow(dead_code)] pub trait Store: Sized { type Error: Debug + Send + Sync + Into + 'static; diff --git a/src/store/fs.rs b/src/store/fs.rs index 78079e7f..8646663d 100644 --- a/src/store/fs.rs +++ b/src/store/fs.rs @@ -186,7 +186,7 @@ impl Store { /// /// As such, there is also no guarantee that the data you see is /// already persisted. - fn tables(&mut self) -> Result<&Tables> { + fn tables(&mut self) -> Result<&Tables<'_>> { let guard = &mut self.transaction; let tables = match std::mem::take(guard) { CurrentTransaction::None => { @@ -258,7 +258,7 @@ type PeersIter = std::vec::IntoIter; impl Store { /// Create a new replica for `namespace` and persist in this store. - pub fn new_replica(&mut self, namespace: NamespaceSecret) -> Result { + pub fn new_replica(&mut self, namespace: NamespaceSecret) -> Result> { let id = namespace.id(); self.import_namespace(namespace.into())?; self.open_replica(&id).map_err(Into::into) @@ -295,7 +295,7 @@ impl Store { /// Open a replica from this store. /// /// This just calls load_replica_info and then creates a new replica with the info. - pub fn open_replica(&mut self, namespace_id: &NamespaceId) -> Result { + pub fn open_replica(&mut self, namespace_id: &NamespaceId) -> Result, OpenError> { let info = self.load_replica_info(namespace_id)?; let instance = StoreInstance::new(*namespace_id, self); Ok(Replica::new(instance, Box::new(info))) @@ -465,7 +465,10 @@ impl Store { } /// Get the latest entry for each author in a namespace. - pub fn get_latest_for_each_author(&mut self, namespace: NamespaceId) -> Result { + pub fn get_latest_for_each_author( + &mut self, + namespace: NamespaceId, + ) -> Result> { LatestIterator::new(&self.tables()?.latest_per_author, namespace) } diff --git a/src/store/fs/bounds.rs b/src/store/fs/bounds.rs index fd35a081..f8234512 100644 --- a/src/store/fs/bounds.rs +++ b/src/store/fs/bounds.rs @@ -61,8 +61,8 @@ impl RecordsBounds { Self::new(start, Self::namespace_end(ns)) } - pub fn as_ref(&self) -> (Bound, Bound) { - fn map(id: &RecordsIdOwned) -> RecordsId { + pub fn as_ref(&self) -> (Bound>, Bound>) { + fn map(id: &RecordsIdOwned) -> RecordsId<'_> { (&id.0, &id.1, &id.2[..]) } (map_bound(&self.0, map), map_bound(&self.1, map)) @@ -139,8 +139,8 @@ impl ByKeyBounds { Self(start, end) } - pub fn as_ref(&self) -> (Bound, Bound) { - fn map(id: &RecordsByKeyIdOwned) -> RecordsByKeyId { + pub fn as_ref(&self) -> (Bound>, Bound>) { + fn map(id: &RecordsByKeyIdOwned) -> RecordsByKeyId<'_> { (&id.0, &id.1[..], &id.2) } (map_bound(&self.0, map), map_bound(&self.1, map)) diff --git a/src/store/fs/tables.rs b/src/store/fs/tables.rs index 898fffca..d683d038 100644 --- a/src/store/fs/tables.rs +++ b/src/store/fs/tables.rs @@ -96,7 +96,7 @@ impl TransactionAndTables { }) } - pub fn tables(&self) -> &Tables { + pub fn tables(&self) -> &Tables<'_> { self.inner.borrow_dependent() } From 0f1b5035e7a019438df204c6c2ddee6e9fc35ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Mon, 11 Aug 2025 10:00:56 +0200 Subject: [PATCH 2/2] ignore dead code warn for prefix filter --- src/ranger.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ranger.rs b/src/ranger.rs index f6c4bbe8..d385a203 100644 --- a/src/ranger.rs +++ b/src/ranger.rs @@ -875,6 +875,7 @@ mod tests { enum SimpleFilter { None, Range(Range), + #[allow(dead_code)] Prefix(K), }