From edb76bdb39e35b907aef7d50774f671040ff6db6 Mon Sep 17 00:00:00 2001 From: Brooks Date: Fri, 10 Jan 2025 00:05:09 -0500 Subject: [PATCH] clippy: needless_lifetimes (#4377) --- .../src/parse_address_lookup_table.rs | 2 +- accounts-db/src/account_storage.rs | 6 +++--- accounts-db/src/account_storage/meta.rs | 2 +- accounts-db/src/accounts_db.rs | 8 ++++---- .../src/accounts_db/scan_account_storage.rs | 2 +- accounts-db/src/accounts_db/tests.rs | 2 +- accounts-db/src/accounts_hash.rs | 4 ++-- accounts-db/src/accounts_index.rs | 4 ++-- accounts-db/src/active_stats.rs | 2 +- accounts-db/src/storable_accounts.rs | 4 ++-- bench-tps/src/send_batch.rs | 2 +- core/src/banking_trace.rs | 2 +- .../consensus/heaviest_subtree_fork_choice.rs | 2 +- core/src/repair/repair_generic_traversal.rs | 2 +- core/src/repair/repair_weighted_traversal.rs | 2 +- cost-model/src/transaction_cost.rs | 4 ++-- gossip/src/cluster_info_metrics.rs | 6 +++--- gossip/src/crds_gossip_pull.rs | 2 +- ledger/src/ancestor_iterator.rs | 4 ++-- ledger/src/next_slots_iterator.rs | 2 +- ledger/src/rooted_slot_iterator.rs | 2 +- ledger/src/shred.rs | 2 +- program-runtime/src/invoke_context.rs | 2 +- programs/bpf_loader/src/syscalls/cpi.rs | 4 ++-- programs/bpf_loader/src/syscalls/mem_ops.rs | 2 +- rpc-client/src/http_sender.rs | 2 +- runtime/src/serde_snapshot.rs | 6 +++--- runtime/src/transaction_batch.rs | 2 +- sdk/account-info/src/lib.rs | 2 +- sdk/file-download/src/lib.rs | 2 +- sdk/message/src/sanitized.rs | 2 +- sdk/message/src/versions/mod.rs | 2 +- sdk/program/src/vote/instruction.rs | 2 +- sdk/sysvar/src/recent_blockhashes.rs | 8 ++++---- sdk/transaction-context/src/lib.rs | 2 +- streamer/src/nonblocking/quic.rs | 2 +- unified-scheduler-pool/src/sleepless_testing.rs | 4 ++-- zk-sdk/src/encryption/elgamal.rs | 16 ++++++++-------- zk-sdk/src/encryption/pedersen.rs | 16 ++++++++-------- zk-token-sdk/src/encryption/elgamal.rs | 16 ++++++++-------- zk-token-sdk/src/encryption/pedersen.rs | 16 ++++++++-------- 41 files changed, 88 insertions(+), 88 deletions(-) diff --git a/account-decoder/src/parse_address_lookup_table.rs b/account-decoder/src/parse_address_lookup_table.rs index c0e5d0a9420004..ae3c17a0495733 100644 --- a/account-decoder/src/parse_address_lookup_table.rs +++ b/account-decoder/src/parse_address_lookup_table.rs @@ -37,7 +37,7 @@ pub struct UiLookupTable { pub addresses: Vec, } -impl<'a> From> for UiLookupTable { +impl From> for UiLookupTable { fn from(address_lookup_table: AddressLookupTable) -> Self { Self { deactivation_slot: address_lookup_table.meta.deactivation_slot.to_string(), diff --git a/accounts-db/src/account_storage.rs b/accounts-db/src/account_storage.rs index 6c1aa2964fe899..2deb07c32b00de 100644 --- a/accounts-db/src/account_storage.rs +++ b/accounts-db/src/account_storage.rs @@ -238,7 +238,7 @@ impl<'a> AccountStorageIter<'a> { } } -impl<'a> Iterator for AccountStorageIter<'a> { +impl Iterator for AccountStorageIter<'_> { type Item = (Slot, Arc); fn next(&mut self) -> Option { @@ -264,7 +264,7 @@ pub struct ShrinkInProgress<'a> { } /// called when the shrink is no longer in progress. This means we can release the old append vec and update the map of slot -> append vec -impl<'a> Drop for ShrinkInProgress<'a> { +impl Drop for ShrinkInProgress<'_> { fn drop(&mut self) { assert_eq!( self.storage @@ -289,7 +289,7 @@ impl<'a> Drop for ShrinkInProgress<'a> { } } -impl<'a> ShrinkInProgress<'a> { +impl ShrinkInProgress<'_> { pub fn new_storage(&self) -> &Arc { &self.new_store } diff --git a/accounts-db/src/account_storage/meta.rs b/accounts-db/src/account_storage/meta.rs index 338f821cd9e211..623e06775eee28 100644 --- a/accounts-db/src/account_storage/meta.rs +++ b/accounts-db/src/account_storage/meta.rs @@ -84,7 +84,7 @@ impl<'storage> StoredAccountMeta<'storage> { } } -impl<'storage> ReadableAccount for StoredAccountMeta<'storage> { +impl ReadableAccount for StoredAccountMeta<'_> { fn lamports(&self) -> u64 { match self { Self::AppendVec(av) => av.lamports(), diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index 2114432cf46760..1a67995a62e4f4 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -166,7 +166,7 @@ enum StoreTo<'a> { Storage(&'a Arc), } -impl<'a> StoreTo<'a> { +impl StoreTo<'_> { fn is_cached(&self) -> bool { matches!(self, StoreTo::Cache) } @@ -1091,7 +1091,7 @@ pub enum LoadedAccount<'a> { Cached(Cow<'a, CachedAccount>), } -impl<'a> LoadedAccount<'a> { +impl LoadedAccount<'_> { pub fn loaded_hash(&self) -> AccountHash { match self { LoadedAccount::Stored(stored_account_meta) => *stored_account_meta.hash(), @@ -1131,7 +1131,7 @@ impl<'a> LoadedAccount<'a> { } } -impl<'a> ReadableAccount for LoadedAccount<'a> { +impl ReadableAccount for LoadedAccount<'_> { fn lamports(&self) -> u64 { match self { LoadedAccount::Stored(stored_account_meta) => stored_account_meta.lamports(), @@ -1875,7 +1875,7 @@ impl solana_frozen_abi::abi_example::AbiExample for AccountsDb { } } -impl<'a> ZeroLamport for StoredAccountMeta<'a> { +impl ZeroLamport for StoredAccountMeta<'_> { fn is_zero_lamport(&self) -> bool { self.lamports() == 0 } diff --git a/accounts-db/src/accounts_db/scan_account_storage.rs b/accounts-db/src/accounts_db/scan_account_storage.rs index 50bb4956c80248..3f295f6ca189f9 100644 --- a/accounts-db/src/accounts_db/scan_account_storage.rs +++ b/accounts-db/src/accounts_db/scan_account_storage.rs @@ -55,7 +55,7 @@ struct ScanState<'a> { stats_num_zero_lamport_accounts_ancient: Arc, } -impl<'a> AppendVecScan for ScanState<'a> { +impl AppendVecScan for ScanState<'_> { fn set_slot(&mut self, slot: Slot, is_ancient: bool) { self.current_slot = slot; self.is_ancient = is_ancient; diff --git a/accounts-db/src/accounts_db/tests.rs b/accounts-db/src/accounts_db/tests.rs index de7be1d99d4af0..07319c0f5eb080 100644 --- a/accounts-db/src/accounts_db/tests.rs +++ b/accounts-db/src/accounts_db/tests.rs @@ -2361,7 +2361,7 @@ lazy_static! { pub static ref RENT_COLLECTOR: RentCollector = RentCollector::default(); } -impl<'a> CalcAccountsHashConfig<'a> { +impl CalcAccountsHashConfig<'_> { pub(crate) fn default() -> Self { Self { use_bg_thread_pool: false, diff --git a/accounts-db/src/accounts_hash.rs b/accounts-db/src/accounts_hash.rs index ad5b26cb8fcb66..1a483d45ac1a87 100644 --- a/accounts-db/src/accounts_hash.rs +++ b/accounts-db/src/accounts_hash.rs @@ -519,7 +519,7 @@ struct ItemLocation<'a> { pointer: SlotGroupPointer, } -impl<'a> AccountsHasher<'a> { +impl AccountsHasher<'_> { pub fn calculate_hash(hashes: Vec>) -> (Hash, usize) { let cumulative_offsets = CumulativeOffsets::from_raw(&hashes); @@ -1384,7 +1384,7 @@ mod tests { static ref ACTIVE_STATS: ActiveStats = ActiveStats::default(); } - impl<'a> AccountsHasher<'a> { + impl AccountsHasher<'_> { fn new(dir_for_temp_cache_files: PathBuf) -> Self { Self { zero_lamport_accounts: ZeroLamportAccounts::Excluded, diff --git a/accounts-db/src/accounts_index.rs b/accounts-db/src/accounts_index.rs index d4fc377021b489..63f4f5504a2797 100644 --- a/accounts-db/src/accounts_index.rs +++ b/accounts-db/src/accounts_index.rs @@ -583,8 +583,8 @@ impl<'a, T: IndexValue, U: DiskIndexValue + From + Into> AccountsIndexIter } } -impl<'a, T: IndexValue, U: DiskIndexValue + From + Into> Iterator - for AccountsIndexIterator<'a, T, U> +impl + Into> Iterator + for AccountsIndexIterator<'_, T, U> { type Item = Vec<(Pubkey, AccountMapEntry)>; fn next(&mut self) -> Option { diff --git a/accounts-db/src/active_stats.rs b/accounts-db/src/active_stats.rs index 3f398041727d05..aacab144b76ff7 100644 --- a/accounts-db/src/active_stats.rs +++ b/accounts-db/src/active_stats.rs @@ -46,7 +46,7 @@ pub struct ActiveStatGuard<'a> { item: ActiveStatItem, } -impl<'a> Drop for ActiveStatGuard<'a> { +impl Drop for ActiveStatGuard<'_> { fn drop(&mut self) { self.stats.update_and_log(self.item, |stat| { stat.fetch_sub(1, Ordering::Relaxed).wrapping_sub(1) diff --git a/accounts-db/src/storable_accounts.rs b/accounts-db/src/storable_accounts.rs index 1843c53833d2c7..b608a6254b5608 100644 --- a/accounts-db/src/storable_accounts.rs +++ b/accounts-db/src/storable_accounts.rs @@ -32,7 +32,7 @@ impl<'a> From<&'a StoredAccountMeta<'a>> for AccountForStorage<'a> { } } -impl<'a> ZeroLamport for AccountForStorage<'a> { +impl ZeroLamport for AccountForStorage<'_> { fn is_zero_lamport(&self) -> bool { self.lamports() == 0 } @@ -47,7 +47,7 @@ impl<'a> AccountForStorage<'a> { } } -impl<'a> ReadableAccount for AccountForStorage<'a> { +impl ReadableAccount for AccountForStorage<'_> { fn lamports(&self) -> u64 { match self { AccountForStorage::AddressAndAccount((_pubkey, account)) => account.lamports(), diff --git a/bench-tps/src/send_batch.rs b/bench-tps/src/send_batch.rs index b3d50662f08de2..c1e304818d6eaa 100644 --- a/bench-tps/src/send_batch.rs +++ b/bench-tps/src/send_batch.rs @@ -193,7 +193,7 @@ trait Sliceable { fn get_pubkey(&self) -> Pubkey; } -impl<'a, T: Sliceable + Send + Sync> SendBatchTransactions<'a, T> for Vec<(T, Transaction)> +impl SendBatchTransactions<'_, T> for Vec<(T, Transaction)> where ::Slice: Signers, { diff --git a/core/src/banking_trace.rs b/core/src/banking_trace.rs index f7a97c28b4e43f..0c9fb856aecb87 100644 --- a/core/src/banking_trace.rs +++ b/core/src/banking_trace.rs @@ -135,7 +135,7 @@ impl RollingCondition for RollingConditionGrouped { } } -impl<'a> Write for GroupedWriter<'a> { +impl Write for GroupedWriter<'_> { fn write(&mut self, buf: &[u8]) -> std::result::Result { self.underlying.write_with_datetime(buf, &self.now) } diff --git a/core/src/consensus/heaviest_subtree_fork_choice.rs b/core/src/consensus/heaviest_subtree_fork_choice.rs index 9d9ed4146b4e72..ff5451a737df7d 100644 --- a/core/src/consensus/heaviest_subtree_fork_choice.rs +++ b/core/src/consensus/heaviest_subtree_fork_choice.rs @@ -1404,7 +1404,7 @@ impl<'a> AncestorIterator<'a> { } } -impl<'a> Iterator for AncestorIterator<'a> { +impl Iterator for AncestorIterator<'_> { type Item = SlotHashKey; fn next(&mut self) -> Option { let parent_slot_hash_key = self diff --git a/core/src/repair/repair_generic_traversal.rs b/core/src/repair/repair_generic_traversal.rs index 35b5276bcbbaa4..b4b330e3d99bac 100644 --- a/core/src/repair/repair_generic_traversal.rs +++ b/core/src/repair/repair_generic_traversal.rs @@ -22,7 +22,7 @@ impl<'a> GenericTraversal<'a> { } } -impl<'a> Iterator for GenericTraversal<'a> { +impl Iterator for GenericTraversal<'_> { type Item = Slot; fn next(&mut self) -> Option { let next = self.pending.pop(); diff --git a/core/src/repair/repair_weighted_traversal.rs b/core/src/repair/repair_weighted_traversal.rs index 7c8b49fb54e040..bcc4425ada111b 100644 --- a/core/src/repair/repair_weighted_traversal.rs +++ b/core/src/repair/repair_weighted_traversal.rs @@ -38,7 +38,7 @@ impl<'a> RepairWeightTraversal<'a> { } } -impl<'a> Iterator for RepairWeightTraversal<'a> { +impl Iterator for RepairWeightTraversal<'_> { type Item = Visit; fn next(&mut self) -> Option { let next = self.pending.pop(); diff --git a/cost-model/src/transaction_cost.rs b/cost-model/src/transaction_cost.rs index f34883bd24db31..00d4e1f71783f9 100644 --- a/cost-model/src/transaction_cost.rs +++ b/cost-model/src/transaction_cost.rs @@ -22,7 +22,7 @@ pub enum TransactionCost<'a, Tx> { Transaction(UsageCostDetails<'a, Tx>), } -impl<'a, Tx> TransactionCost<'a, Tx> { +impl TransactionCost<'_, Tx> { pub fn sum(&self) -> u64 { #![allow(clippy::assertions_on_constants)] match self { @@ -160,7 +160,7 @@ pub struct UsageCostDetails<'a, Tx> { pub allocated_accounts_data_size: u64, } -impl<'a, Tx> UsageCostDetails<'a, Tx> { +impl UsageCostDetails<'_, Tx> { pub fn sum(&self) -> u64 { self.signature_cost .saturating_add(self.write_lock_cost) diff --git a/gossip/src/cluster_info_metrics.rs b/gossip/src/cluster_info_metrics.rs index 3cdfc7231c0e2a..19b5f1c5790b3a 100644 --- a/gossip/src/cluster_info_metrics.rs +++ b/gossip/src/cluster_info_metrics.rs @@ -68,20 +68,20 @@ impl<'a, T> TimedGuard<'a, T> { } } -impl<'a, T> Deref for TimedGuard<'a, T> { +impl Deref for TimedGuard<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { &self.guard } } -impl<'a, T> DerefMut for TimedGuard<'a, T> { +impl DerefMut for TimedGuard<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.guard } } -impl<'a, T> Drop for TimedGuard<'a, T> { +impl Drop for TimedGuard<'_, T> { fn drop(&mut self) { self.counter.add_measure(&mut self.timer); } diff --git a/gossip/src/crds_gossip_pull.rs b/gossip/src/crds_gossip_pull.rs index e94df193d7a1e4..42e2afda4b4acc 100644 --- a/gossip/src/crds_gossip_pull.rs +++ b/gossip/src/crds_gossip_pull.rs @@ -585,7 +585,7 @@ impl<'a> CrdsTimeouts<'a> { } } -impl<'a> Index<&Pubkey> for CrdsTimeouts<'a> { +impl Index<&Pubkey> for CrdsTimeouts<'_> { type Output = u64; fn index(&self, pubkey: &Pubkey) -> &Self::Output { diff --git a/ledger/src/ancestor_iterator.rs b/ledger/src/ancestor_iterator.rs index 50761e63d6286a..ff22bfb4df77c7 100644 --- a/ledger/src/ancestor_iterator.rs +++ b/ledger/src/ancestor_iterator.rs @@ -30,7 +30,7 @@ impl<'a> AncestorIterator<'a> { } } } -impl<'a> Iterator for AncestorIterator<'a> { +impl Iterator for AncestorIterator<'_> { type Item = Slot; fn next(&mut self) -> Option { @@ -57,7 +57,7 @@ impl<'a> From> for AncestorIteratorWithHash<'a> { Self { ancestor_iterator } } } -impl<'a> Iterator for AncestorIteratorWithHash<'a> { +impl Iterator for AncestorIteratorWithHash<'_> { type Item = (Slot, Hash); fn next(&mut self) -> Option { self.ancestor_iterator diff --git a/ledger/src/next_slots_iterator.rs b/ledger/src/next_slots_iterator.rs index 5ef9c776ee7c70..29c147d758b417 100644 --- a/ledger/src/next_slots_iterator.rs +++ b/ledger/src/next_slots_iterator.rs @@ -17,7 +17,7 @@ impl<'a> NextSlotsIterator<'a> { } } -impl<'a> Iterator for NextSlotsIterator<'a> { +impl Iterator for NextSlotsIterator<'_> { type Item = (Slot, SlotMeta); fn next(&mut self) -> Option { if self.pending_slots.is_empty() { diff --git a/ledger/src/rooted_slot_iterator.rs b/ledger/src/rooted_slot_iterator.rs index e83737765c5069..d4bfa3be7e3685 100644 --- a/ledger/src/rooted_slot_iterator.rs +++ b/ledger/src/rooted_slot_iterator.rs @@ -23,7 +23,7 @@ impl<'a> RootedSlotIterator<'a> { } } } -impl<'a> Iterator for RootedSlotIterator<'a> { +impl Iterator for RootedSlotIterator<'_> { type Item = (Slot, Option); fn next(&mut self) -> Option { diff --git a/ledger/src/shred.rs b/ledger/src/shred.rs index 3a10aea2f7b305..84ab63ffcc6361 100644 --- a/ledger/src/shred.rs +++ b/ledger/src/shred.rs @@ -245,7 +245,7 @@ pub(crate) enum SignedData<'a> { MerkleRoot(Hash), } -impl<'a> AsRef<[u8]> for SignedData<'a> { +impl AsRef<[u8]> for SignedData<'_> { fn as_ref(&self) -> &[u8] { match self { Self::Chunk(chunk) => chunk, diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs index fcac091158e63a..9b614738b2552c 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -83,7 +83,7 @@ macro_rules! declare_process_instruction { }; } -impl<'a> ContextObject for InvokeContext<'a> { +impl ContextObject for InvokeContext<'_> { fn trace(&mut self, state: [u64; 12]) { self.syscall_context .last_mut() diff --git a/programs/bpf_loader/src/syscalls/cpi.rs b/programs/bpf_loader/src/syscalls/cpi.rs index d5b04cba955830..26bf8eda786df7 100644 --- a/programs/bpf_loader/src/syscalls/cpi.rs +++ b/programs/bpf_loader/src/syscalls/cpi.rs @@ -50,7 +50,7 @@ enum VmValue<'a, 'b, T> { Translated(&'a mut T), } -impl<'a, 'b, T> VmValue<'a, 'b, T> { +impl VmValue<'_, '_, T> { fn get(&self) -> Result<&T, Error> { match self { VmValue::VmAddress { @@ -2867,7 +2867,7 @@ mod tests { rent_epoch: Epoch, } - impl<'a> MockAccountInfo<'a> { + impl MockAccountInfo<'_> { fn new(key: Pubkey, account: &AccountSharedData) -> MockAccountInfo { MockAccountInfo { key, diff --git a/programs/bpf_loader/src/syscalls/mem_ops.rs b/programs/bpf_loader/src/syscalls/mem_ops.rs index 254828e3c5e2db..7c4bb8903e2480 100644 --- a/programs/bpf_loader/src/syscalls/mem_ops.rs +++ b/programs/bpf_loader/src/syscalls/mem_ops.rs @@ -536,7 +536,7 @@ impl<'a> Iterator for MemoryChunkIterator<'a> { } } -impl<'a> DoubleEndedIterator for MemoryChunkIterator<'a> { +impl DoubleEndedIterator for MemoryChunkIterator<'_> { fn next_back(&mut self) -> Option { if self.vm_addr_start == self.vm_addr_end { return None; diff --git a/rpc-client/src/http_sender.rs b/rpc-client/src/http_sender.rs index 1048d7d507b463..4924ce5cea13fe 100644 --- a/rpc-client/src/http_sender.rs +++ b/rpc-client/src/http_sender.rs @@ -119,7 +119,7 @@ impl<'a> StatsUpdater<'a> { } } -impl<'a> Drop for StatsUpdater<'a> { +impl Drop for StatsUpdater<'_> { fn drop(&mut self) { let mut stats = self.stats.write().unwrap(); stats.request_count += 1; diff --git a/runtime/src/serde_snapshot.rs b/runtime/src/serde_snapshot.rs index d80a4ae78c5ec1..21cb07e7711c6a 100644 --- a/runtime/src/serde_snapshot.rs +++ b/runtime/src/serde_snapshot.rs @@ -694,7 +694,7 @@ struct SerializableBankAndStorage<'a> { } #[cfg(test)] -impl<'a> Serialize for SerializableBankAndStorage<'a> { +impl Serialize for SerializableBankAndStorage<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::ser::Serializer, @@ -738,7 +738,7 @@ struct SerializableBankAndStorageNoExtra<'a> { } #[cfg(test)] -impl<'a> Serialize for SerializableBankAndStorageNoExtra<'a> { +impl Serialize for SerializableBankAndStorageNoExtra<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::ser::Serializer, @@ -788,7 +788,7 @@ struct SerializableAccountsDb<'a> { write_version: StoredMetaWriteVersion, } -impl<'a> Serialize for SerializableAccountsDb<'a> { +impl Serialize for SerializableAccountsDb<'_> { fn serialize(&self, serializer: S) -> std::result::Result where S: serde::ser::Serializer, diff --git a/runtime/src/transaction_batch.rs b/runtime/src/transaction_batch.rs index ef4c74c1508cd5..4b7dd2740e6d20 100644 --- a/runtime/src/transaction_batch.rs +++ b/runtime/src/transaction_batch.rs @@ -97,7 +97,7 @@ impl<'a, 'b, Tx: SVMMessage> TransactionBatch<'a, 'b, Tx> { } // Unlock all locked accounts in destructor. -impl<'a, 'b, Tx: SVMMessage> Drop for TransactionBatch<'a, 'b, Tx> { +impl Drop for TransactionBatch<'_, '_, Tx> { fn drop(&mut self) { if self.needs_unlock() { self.set_needs_unlock(false); diff --git a/sdk/account-info/src/lib.rs b/sdk/account-info/src/lib.rs index d063e600a1a3da..b3656e4151c673 100644 --- a/sdk/account-info/src/lib.rs +++ b/sdk/account-info/src/lib.rs @@ -38,7 +38,7 @@ pub struct AccountInfo<'a> { pub executable: bool, } -impl<'a> fmt::Debug for AccountInfo<'a> { +impl fmt::Debug for AccountInfo<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut f = f.debug_struct("AccountInfo"); diff --git a/sdk/file-download/src/lib.rs b/sdk/file-download/src/lib.rs index 59536dedf93adb..c105a9aa6ea8f8 100644 --- a/sdk/file-download/src/lib.rs +++ b/sdk/file-download/src/lib.rs @@ -130,7 +130,7 @@ pub fn download_file<'a, 'b>( notification_count: u64, } - impl<'e, 'f, R: Read> Read for DownloadProgress<'e, 'f, R> { + impl Read for DownloadProgress<'_, '_, R> { fn read(&mut self, buf: &mut [u8]) -> io::Result { let n = self.response.read(buf)?; diff --git a/sdk/message/src/sanitized.rs b/sdk/message/src/sanitized.rs index 97b9e40abaac93..16de481e99ce2c 100644 --- a/sdk/message/src/sanitized.rs +++ b/sdk/message/src/sanitized.rs @@ -36,7 +36,7 @@ pub struct LegacyMessage<'a> { pub is_writable_account_cache: Vec, } -impl<'a> LegacyMessage<'a> { +impl LegacyMessage<'_> { pub fn new(message: legacy::Message, reserved_account_keys: &HashSet) -> Self { let is_writable_account_cache = message .account_keys diff --git a/sdk/message/src/versions/mod.rs b/sdk/message/src/versions/mod.rs index 2eb56be2bf7bf9..99918fefff9226 100644 --- a/sdk/message/src/versions/mod.rs +++ b/sdk/message/src/versions/mod.rs @@ -216,7 +216,7 @@ impl<'de> serde::Deserialize<'de> for MessagePrefix { { struct PrefixVisitor; - impl<'de> Visitor<'de> for PrefixVisitor { + impl Visitor<'_> for PrefixVisitor { type Value = MessagePrefix; fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { diff --git a/sdk/program/src/vote/instruction.rs b/sdk/program/src/vote/instruction.rs index e707c9e06d05bd..2c998950dc2fe6 100644 --- a/sdk/program/src/vote/instruction.rs +++ b/sdk/program/src/vote/instruction.rs @@ -261,7 +261,7 @@ pub struct CreateVoteAccountConfig<'a> { pub with_seed: Option<(&'a Pubkey, &'a str)>, } -impl<'a> Default for CreateVoteAccountConfig<'a> { +impl Default for CreateVoteAccountConfig<'_> { fn default() -> Self { Self { space: VoteStateVersions::vote_state_size_of(false) as u64, diff --git a/sdk/sysvar/src/recent_blockhashes.rs b/sdk/sysvar/src/recent_blockhashes.rs index 83b54e2ffdb39e..169507b83e01d6 100644 --- a/sdk/sysvar/src/recent_blockhashes.rs +++ b/sdk/sysvar/src/recent_blockhashes.rs @@ -65,21 +65,21 @@ impl Entry { #[derive(Clone, Debug)] pub struct IterItem<'a>(pub u64, pub &'a Hash, pub u64); -impl<'a> Eq for IterItem<'a> {} +impl Eq for IterItem<'_> {} -impl<'a> PartialEq for IterItem<'a> { +impl PartialEq for IterItem<'_> { fn eq(&self, other: &Self) -> bool { self.0 == other.0 } } -impl<'a> Ord for IterItem<'a> { +impl Ord for IterItem<'_> { fn cmp(&self, other: &Self) -> Ordering { self.0.cmp(&other.0) } } -impl<'a> PartialOrd for IterItem<'a> { +impl PartialOrd for IterItem<'_> { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs index 1cd0854d2ab0ef..1ba52fdaf874a7 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -760,7 +760,7 @@ pub struct BorrowedAccount<'a> { account: RefMut<'a, AccountSharedData>, } -impl<'a> BorrowedAccount<'a> { +impl BorrowedAccount<'_> { /// Returns the transaction context pub fn transaction_context(&self) -> &TransactionContext { self.transaction_context diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index d873dd77925ed4..d2fdd59afe5086 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -1503,7 +1503,7 @@ struct EndpointAccept<'a> { accept: Accept<'a>, } -impl<'a> Future for EndpointAccept<'a> { +impl Future for EndpointAccept<'_> { type Output = (Option, usize); fn poll(self: Pin<&mut Self>, cx: &mut std::task::Context) -> Poll { diff --git a/unified-scheduler-pool/src/sleepless_testing.rs b/unified-scheduler-pool/src/sleepless_testing.rs index 901a2f7c4fded7..495b907bd2824b 100644 --- a/unified-scheduler-pool/src/sleepless_testing.rs +++ b/unified-scheduler-pool/src/sleepless_testing.rs @@ -285,7 +285,7 @@ mod real { spawned_thread } - impl<'scope, 'env> ScopeTracked<'scope> for Scope<'scope, 'env> { + impl<'scope> ScopeTracked<'scope> for Scope<'scope, '_> { fn spawn_tracked( &'scope self, f: impl FnOnce() -> T + Send + 'scope, @@ -350,7 +350,7 @@ mod dummy { spawn(f) } - impl<'scope, 'env> ScopeTracked<'scope> for Scope<'scope, 'env> { + impl<'scope> ScopeTracked<'scope> for Scope<'scope, '_> { #[inline] fn spawn_tracked( &'scope self, diff --git a/zk-sdk/src/encryption/elgamal.rs b/zk-sdk/src/encryption/elgamal.rs index cc11c6941cd0b1..aadeb791669a76 100644 --- a/zk-sdk/src/encryption/elgamal.rs +++ b/zk-sdk/src/encryption/elgamal.rs @@ -683,7 +683,7 @@ impl fmt::Display for ElGamalCiphertext { } } -impl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext { +impl<'b> Add<&'b ElGamalCiphertext> for &ElGamalCiphertext { type Output = ElGamalCiphertext; fn add(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext { @@ -700,7 +700,7 @@ define_add_variants!( Output = ElGamalCiphertext ); -impl<'a, 'b> Sub<&'b ElGamalCiphertext> for &'a ElGamalCiphertext { +impl<'b> Sub<&'b ElGamalCiphertext> for &ElGamalCiphertext { type Output = ElGamalCiphertext; fn sub(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext { @@ -717,7 +717,7 @@ define_sub_variants!( Output = ElGamalCiphertext ); -impl<'a, 'b> Mul<&'b Scalar> for &'a ElGamalCiphertext { +impl<'b> Mul<&'b Scalar> for &ElGamalCiphertext { type Output = ElGamalCiphertext; fn mul(self, scalar: &'b Scalar) -> ElGamalCiphertext { @@ -734,7 +734,7 @@ define_mul_variants!( Output = ElGamalCiphertext ); -impl<'a, 'b> Mul<&'b ElGamalCiphertext> for &'a Scalar { +impl<'b> Mul<&'b ElGamalCiphertext> for &Scalar { type Output = ElGamalCiphertext; fn mul(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext { @@ -780,7 +780,7 @@ impl DecryptHandle { } } -impl<'a, 'b> Add<&'b DecryptHandle> for &'a DecryptHandle { +impl<'b> Add<&'b DecryptHandle> for &DecryptHandle { type Output = DecryptHandle; fn add(self, handle: &'b DecryptHandle) -> DecryptHandle { @@ -794,7 +794,7 @@ define_add_variants!( Output = DecryptHandle ); -impl<'a, 'b> Sub<&'b DecryptHandle> for &'a DecryptHandle { +impl<'b> Sub<&'b DecryptHandle> for &DecryptHandle { type Output = DecryptHandle; fn sub(self, handle: &'b DecryptHandle) -> DecryptHandle { @@ -808,7 +808,7 @@ define_sub_variants!( Output = DecryptHandle ); -impl<'a, 'b> Mul<&'b Scalar> for &'a DecryptHandle { +impl<'b> Mul<&'b Scalar> for &DecryptHandle { type Output = DecryptHandle; fn mul(self, scalar: &'b Scalar) -> DecryptHandle { @@ -818,7 +818,7 @@ impl<'a, 'b> Mul<&'b Scalar> for &'a DecryptHandle { define_mul_variants!(LHS = DecryptHandle, RHS = Scalar, Output = DecryptHandle); -impl<'a, 'b> Mul<&'b DecryptHandle> for &'a Scalar { +impl<'b> Mul<&'b DecryptHandle> for &Scalar { type Output = DecryptHandle; fn mul(self, handle: &'b DecryptHandle) -> DecryptHandle { diff --git a/zk-sdk/src/encryption/pedersen.rs b/zk-sdk/src/encryption/pedersen.rs index 9f6a083e0b875c..7abdeccfdff9fd 100644 --- a/zk-sdk/src/encryption/pedersen.rs +++ b/zk-sdk/src/encryption/pedersen.rs @@ -110,7 +110,7 @@ impl ConstantTimeEq for PedersenOpening { } } -impl<'a, 'b> Add<&'b PedersenOpening> for &'a PedersenOpening { +impl<'b> Add<&'b PedersenOpening> for &PedersenOpening { type Output = PedersenOpening; fn add(self, opening: &'b PedersenOpening) -> PedersenOpening { @@ -124,7 +124,7 @@ define_add_variants!( Output = PedersenOpening ); -impl<'a, 'b> Sub<&'b PedersenOpening> for &'a PedersenOpening { +impl<'b> Sub<&'b PedersenOpening> for &PedersenOpening { type Output = PedersenOpening; fn sub(self, opening: &'b PedersenOpening) -> PedersenOpening { @@ -138,7 +138,7 @@ define_sub_variants!( Output = PedersenOpening ); -impl<'a, 'b> Mul<&'b Scalar> for &'a PedersenOpening { +impl<'b> Mul<&'b Scalar> for &PedersenOpening { type Output = PedersenOpening; fn mul(self, scalar: &'b Scalar) -> PedersenOpening { @@ -152,7 +152,7 @@ define_mul_variants!( Output = PedersenOpening ); -impl<'a, 'b> Mul<&'b PedersenOpening> for &'a Scalar { +impl<'b> Mul<&'b PedersenOpening> for &Scalar { type Output = PedersenOpening; fn mul(self, opening: &'b PedersenOpening) -> PedersenOpening { @@ -196,7 +196,7 @@ impl PedersenCommitment { } } -impl<'a, 'b> Add<&'b PedersenCommitment> for &'a PedersenCommitment { +impl<'b> Add<&'b PedersenCommitment> for &PedersenCommitment { type Output = PedersenCommitment; fn add(self, commitment: &'b PedersenCommitment) -> PedersenCommitment { @@ -210,7 +210,7 @@ define_add_variants!( Output = PedersenCommitment ); -impl<'a, 'b> Sub<&'b PedersenCommitment> for &'a PedersenCommitment { +impl<'b> Sub<&'b PedersenCommitment> for &PedersenCommitment { type Output = PedersenCommitment; fn sub(self, commitment: &'b PedersenCommitment) -> PedersenCommitment { @@ -224,7 +224,7 @@ define_sub_variants!( Output = PedersenCommitment ); -impl<'a, 'b> Mul<&'b Scalar> for &'a PedersenCommitment { +impl<'b> Mul<&'b Scalar> for &PedersenCommitment { type Output = PedersenCommitment; fn mul(self, scalar: &'b Scalar) -> PedersenCommitment { @@ -238,7 +238,7 @@ define_mul_variants!( Output = PedersenCommitment ); -impl<'a, 'b> Mul<&'b PedersenCommitment> for &'a Scalar { +impl<'b> Mul<&'b PedersenCommitment> for &Scalar { type Output = PedersenCommitment; fn mul(self, commitment: &'b PedersenCommitment) -> PedersenCommitment { diff --git a/zk-token-sdk/src/encryption/elgamal.rs b/zk-token-sdk/src/encryption/elgamal.rs index 101dea6dcd2b02..5ebf8107d5a0cc 100644 --- a/zk-token-sdk/src/encryption/elgamal.rs +++ b/zk-token-sdk/src/encryption/elgamal.rs @@ -716,7 +716,7 @@ impl fmt::Display for ElGamalCiphertext { } } -impl<'a, 'b> Add<&'b ElGamalCiphertext> for &'a ElGamalCiphertext { +impl<'b> Add<&'b ElGamalCiphertext> for &ElGamalCiphertext { type Output = ElGamalCiphertext; fn add(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext { @@ -733,7 +733,7 @@ define_add_variants!( Output = ElGamalCiphertext ); -impl<'a, 'b> Sub<&'b ElGamalCiphertext> for &'a ElGamalCiphertext { +impl<'b> Sub<&'b ElGamalCiphertext> for &ElGamalCiphertext { type Output = ElGamalCiphertext; fn sub(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext { @@ -750,7 +750,7 @@ define_sub_variants!( Output = ElGamalCiphertext ); -impl<'a, 'b> Mul<&'b Scalar> for &'a ElGamalCiphertext { +impl<'b> Mul<&'b Scalar> for &ElGamalCiphertext { type Output = ElGamalCiphertext; fn mul(self, scalar: &'b Scalar) -> ElGamalCiphertext { @@ -767,7 +767,7 @@ define_mul_variants!( Output = ElGamalCiphertext ); -impl<'a, 'b> Mul<&'b ElGamalCiphertext> for &'a Scalar { +impl<'b> Mul<&'b ElGamalCiphertext> for &Scalar { type Output = ElGamalCiphertext; fn mul(self, ciphertext: &'b ElGamalCiphertext) -> ElGamalCiphertext { @@ -813,7 +813,7 @@ impl DecryptHandle { } } -impl<'a, 'b> Add<&'b DecryptHandle> for &'a DecryptHandle { +impl<'b> Add<&'b DecryptHandle> for &DecryptHandle { type Output = DecryptHandle; fn add(self, handle: &'b DecryptHandle) -> DecryptHandle { @@ -827,7 +827,7 @@ define_add_variants!( Output = DecryptHandle ); -impl<'a, 'b> Sub<&'b DecryptHandle> for &'a DecryptHandle { +impl<'b> Sub<&'b DecryptHandle> for &DecryptHandle { type Output = DecryptHandle; fn sub(self, handle: &'b DecryptHandle) -> DecryptHandle { @@ -841,7 +841,7 @@ define_sub_variants!( Output = DecryptHandle ); -impl<'a, 'b> Mul<&'b Scalar> for &'a DecryptHandle { +impl<'b> Mul<&'b Scalar> for &DecryptHandle { type Output = DecryptHandle; fn mul(self, scalar: &'b Scalar) -> DecryptHandle { @@ -851,7 +851,7 @@ impl<'a, 'b> Mul<&'b Scalar> for &'a DecryptHandle { define_mul_variants!(LHS = DecryptHandle, RHS = Scalar, Output = DecryptHandle); -impl<'a, 'b> Mul<&'b DecryptHandle> for &'a Scalar { +impl<'b> Mul<&'b DecryptHandle> for &Scalar { type Output = DecryptHandle; fn mul(self, handle: &'b DecryptHandle) -> DecryptHandle { diff --git a/zk-token-sdk/src/encryption/pedersen.rs b/zk-token-sdk/src/encryption/pedersen.rs index bb3f94e43a329d..df88ef0011733f 100644 --- a/zk-token-sdk/src/encryption/pedersen.rs +++ b/zk-token-sdk/src/encryption/pedersen.rs @@ -118,7 +118,7 @@ impl ConstantTimeEq for PedersenOpening { } } -impl<'a, 'b> Add<&'b PedersenOpening> for &'a PedersenOpening { +impl<'b> Add<&'b PedersenOpening> for &PedersenOpening { type Output = PedersenOpening; fn add(self, opening: &'b PedersenOpening) -> PedersenOpening { @@ -132,7 +132,7 @@ define_add_variants!( Output = PedersenOpening ); -impl<'a, 'b> Sub<&'b PedersenOpening> for &'a PedersenOpening { +impl<'b> Sub<&'b PedersenOpening> for &PedersenOpening { type Output = PedersenOpening; fn sub(self, opening: &'b PedersenOpening) -> PedersenOpening { @@ -146,7 +146,7 @@ define_sub_variants!( Output = PedersenOpening ); -impl<'a, 'b> Mul<&'b Scalar> for &'a PedersenOpening { +impl<'b> Mul<&'b Scalar> for &PedersenOpening { type Output = PedersenOpening; fn mul(self, scalar: &'b Scalar) -> PedersenOpening { @@ -160,7 +160,7 @@ define_mul_variants!( Output = PedersenOpening ); -impl<'a, 'b> Mul<&'b PedersenOpening> for &'a Scalar { +impl<'b> Mul<&'b PedersenOpening> for &Scalar { type Output = PedersenOpening; fn mul(self, opening: &'b PedersenOpening) -> PedersenOpening { @@ -202,7 +202,7 @@ impl PedersenCommitment { } } -impl<'a, 'b> Add<&'b PedersenCommitment> for &'a PedersenCommitment { +impl<'b> Add<&'b PedersenCommitment> for &PedersenCommitment { type Output = PedersenCommitment; fn add(self, commitment: &'b PedersenCommitment) -> PedersenCommitment { @@ -216,7 +216,7 @@ define_add_variants!( Output = PedersenCommitment ); -impl<'a, 'b> Sub<&'b PedersenCommitment> for &'a PedersenCommitment { +impl<'b> Sub<&'b PedersenCommitment> for &PedersenCommitment { type Output = PedersenCommitment; fn sub(self, commitment: &'b PedersenCommitment) -> PedersenCommitment { @@ -230,7 +230,7 @@ define_sub_variants!( Output = PedersenCommitment ); -impl<'a, 'b> Mul<&'b Scalar> for &'a PedersenCommitment { +impl<'b> Mul<&'b Scalar> for &PedersenCommitment { type Output = PedersenCommitment; fn mul(self, scalar: &'b Scalar) -> PedersenCommitment { @@ -244,7 +244,7 @@ define_mul_variants!( Output = PedersenCommitment ); -impl<'a, 'b> Mul<&'b PedersenCommitment> for &'a Scalar { +impl<'b> Mul<&'b PedersenCommitment> for &Scalar { type Output = PedersenCommitment; fn mul(self, commitment: &'b PedersenCommitment) -> PedersenCommitment {