From 8b6957f237a752b2064f84f9af42c3542a87b9fd Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Wed, 4 Sep 2024 06:57:04 -0400 Subject: [PATCH] refactor: Remove redundant static lifetime (#301) --- CHANGELOG.md | 1 + src/repo/datastore/flatfs.rs | 7 ++++--- src/repo/mod.rs | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f91b651a..cc69893ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - chore: Update libp2p to 0.54. [PR 289](https://github.com/dariusc93/rust-ipfs/pull/289) - chore: Change IpfsOptions visibility, remove UninitializedIpfs::{empty, with_opt}. [PR 294](https://github.com/dariusc93/rust-ipfs/pull/294) - refactor: Support multiple certificates for wss. [PR 295](https://github.com/dariusc93/rust-ipfs/pull/295) +- refactor: Remove redundant static lifetime. [PR 301](https://github.com/dariusc93/rust-ipfs/pull/301) # 0.11.21 - chore: Put libp2p-webrtc-websys behind feature. diff --git a/src/repo/datastore/flatfs.rs b/src/repo/datastore/flatfs.rs index 869e69b36..20dd56b72 100644 --- a/src/repo/datastore/flatfs.rs +++ b/src/repo/datastore/flatfs.rs @@ -136,7 +136,7 @@ fn build_kv, P: AsRef>( ) -> BoxStream<'static, (Vec, Vec)> { let data_path = data_path.as_ref().to_path_buf(); let path = path.as_ref().to_path_buf(); - async_stream::stream! { + let st = async_stream::stream! { if path.is_file() { return; } @@ -171,8 +171,9 @@ fn build_kv, P: AsRef>( } } } - } - .boxed() + }; + + st.boxed() } /// The column operations are all unimplemented pending at least downscoping of the diff --git a/src/repo/mod.rs b/src/repo/mod.rs index 49af6d712..12ec34886 100644 --- a/src/repo/mod.rs +++ b/src/repo/mod.rs @@ -64,7 +64,7 @@ pub enum BlockRmError { /// This API is being discussed and evolved, which will likely lead to breakage. #[async_trait] -pub trait BlockStore: Debug + Send + Sync + 'static { +pub trait BlockStore: Debug + Send + Sync { async fn init(&self) -> Result<(), Error>; /// FIXME: redundant and never called during initialization, which is expected to happen during [`init`]. async fn open(&self) -> Result<(), Error>; @@ -88,7 +88,7 @@ pub trait BlockStore: Debug + Send + Sync + 'static { #[async_trait] /// Generic layer of abstraction for a key-value data store. -pub trait DataStore: PinStore + Debug + Send + Sync + 'static { +pub trait DataStore: PinStore + Debug + Send + Sync { async fn init(&self) -> Result<(), Error>; async fn open(&self) -> Result<(), Error>; /// Checks if a key is present in the datastore.