diff --git a/runtime/src/rent_collector.rs b/runtime/src/rent_collector.rs index 88bc57fa87..445954cd5a 100644 --- a/runtime/src/rent_collector.rs +++ b/runtime/src/rent_collector.rs @@ -203,6 +203,10 @@ mod tests { solana_sdk::{account::Account, sysvar}, }; + fn default_rent_collector_clone_with_epoch(epoch: Epoch) -> RentCollector { + RentCollector::default().clone_with_epoch(epoch) + } + #[test] fn test_collect_from_account_created_and_existing() { let old_lamports = 1000; @@ -219,7 +223,7 @@ mod tests { (account.clone(), account) }; - let rent_collector = RentCollector::default().clone_with_epoch(new_epoch); + let rent_collector = default_rent_collector_clone_with_epoch(new_epoch); // collect rent on a newly-created account let collected = rent_collector @@ -263,7 +267,7 @@ mod tests { assert_eq!(account.rent_epoch(), 0); // create a tested rent collector - let rent_collector = RentCollector::default().clone_with_epoch(epoch); + let rent_collector = default_rent_collector_clone_with_epoch(epoch); // first mark account as being collected while being rent-exempt let collected = rent_collector.collect_from_existing_account(&pubkey, &mut account, None); @@ -291,7 +295,7 @@ mod tests { assert_eq!(account.rent_epoch(), 0); let epoch = 3; - let rent_collector = RentCollector::default().clone_with_epoch(epoch); + let rent_collector = default_rent_collector_clone_with_epoch(epoch); let collected = rent_collector.collect_from_existing_account(&pubkey, &mut account, None); assert_eq!(account.lamports(), 0); @@ -311,7 +315,7 @@ mod tests { rent_epoch: account_rent_epoch, ..Account::default() }); - let rent_collector = RentCollector::default().clone_with_epoch(account_rent_epoch + 2); + let rent_collector = default_rent_collector_clone_with_epoch(account_rent_epoch + 2); let collected = rent_collector.collect_from_existing_account(&Pubkey::new_unique(), &mut account, None);