Skip to content

Commit e82d923

Browse files
author
Joe C
authored
rustfmt: format imports
This PR adds import formatting configurations to the repository's `rustfmt.toml` file, and the associated changes from `cargo +nightly fmt --all`.
1 parent 4025c87 commit e82d923

File tree

252 files changed

+2689
-2517
lines changed

Some content is hidden

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

252 files changed

+2689
-2517
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
mod program_test;
55

6+
#[allow(deprecated)]
7+
use spl_associated_token_account::create_associated_token_account as deprecated_create_associated_token_account;
68
use {
79
program_test::program_test,
810
solana_program::pubkey::Pubkey,
@@ -14,9 +16,6 @@ use {
1416
spl_token::state::Account,
1517
};
1618

17-
#[allow(deprecated)]
18-
use spl_associated_token_account::create_associated_token_account as deprecated_create_associated_token_account;
19-
2019
#[tokio::test]
2120
async fn success_create() {
2221
let wallet_address = Pubkey::new_unique();

binary-option/program/src/entrypoint.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
22

3-
use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
4-
5-
use crate::processor::Processor;
3+
use {
4+
crate::processor::Processor,
5+
solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey},
6+
};
67

78
solana_program::entrypoint!(process_instruction);
89
fn process_instruction(

binary-option/program/src/error.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use thiserror::Error;
2-
3-
use solana_program::program_error::ProgramError;
1+
use {solana_program::program_error::ProgramError, thiserror::Error};
42

53
#[derive(Error, Debug, Copy, Clone)]
64
pub enum BinaryOptionError {

binary-option/program/src/instruction.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use solana_program::{
2-
instruction::{AccountMeta, Instruction},
3-
pubkey::Pubkey,
4-
sysvar,
1+
use {
2+
borsh::{BorshDeserialize, BorshSerialize},
3+
solana_program::{
4+
instruction::{AccountMeta, Instruction},
5+
pubkey::Pubkey,
6+
sysvar,
7+
},
58
};
69

7-
use borsh::{BorshDeserialize, BorshSerialize};
8-
910
#[repr(C)]
1011
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
1112
pub struct InitializeBinaryOptionArgs {

binary-option/program/src/processor.rs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1-
use crate::{
2-
error::BinaryOptionError,
3-
instruction::BinaryOptionInstruction,
4-
spl_utils::{
5-
spl_approve, spl_burn, spl_burn_signed, spl_initialize, spl_mint_initialize, spl_mint_to,
6-
spl_set_authority, spl_token_transfer, spl_token_transfer_signed,
1+
use {
2+
crate::{
3+
error::BinaryOptionError,
4+
instruction::BinaryOptionInstruction,
5+
spl_utils::{
6+
spl_approve, spl_burn, spl_burn_signed, spl_initialize, spl_mint_initialize,
7+
spl_mint_to, spl_set_authority, spl_token_transfer, spl_token_transfer_signed,
8+
},
9+
state::BinaryOption,
10+
system_utils::{create_new_account, create_or_allocate_account_raw},
11+
validation_utils::{
12+
assert_initialized, assert_keys_equal, assert_keys_unequal, assert_owned_by,
13+
},
714
},
8-
state::BinaryOption,
9-
system_utils::{create_new_account, create_or_allocate_account_raw},
10-
validation_utils::{
11-
assert_initialized, assert_keys_equal, assert_keys_unequal, assert_owned_by,
15+
borsh::BorshDeserialize,
16+
solana_program::{
17+
account_info::{next_account_info, AccountInfo},
18+
entrypoint::ProgramResult,
19+
msg,
20+
program_error::ProgramError,
21+
program_pack::Pack,
22+
pubkey::Pubkey,
23+
},
24+
spl_token::{
25+
instruction::AuthorityType,
26+
state::{Account, Mint},
1227
},
13-
};
14-
use borsh::BorshDeserialize;
15-
use solana_program::{
16-
account_info::{next_account_info, AccountInfo},
17-
entrypoint::ProgramResult,
18-
msg,
19-
program_error::ProgramError,
20-
program_pack::Pack,
21-
pubkey::Pubkey,
22-
};
23-
use spl_token::{
24-
instruction::AuthorityType,
25-
state::{Account, Mint},
2628
};
2729

2830
pub struct Processor;

binary-option/program/src/state.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use solana_program::{
2-
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
3-
pubkey::Pubkey,
1+
use {
2+
crate::error::BinaryOptionError,
3+
borsh::{BorshDeserialize, BorshSerialize},
4+
solana_program::{
5+
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
6+
pubkey::Pubkey,
7+
},
48
};
59

6-
use crate::error::BinaryOptionError;
7-
use borsh::{BorshDeserialize, BorshSerialize};
8-
910
#[repr(C)]
1011
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
1112
pub struct BinaryOption {

binary-oracle-pair/program/src/entrypoint.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
33
#![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]
44

5-
use crate::{error::PoolError, processor};
6-
use solana_program::{
7-
account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
8-
pubkey::Pubkey,
5+
use {
6+
crate::{error::PoolError, processor},
7+
solana_program::{
8+
account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
9+
pubkey::Pubkey,
10+
},
911
};
1012

1113
solana_program::entrypoint!(process_instruction);

binary-oracle-pair/program/src/error.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
//! Error types
22
3-
use num_derive::FromPrimitive;
4-
use num_traits::FromPrimitive;
5-
use solana_program::{
6-
decode_error::DecodeError, msg, program_error::PrintProgramError, program_error::ProgramError,
3+
use {
4+
num_derive::FromPrimitive,
5+
num_traits::FromPrimitive,
6+
solana_program::{
7+
decode_error::DecodeError,
8+
msg,
9+
program_error::{PrintProgramError, ProgramError},
10+
},
11+
thiserror::Error,
712
};
8-
use thiserror::Error;
913

1014
/// Errors that may be returned by the Binary Oracle Pair program.
1115
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]

binary-oracle-pair/program/src/instruction.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
//! Instruction types
22
3-
use borsh::{BorshDeserialize, BorshSerialize};
4-
use solana_program::{
5-
clock::Slot,
6-
instruction::{AccountMeta, Instruction},
7-
program_error::ProgramError,
8-
pubkey::Pubkey,
9-
sysvar,
3+
use {
4+
borsh::{BorshDeserialize, BorshSerialize},
5+
solana_program::{
6+
clock::Slot,
7+
instruction::{AccountMeta, Instruction},
8+
program_error::ProgramError,
9+
pubkey::Pubkey,
10+
sysvar,
11+
},
1012
};
1113

1214
/// Initialize arguments for pool

binary-oracle-pair/program/src/processor.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
//! Program state processor
22
3-
use crate::{
4-
error::PoolError,
5-
instruction::PoolInstruction,
6-
state::{Decision, Pool, POOL_VERSION},
3+
use {
4+
crate::{
5+
error::PoolError,
6+
instruction::PoolInstruction,
7+
state::{Decision, Pool, POOL_VERSION},
8+
},
9+
borsh::BorshDeserialize,
10+
solana_program::{
11+
account_info::{next_account_info, AccountInfo},
12+
clock::{Clock, Slot},
13+
entrypoint::ProgramResult,
14+
msg,
15+
program::{invoke, invoke_signed},
16+
program_error::ProgramError,
17+
program_pack::{IsInitialized, Pack},
18+
pubkey::Pubkey,
19+
rent::Rent,
20+
sysvar::Sysvar,
21+
},
22+
spl_token::state::{Account, Mint},
723
};
8-
use borsh::BorshDeserialize;
9-
use solana_program::{
10-
account_info::next_account_info,
11-
account_info::AccountInfo,
12-
clock::{Clock, Slot},
13-
entrypoint::ProgramResult,
14-
msg,
15-
program::{invoke, invoke_signed},
16-
program_error::ProgramError,
17-
program_pack::{IsInitialized, Pack},
18-
pubkey::Pubkey,
19-
rent::Rent,
20-
sysvar::Sysvar,
21-
};
22-
use spl_token::state::{Account, Mint};
2324

2425
/// Program state handler.
2526
pub struct Processor {}

binary-oracle-pair/program/src/state.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! State transition types
22
3-
use borsh::{BorshDeserialize, BorshSerialize};
4-
use solana_program::pubkey::Pubkey;
3+
use {
4+
borsh::{BorshDeserialize, BorshSerialize},
5+
solana_program::pubkey::Pubkey,
6+
};
57

68
/// Uninitialized version value, all instances are at least version 1
79
pub const UNINITIALIZED_VERSION: u8 = 0;

binary-oracle-pair/program/tests/tests.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
#![cfg(feature = "test-sbf")]
22

3-
use borsh::de::BorshDeserialize;
4-
use solana_program::{hash::Hash, program_pack::Pack, pubkey::Pubkey, system_instruction};
5-
use solana_program_test::*;
6-
use solana_sdk::{
7-
account::Account,
8-
signature::{Keypair, Signer},
9-
transaction::Transaction,
10-
transport::TransportError,
3+
use {
4+
borsh::de::BorshDeserialize,
5+
solana_program::{hash::Hash, program_pack::Pack, pubkey::Pubkey, system_instruction},
6+
solana_program_test::*,
7+
solana_sdk::{
8+
account::Account,
9+
signature::{Keypair, Signer},
10+
transaction::Transaction,
11+
transport::TransportError,
12+
},
13+
spl_binary_oracle_pair::*,
1114
};
12-
use spl_binary_oracle_pair::*;
1315

1416
pub fn program_test() -> ProgramTest {
1517
ProgramTest::new(

examples/rust/custom-heap/src/entrypoint.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
33
#![cfg(not(feature = "no-entrypoint"))]
44

5-
use solana_program::{
6-
account_info::AccountInfo,
7-
entrypoint::{ProgramResult, HEAP_LENGTH, HEAP_START_ADDRESS},
8-
pubkey::Pubkey,
5+
use {
6+
solana_program::{
7+
account_info::AccountInfo,
8+
entrypoint::{ProgramResult, HEAP_LENGTH, HEAP_START_ADDRESS},
9+
pubkey::Pubkey,
10+
},
11+
std::{alloc::Layout, mem::size_of, ptr::null_mut, usize},
912
};
10-
use std::{alloc::Layout, mem::size_of, ptr::null_mut, usize};
1113

1214
/// Developers can implement their own heap by defining their own
1315
/// `#[global_allocator]`. The following implements a dummy for test purposes

feature-proposal/program/src/instruction.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
//! Program instructions
22
3-
use crate::{state::AcceptanceCriteria, *};
4-
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
5-
use solana_program::{
6-
instruction::{AccountMeta, Instruction},
7-
msg,
8-
program_error::ProgramError,
9-
program_pack::{Pack, Sealed},
10-
pubkey::Pubkey,
11-
sysvar,
3+
use {
4+
crate::{state::AcceptanceCriteria, *},
5+
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
6+
solana_program::{
7+
instruction::{AccountMeta, Instruction},
8+
msg,
9+
program_error::ProgramError,
10+
program_pack::{Pack, Sealed},
11+
pubkey::Pubkey,
12+
sysvar,
13+
},
1214
};
1315

1416
/// Instructions supported by the Feature Proposal program

feature-proposal/program/src/processor.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
//! Program state processor
22
3-
use crate::{instruction::*, state::*, *};
4-
use solana_program::{
5-
account_info::{next_account_info, AccountInfo},
6-
clock::Clock,
7-
entrypoint::ProgramResult,
8-
feature::{self, Feature},
9-
msg,
10-
program::{invoke, invoke_signed},
11-
program_error::ProgramError,
12-
pubkey::Pubkey,
13-
rent::Rent,
14-
system_instruction,
15-
sysvar::Sysvar,
3+
use {
4+
crate::{instruction::*, state::*, *},
5+
solana_program::{
6+
account_info::{next_account_info, AccountInfo},
7+
clock::Clock,
8+
entrypoint::ProgramResult,
9+
feature::{self, Feature},
10+
msg,
11+
program::{invoke, invoke_signed},
12+
program_error::ProgramError,
13+
pubkey::Pubkey,
14+
rent::Rent,
15+
system_instruction,
16+
sysvar::Sysvar,
17+
},
1618
};
1719

1820
/// Instruction processor

feature-proposal/program/src/state.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//! Program state
2-
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
3-
use solana_program::{
4-
clock::UnixTimestamp,
5-
msg,
6-
program_error::ProgramError,
7-
program_pack::{Pack, Sealed},
2+
use {
3+
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
4+
solana_program::{
5+
clock::UnixTimestamp,
6+
msg,
7+
program_error::ProgramError,
8+
program_pack::{Pack, Sealed},
9+
},
810
};
911

1012
/// Criteria for accepting a feature proposal

governance/addin-api/src/max_voter_weight.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
//! MaxVoterWeight Addin interface
22
3-
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
4-
use solana_program::{clock::Slot, program_pack::IsInitialized, pubkey::Pubkey};
5-
use spl_governance_tools::account::AccountMaxSize;
3+
use {
4+
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
5+
solana_program::{clock::Slot, program_pack::IsInitialized, pubkey::Pubkey},
6+
spl_governance_tools::account::AccountMaxSize,
7+
};
68

79
/// MaxVoterWeightRecord account
810
/// The account is used as an api interface to provide max voting power to the governance program from external addin contracts

0 commit comments

Comments
 (0)