diff --git a/accounts-db/src/accounts_file.rs b/accounts-db/src/accounts_file.rs index b3851253a85a0e..68e0881800e393 100644 --- a/accounts-db/src/accounts_file.rs +++ b/accounts-db/src/accounts_file.rs @@ -135,10 +135,10 @@ impl AccountsFile { } /// calls `callback` with the account located at the specified index offset. - pub fn get_stored_account_meta_callback<'a, Ret>( - &'a self, + pub fn get_stored_account_meta_callback( + &self, offset: usize, - callback: impl FnMut(StoredAccountMeta<'a>) -> Ret, + callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret, ) -> Option { match self { Self::AppendVec(av) => av.get_stored_account_meta_callback(offset, callback), @@ -205,7 +205,10 @@ impl AccountsFile { } /// Iterate over all accounts and call `callback` with each account. - pub(crate) fn scan_accounts(&self, callback: impl for<'a> FnMut(StoredAccountMeta<'a>)) { + pub(crate) fn scan_accounts( + &self, + callback: impl for<'local> FnMut(StoredAccountMeta<'local>), + ) { match self { Self::AppendVec(av) => av.scan_accounts(callback), Self::TieredStorage(ts) => { diff --git a/accounts-db/src/append_vec.rs b/accounts-db/src/append_vec.rs index 72fc00792b00a2..e0000d0ade5480 100644 --- a/accounts-db/src/append_vec.rs +++ b/accounts-db/src/append_vec.rs @@ -543,10 +543,10 @@ impl AppendVec { } /// calls `callback` with the account located at the specified index offset. - pub fn get_stored_account_meta_callback<'a, Ret>( - &'a self, + pub fn get_stored_account_meta_callback( + &self, offset: usize, - mut callback: impl FnMut(StoredAccountMeta<'a>) -> Ret, + mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret, ) -> Option { self.get_stored_account_meta(offset) .map(|(account, _offset)| callback(account)) @@ -688,7 +688,10 @@ impl AppendVec { /// Iterate over all accounts and call `callback` with each account. #[allow(clippy::blocks_in_conditions)] - pub(crate) fn scan_accounts(&self, mut callback: impl for<'a> FnMut(StoredAccountMeta<'a>)) { + pub(crate) fn scan_accounts( + &self, + mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>), + ) { let mut offset = 0; while self .get_stored_account_meta_callback(offset, |account| { diff --git a/accounts-db/src/tiered_storage/hot.rs b/accounts-db/src/tiered_storage/hot.rs index abbbb9431bc3fc..e9e95ffb05b74b 100644 --- a/accounts-db/src/tiered_storage/hot.rs +++ b/accounts-db/src/tiered_storage/hot.rs @@ -525,10 +525,10 @@ impl HotStorageReader { } /// calls `callback` with the account located at the specified index offset. - pub fn get_stored_account_meta_callback<'a, Ret>( - &'a self, + pub fn get_stored_account_meta_callback( + &self, index_offset: IndexOffset, - mut callback: impl FnMut(StoredAccountMeta<'a>) -> Ret, + mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret, ) -> TieredStorageResult> { let account = self.get_stored_account_meta(index_offset)?; Ok(account.map(|(account, _offset)| callback(account))) @@ -633,7 +633,7 @@ impl HotStorageReader { /// Iterate over all accounts and call `callback` with each account. pub(crate) fn scan_accounts( &self, - mut callback: impl for<'a> FnMut(StoredAccountMeta<'a>), + mut callback: impl for<'local> FnMut(StoredAccountMeta<'local>), ) -> TieredStorageResult<()> { for i in 0..self.footer.account_entry_count { self.get_stored_account_meta_callback(IndexOffset(i), &mut callback)?; diff --git a/accounts-db/src/tiered_storage/readable.rs b/accounts-db/src/tiered_storage/readable.rs index 926d4094bd232b..22ed77da65374e 100644 --- a/accounts-db/src/tiered_storage/readable.rs +++ b/accounts-db/src/tiered_storage/readable.rs @@ -86,10 +86,10 @@ impl TieredStorageReader { } /// calls `callback` with the account located at the specified index offset. - pub fn get_stored_account_meta_callback<'a, Ret>( - &'a self, + pub fn get_stored_account_meta_callback( + &self, index_offset: IndexOffset, - callback: impl FnMut(StoredAccountMeta<'a>) -> Ret, + callback: impl for<'local> FnMut(StoredAccountMeta<'local>) -> Ret, ) -> TieredStorageResult> { match self { Self::Hot(hot) => hot.get_stored_account_meta_callback(index_offset, callback), @@ -148,7 +148,7 @@ impl TieredStorageReader { /// Iterate over all accounts and call `callback` with each account. pub(crate) fn scan_accounts( &self, - callback: impl for<'a> FnMut(StoredAccountMeta<'a>), + callback: impl for<'local> FnMut(StoredAccountMeta<'local>), ) -> TieredStorageResult<()> { match self { Self::Hot(hot) => hot.scan_accounts(callback),