Skip to content

Commit

Permalink
Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Nov 1, 2024
1 parent cd4fc06 commit 4cc78f8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 55 deletions.
60 changes: 10 additions & 50 deletions token/program-2022-test/tests/transfer_hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
};

Expand Down

0 comments on commit 4cc78f8

Please sign in to comment.