From 4cc78f8953a88f7eeb2cd8680694e70e48357193 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 1 Nov 2024 15:37:04 +0100 Subject: [PATCH] Run cargo fmt --- .../program-2022-test/tests/transfer_hook.rs | 60 ++++--------------- .../downgrade/src/lib.rs | 4 +- .../fail/src/lib.rs | 4 +- .../success/src/lib.rs | 2 +- .../swap-with-fee/src/lib.rs | 4 +- .../swap/src/lib.rs | 4 +- 6 files changed, 23 insertions(+), 55 deletions(-) diff --git a/token/program-2022-test/tests/transfer_hook.rs b/token/program-2022-test/tests/transfer_hook.rs index d357571501c..32f929857a4 100644 --- a/token/program-2022-test/tests/transfer_hook.rs +++ b/token/program-2022-test/tests/transfer_hook.rs @@ -72,16 +72,8 @@ async fn setup_accounts( fn setup_program_test(program_id: &Pubkey) -> ProgramTest { let mut program_test = ProgramTest::default(); - program_test.add_program( - "spl_token_2022", - spl_token_2022::id(), - None, - ); - program_test.add_program( - "spl_transfer_hook_example", - *program_id, - None, - ); + program_test.add_program("spl_token_2022", spl_token_2022::id(), None); + program_test.add_program("spl_transfer_hook_example", *program_id, None); program_test } @@ -253,11 +245,7 @@ async fn success_init() { #[tokio::test] async fn fail_init_all_none() { let mut program_test = ProgramTest::default(); - program_test.add_program( - "spl_token_2022", - spl_token_2022::id(), - None, - ); + program_test.add_program("spl_token_2022", spl_token_2022::id(), None); let context = program_test.start_with_context().await; let context = Arc::new(tokio::sync::Mutex::new(context)); let mut context = TestContext { @@ -582,16 +570,8 @@ async fn fail_transfer_hook_program() { let program_id = Pubkey::new_unique(); let mint = Keypair::new(); let mut program_test = ProgramTest::default(); - program_test.add_program( - "spl_token_2022", - spl_token_2022::id(), - None, - ); - program_test.add_program( - "spl_transfer_hook_example_fail", - program_id, - None, - ); + program_test.add_program("spl_token_2022", spl_token_2022::id(), None); + program_test.add_program("spl_transfer_hook_example_fail", program_id, None); let validation_address = get_extra_account_metas_address(&mint.pubkey(), &program_id); program_test.add_account( validation_address, @@ -650,16 +630,8 @@ async fn success_downgrade_writable_and_signer_accounts() { let program_id = Pubkey::new_unique(); let mint = Keypair::new(); let mut program_test = ProgramTest::default(); - program_test.add_program( - "spl_token_2022", - spl_token_2022::id(), - None, - ); - program_test.add_program( - "spl_transfer_hook_example_downgrade", - program_id, - None, - ); + program_test.add_program("spl_token_2022", spl_token_2022::id(), None); + program_test.add_program("spl_transfer_hook_example_downgrade", program_id, None); let alice = Keypair::new(); let alice_account = Keypair::new(); let validation_address = get_extra_account_metas_address(&mint.pubkey(), &program_id); @@ -735,11 +707,7 @@ async fn success_transfers_using_onchain_helper() { let swap_program_id = Pubkey::new_unique(); let mut program_test = setup_program_test(&program_id); - program_test.add_program( - "spl_transfer_hook_example_swap", - swap_program_id, - None, - ); + program_test.add_program("spl_transfer_hook_example_swap", swap_program_id, None); add_validation_account(&mut program_test, &mint_a, &program_id); add_validation_account(&mut program_test, &mint_b, &program_id); @@ -1100,16 +1068,8 @@ async fn success_without_validation_account() { let program_id = Pubkey::new_unique(); let mint = Keypair::new(); let mut program_test = ProgramTest::default(); - program_test.add_program( - "spl_token_2022", - spl_token_2022::id(), - None, - ); - program_test.add_program( - "spl_transfer_hook_example_success", - program_id, - None, - ); + program_test.add_program("spl_token_2022", spl_token_2022::id(), None); + program_test.add_program("spl_transfer_hook_example_success", program_id, None); let context = program_test.start_with_context().await; let context = Arc::new(tokio::sync::Mutex::new(context)); let mut context = TestContext { diff --git a/token/program-2022-test/transfer-hook-test-programs/downgrade/src/lib.rs b/token/program-2022-test/transfer-hook-test-programs/downgrade/src/lib.rs index 7ca8a5d1e28..5d2dc2959e1 100644 --- a/token/program-2022-test/transfer-hook-test-programs/downgrade/src/lib.rs +++ b/token/program-2022-test/transfer-hook-test-programs/downgrade/src/lib.rs @@ -1,7 +1,9 @@ //! Program implementation use ::{ - solana_account_info::{next_account_info, AccountInfo}, solana_program_error::{ProgramError, ProgramResult}, solana_pubkey::Pubkey + solana_account_info::{next_account_info, AccountInfo}, + solana_program_error::{ProgramError, ProgramResult}, + solana_pubkey::Pubkey, }; solana_program_entrypoint::entrypoint!(process_instruction); diff --git a/token/program-2022-test/transfer-hook-test-programs/fail/src/lib.rs b/token/program-2022-test/transfer-hook-test-programs/fail/src/lib.rs index 48ef18d8585..16e473f3d83 100644 --- a/token/program-2022-test/transfer-hook-test-programs/fail/src/lib.rs +++ b/token/program-2022-test/transfer-hook-test-programs/fail/src/lib.rs @@ -1,7 +1,9 @@ //! Program implementation use ::{ - solana_account_info::AccountInfo, solana_program_error::{ProgramError, ProgramResult}, solana_pubkey::Pubkey + solana_account_info::AccountInfo, + solana_program_error::{ProgramError, ProgramResult}, + solana_pubkey::Pubkey, }; solana_program_entrypoint::entrypoint!(process_instruction); diff --git a/token/program-2022-test/transfer-hook-test-programs/success/src/lib.rs b/token/program-2022-test/transfer-hook-test-programs/success/src/lib.rs index 4629abbe37e..567ec4c0400 100644 --- a/token/program-2022-test/transfer-hook-test-programs/success/src/lib.rs +++ b/token/program-2022-test/transfer-hook-test-programs/success/src/lib.rs @@ -1,7 +1,7 @@ //! Program implementation use ::{ - solana_account_info::AccountInfo, solana_program_error::ProgramResult, solana_pubkey::Pubkey + solana_account_info::AccountInfo, solana_program_error::ProgramResult, solana_pubkey::Pubkey, }; solana_program_entrypoint::entrypoint!(process_instruction); diff --git a/token/program-2022-test/transfer-hook-test-programs/swap-with-fee/src/lib.rs b/token/program-2022-test/transfer-hook-test-programs/swap-with-fee/src/lib.rs index 32c9be912f0..5bafdf50107 100644 --- a/token/program-2022-test/transfer-hook-test-programs/swap-with-fee/src/lib.rs +++ b/token/program-2022-test/transfer-hook-test-programs/swap-with-fee/src/lib.rs @@ -1,7 +1,9 @@ //! Program implementation use ::{ - solana_account_info::{next_account_info, AccountInfo}, solana_program_error::ProgramResult, solana_pubkey::Pubkey, + solana_account_info::{next_account_info, AccountInfo}, + solana_program_error::ProgramResult, + solana_pubkey::Pubkey, spl_token_2022::onchain, }; diff --git a/token/program-2022-test/transfer-hook-test-programs/swap/src/lib.rs b/token/program-2022-test/transfer-hook-test-programs/swap/src/lib.rs index 4956db35983..727ad5aa582 100644 --- a/token/program-2022-test/transfer-hook-test-programs/swap/src/lib.rs +++ b/token/program-2022-test/transfer-hook-test-programs/swap/src/lib.rs @@ -1,7 +1,9 @@ //! Program implementation use ::{ - solana_account_info::{next_account_info, AccountInfo}, solana_program_error::ProgramResult, solana_pubkey::Pubkey, + solana_account_info::{next_account_info, AccountInfo}, + solana_program_error::ProgramResult, + solana_pubkey::Pubkey, spl_token_2022::onchain, };