Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 6edf3ec

Browse files
author
Joe C
authored
rustfmt: format comments
This PR adds comment formatting configurations to the repository's `rustfmt.toml` file, and the associated changes from `cargo +nightly fmt --all`. Comment width 80.
1 parent e82d923 commit 6edf3ec

File tree

220 files changed

+3530
-2331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+3530
-2331
lines changed

associated-token-account/program-test/tests/extended_mint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Mark this test as BPF-only due to current `ProgramTest` limitations when CPIing into the system program
1+
// Mark this test as BPF-only due to current `ProgramTest` limitations when
2+
// CPIing into the system program
23
#![cfg(feature = "test-sbf")]
34

45
mod program_test;
@@ -34,7 +35,8 @@ async fn test_associated_token_account_with_transfer_fees() {
3435
let rent = banks_client.get_rent().await.unwrap();
3536

3637
// create extended mint
37-
// ... in the future, a mint can be pre-loaded in program_test.rs like the regular mint
38+
// ... in the future, a mint can be pre-loaded in program_test.rs like the
39+
// regular mint
3840
let mint_account = Keypair::new();
3941
let token_mint_address = mint_account.pubkey();
4042
let mint_authority = Keypair::new();

associated-token-account/program-test/tests/process_create_associated_token_account.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Mark this test as BPF-only due to current `ProgramTest` limitations when CPIing into the system program
1+
// Mark this test as BPF-only due to current `ProgramTest` limitations when
2+
// CPIing into the system program
23
#![cfg(feature = "test-sbf")]
34

45
mod program_test;
@@ -86,8 +87,8 @@ async fn test_create_with_fewer_lamports() {
8687
.unwrap();
8788
let expected_token_account_balance = rent.minimum_balance(expected_token_account_len);
8889

89-
// Transfer lamports into `associated_token_address` before creating it - enough to be
90-
// rent-exempt for 0 data, but not for an initialized token account
90+
// Transfer lamports into `associated_token_address` before creating it - enough
91+
// to be rent-exempt for 0 data, but not for an initialized token account
9192
let mut transaction = Transaction::new_with_payer(
9293
&[system_instruction::transfer(
9394
&payer.pubkey(),

associated-token-account/program-test/tests/program_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ pub fn program_test(token_mint_address: Pubkey, use_latest_spl_token: bool) -> P
3535
"token-mint-data.bin",
3636
);
3737

38-
// Dial down the BPF compute budget to detect if the program gets bloated in the future
38+
// Dial down the BPF compute budget to detect if the program gets bloated in the
39+
// future
3940
pc.set_compute_max_units(60_000);
4041

4142
pc
@@ -75,7 +76,8 @@ pub fn program_test_2022(
7576
"token-mint-data.bin",
7677
);
7778

78-
// Dial down the BPF compute budget to detect if the program gets bloated in the future
79+
// Dial down the BPF compute budget to detect if the program gets bloated in the
80+
// future
7981
pc.set_compute_max_units(50_000);
8082

8183
pc

associated-token-account/program-test/tests/recover_nested.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Mark this test as BPF-only due to current `ProgramTest` limitations when CPIing into the system program
1+
// Mark this test as BPF-only due to current `ProgramTest` limitations when
2+
// CPIing into the system program
23
#![cfg(feature = "test-sbf")]
34

45
mod program_test;

associated-token-account/program-test/tests/spl_token_create.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// Mark this test as BPF-only due to current `ProgramTest` limitations when CPIing into the system program
1+
// Mark this test as BPF-only due to current `ProgramTest` limitations when
2+
// CPIing into the system program
23
#![cfg(feature = "test-sbf")]
34

45
mod program_test;

associated-token-account/program/src/instruction.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use {
1313
/// Instructions supported by the AssociatedTokenAccount program
1414
#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize, BorshSchema)]
1515
pub enum AssociatedTokenAccountInstruction {
16-
/// Creates an associated token account for the given wallet address and token mint
17-
/// Returns an error if the account exists.
16+
/// Creates an associated token account for the given wallet address and
17+
/// token mint Returns an error if the account exists.
1818
///
1919
/// 0. `[writeable,signer]` Funding account (must be a system account)
2020
/// 1. `[writeable]` Associated token account address to be created
@@ -23,9 +23,9 @@ pub enum AssociatedTokenAccountInstruction {
2323
/// 4. `[]` System program
2424
/// 5. `[]` SPL Token program
2525
Create,
26-
/// Creates an associated token account for the given wallet address and token mint,
27-
/// if it doesn't already exist. Returns an error if the account exists,
28-
/// but with a different owner.
26+
/// Creates an associated token account for the given wallet address and
27+
/// token mint, if it doesn't already exist. Returns an error if the
28+
/// account exists, but with a different owner.
2929
///
3030
/// 0. `[writeable,signer]` Funding account (must be a system account)
3131
/// 1. `[writeable]` Associated token account address to be created
@@ -50,7 +50,8 @@ pub enum AssociatedTokenAccountInstruction {
5050
/// 2. `[writeable]` Wallet's associated token account
5151
/// 3. `[]` Owner associated token account address, must be owned by `5`
5252
/// 4. `[]` Token mint for the owner associated token account
53-
/// 5. `[writeable, signer]` Wallet address for the owner associated token account
53+
/// 5. `[writeable, signer]` Wallet address for the owner associated token
54+
/// account
5455
/// 6. `[]` SPL Token program
5556
RecoverNested,
5657
}

associated-token-account/program/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ pub mod instruction;
88
pub mod processor;
99
pub mod tools;
1010

11-
// Export current SDK types for downstream users building with a different SDK version
11+
// Export current SDK types for downstream users building with a different SDK
12+
// version
1213
pub use solana_program;
1314
use solana_program::{
1415
instruction::{AccountMeta, Instruction},
@@ -32,7 +33,8 @@ pub(crate) fn get_associated_token_address_and_bump_seed(
3233
)
3334
}
3435

35-
/// Derives the associated token account address for the given wallet address and token mint
36+
/// Derives the associated token account address for the given wallet address
37+
/// and token mint
3638
pub fn get_associated_token_address(
3739
wallet_address: &Pubkey,
3840
token_mint_address: &Pubkey,
@@ -44,7 +46,8 @@ pub fn get_associated_token_address(
4446
)
4547
}
4648

47-
/// Derives the associated token account address for the given wallet address, token mint and token program id
49+
/// Derives the associated token account address for the given wallet address,
50+
/// token mint and token program id
4851
pub fn get_associated_token_address_with_program_id(
4952
wallet_address: &Pubkey,
5053
token_mint_address: &Pubkey,
@@ -75,7 +78,8 @@ fn get_associated_token_address_and_bump_seed_internal(
7578
)
7679
}
7780

78-
/// Create an associated token account for the given wallet address and token mint
81+
/// Create an associated token account for the given wallet address and token
82+
/// mint
7983
///
8084
/// Accounts expected by this instruction:
8185
///
@@ -85,7 +89,6 @@ fn get_associated_token_address_and_bump_seed_internal(
8589
/// 3. `[]` The token mint for the new associated token account
8690
/// 4. `[]` System program
8791
/// 5. `[]` SPL Token program
88-
///
8992
#[deprecated(
9093
since = "1.0.5",
9194
note = "please use `instruction::create_associated_token_account` instead"

associated-token-account/program/src/tools/account.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use {
1414
std::convert::TryInto,
1515
};
1616

17-
/// Creates associated token account using Program Derived Address for the given seeds
17+
/// Creates associated token account using Program Derived Address for the given
18+
/// seeds
1819
pub fn create_pda_account<'a>(
1920
payer: &AccountInfo<'a>,
2021
rent: &Rent,
@@ -71,8 +72,8 @@ pub fn create_pda_account<'a>(
7172
}
7273
}
7374

74-
/// Determines the required initial data length for a new token account based on the extensions
75-
/// initialized on the Mint
75+
/// Determines the required initial data length for a new token account based on
76+
/// the extensions initialized on the Mint
7677
pub fn get_account_len<'a>(
7778
mint: &AccountInfo<'a>,
7879
spl_token_program: &AccountInfo<'a>,

binary-option/program/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ pub mod spl_utils;
77
pub mod state;
88
pub mod system_utils;
99
pub mod validation_utils;
10-
// Export current sdk types for downstream users building with a different sdk version
10+
// Export current sdk types for downstream users building with a different sdk
11+
// version
1112
pub use solana_program;
1213

1314
solana_program::declare_id!("betw959P4WToez4DkuXwNsJszqbpe3HuY56AcG5yevx");

binary-option/program/src/processor.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,9 @@ pub fn process_trade(
542542
binary_option.decrement_supply(n_b)?;
543543
}
544544
}
545-
// Delegate the burn authority to the PDA, so a private key is unnecessary on collection
546-
// This can probably be optimized to reduce the number of instructions needed at some point
545+
// Delegate the burn authority to the PDA, so a private key is unnecessary on
546+
// collection This can probably be optimized to reduce the number of
547+
// instructions needed at some point
547548
spl_approve(
548549
token_program_info,
549550
buyer_long_token_account_info,
@@ -589,8 +590,9 @@ pub fn process_trade(
589590

590591
pub fn process_settle(_program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
591592
// This should NEVER be called directly (otherwise this is literally a rug)
592-
// The `pool_owner_info` needs to approve this action, so the recommended use case is to have a higher
593-
// level program own the pool and use an oracle to resolve settlements
593+
// The `pool_owner_info` needs to approve this action, so the recommended use
594+
// case is to have a higher level program own the pool and use an oracle to
595+
// resolve settlements
594596
let account_info_iter = &mut accounts.iter();
595597
let binary_option_account_info = next_account_info(account_info_iter)?;
596598
let winning_mint_account_info = next_account_info(account_info_iter)?;

0 commit comments

Comments
 (0)