Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

General cleanup (Part 2) #32998

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unnecessary explicit into_iter() calls
  • Loading branch information
t-nelson authored and Lichtso committed Aug 25, 2023
commit 47e2c85f023220a3011d7d92ccad3239ff7e8ac5
14 changes: 4 additions & 10 deletions programs/system/src/system_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,7 @@ mod tests {
fn create_default_recent_blockhashes_account() -> AccountSharedData {
#[allow(deprecated)]
recent_blockhashes_account::create_account_with_data_for_test(
vec![IterItem(0u64, &Hash::default(), 0); sysvar::recent_blockhashes::MAX_ENTRIES]
.into_iter(),
vec![IterItem(0u64, &Hash::default(), 0); sysvar::recent_blockhashes::MAX_ENTRIES],
)
}
fn create_default_rent_account() -> AccountSharedData {
Expand Down Expand Up @@ -1577,8 +1576,7 @@ mod tests {
#[allow(deprecated)]
let new_recent_blockhashes_account =
solana_sdk::recent_blockhashes_account::create_account_with_data_for_test(
vec![IterItem(0u64, &blockhash, 0); sysvar::recent_blockhashes::MAX_ENTRIES]
.into_iter(),
vec![IterItem(0u64, &blockhash, 0); sysvar::recent_blockhashes::MAX_ENTRIES],
);
mock_process_instruction(
&system_program::id(),
Expand Down Expand Up @@ -1863,9 +1861,7 @@ mod tests {
let blockhash_id = sysvar::recent_blockhashes::id();
#[allow(deprecated)]
let new_recent_blockhashes_account =
solana_sdk::recent_blockhashes_account::create_account_with_data_for_test(
vec![].into_iter(),
);
solana_sdk::recent_blockhashes_account::create_account_with_data_for_test(vec![]);
process_instruction(
&serialize(&SystemInstruction::InitializeNonceAccount(nonce_address)).unwrap(),
vec![
Expand Down Expand Up @@ -1928,9 +1924,7 @@ mod tests {
);
#[allow(deprecated)]
let new_recent_blockhashes_account =
solana_sdk::recent_blockhashes_account::create_account_with_data_for_test(
vec![].into_iter(),
);
solana_sdk::recent_blockhashes_account::create_account_with_data_for_test(vec![]);
mock_process_instruction(
&system_program::id(),
Vec::new(),
Expand Down
25 changes: 17 additions & 8 deletions sdk/src/recent_blockhashes_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mod tests {

#[test]
fn test_create_account_empty() {
let account = create_account_with_data_for_test(vec![].into_iter());
let account = create_account_with_data_for_test(vec![]);
let recent_blockhashes = from_account::<RecentBlockhashes, _>(&account).unwrap();
assert_eq!(recent_blockhashes, RecentBlockhashes::default());
}
Expand All @@ -106,9 +106,14 @@ mod tests {
fn test_create_account_full() {
let def_hash = Hash::default();
let def_lamports_per_signature = 0;
let account = create_account_with_data_for_test(
vec![IterItem(0u64, &def_hash, def_lamports_per_signature); MAX_ENTRIES].into_iter(),
);
let account = create_account_with_data_for_test(vec![
IterItem(
0u64,
&def_hash,
def_lamports_per_signature
);
MAX_ENTRIES
]);
let recent_blockhashes = from_account::<RecentBlockhashes, _>(&account).unwrap();
assert_eq!(recent_blockhashes.len(), MAX_ENTRIES);
}
Expand All @@ -117,10 +122,14 @@ mod tests {
fn test_create_account_truncate() {
let def_hash = Hash::default();
let def_lamports_per_signature = 0;
let account = create_account_with_data_for_test(
vec![IterItem(0u64, &def_hash, def_lamports_per_signature); MAX_ENTRIES + 1]
.into_iter(),
);
let account = create_account_with_data_for_test(vec![
IterItem(
0u64,
&def_hash,
def_lamports_per_signature
);
MAX_ENTRIES + 1
]);
let recent_blockhashes = from_account::<RecentBlockhashes, _>(&account).unwrap();
assert_eq!(recent_blockhashes.len(), MAX_ENTRIES);
}
Expand Down