Skip to content

Commit

Permalink
rustfmt: format imports
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Nov 7, 2023
1 parent f18fead commit f1571f5
Show file tree
Hide file tree
Showing 251 changed files with 2,685 additions and 2,513 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

mod program_test;

#[allow(deprecated)]
use spl_associated_token_account::create_associated_token_account as deprecated_create_associated_token_account;
use {
program_test::program_test,
solana_program::pubkey::Pubkey,
Expand All @@ -14,9 +16,6 @@ use {
spl_token::state::Account,
};

#[allow(deprecated)]
use spl_associated_token_account::create_associated_token_account as deprecated_create_associated_token_account;

#[tokio::test]
async fn success_create() {
let wallet_address = Pubkey::new_unique();
Expand Down
7 changes: 4 additions & 3 deletions binary-option/program/src/entrypoint.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]

use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};

use crate::processor::Processor;
use {
crate::processor::Processor,
solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey},
};

solana_program::entrypoint!(process_instruction);
fn process_instruction(
Expand Down
4 changes: 1 addition & 3 deletions binary-option/program/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use thiserror::Error;

use solana_program::program_error::ProgramError;
use {solana_program::program_error::ProgramError, thiserror::Error};

#[derive(Error, Debug, Copy, Clone)]
pub enum BinaryOptionError {
Expand Down
13 changes: 7 additions & 6 deletions binary-option/program/src/instruction.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use solana_program::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
sysvar,
use {
borsh::{BorshDeserialize, BorshSerialize},
solana_program::{
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
sysvar,
},
};

use borsh::{BorshDeserialize, BorshSerialize};

#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug, Clone)]
pub struct InitializeBinaryOptionArgs {
Expand Down
48 changes: 25 additions & 23 deletions binary-option/program/src/processor.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
use crate::{
error::BinaryOptionError,
instruction::BinaryOptionInstruction,
spl_utils::{
spl_approve, spl_burn, spl_burn_signed, spl_initialize, spl_mint_initialize, spl_mint_to,
spl_set_authority, spl_token_transfer, spl_token_transfer_signed,
use {
crate::{
error::BinaryOptionError,
instruction::BinaryOptionInstruction,
spl_utils::{
spl_approve, spl_burn, spl_burn_signed, spl_initialize, spl_mint_initialize,
spl_mint_to, spl_set_authority, spl_token_transfer, spl_token_transfer_signed,
},
state::BinaryOption,
system_utils::{create_new_account, create_or_allocate_account_raw},
validation_utils::{
assert_initialized, assert_keys_equal, assert_keys_unequal, assert_owned_by,
},
},
state::BinaryOption,
system_utils::{create_new_account, create_or_allocate_account_raw},
validation_utils::{
assert_initialized, assert_keys_equal, assert_keys_unequal, assert_owned_by,
borsh::BorshDeserialize,
solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
msg,
program_error::ProgramError,
program_pack::Pack,
pubkey::Pubkey,
},
spl_token::{
instruction::AuthorityType,
state::{Account, Mint},
},
};
use borsh::BorshDeserialize;
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint::ProgramResult,
msg,
program_error::ProgramError,
program_pack::Pack,
pubkey::Pubkey,
};
use spl_token::{
instruction::AuthorityType,
state::{Account, Mint},
};

pub struct Processor;
Expand Down
13 changes: 7 additions & 6 deletions binary-option/program/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
pubkey::Pubkey,
use {
crate::error::BinaryOptionError,
borsh::{BorshDeserialize, BorshSerialize},
solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::ProgramError,
pubkey::Pubkey,
},
};

use crate::error::BinaryOptionError;
use borsh::{BorshDeserialize, BorshSerialize};

#[repr(C)]
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
pub struct BinaryOption {
Expand Down
10 changes: 6 additions & 4 deletions binary-oracle-pair/program/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

#![cfg(all(target_os = "solana", not(feature = "no-entrypoint")))]

use crate::{error::PoolError, processor};
use solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
pubkey::Pubkey,
use {
crate::{error::PoolError, processor},
solana_program::{
account_info::AccountInfo, entrypoint::ProgramResult, program_error::PrintProgramError,
pubkey::Pubkey,
},
};

solana_program::entrypoint!(process_instruction);
Expand Down
14 changes: 9 additions & 5 deletions binary-oracle-pair/program/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
//! Error types

use num_derive::FromPrimitive;
use num_traits::FromPrimitive;
use solana_program::{
decode_error::DecodeError, msg, program_error::PrintProgramError, program_error::ProgramError,
use {
num_derive::FromPrimitive,
num_traits::FromPrimitive,
solana_program::{
decode_error::DecodeError,
msg,
program_error::{PrintProgramError, ProgramError},
},
thiserror::Error,
};
use thiserror::Error;

/// Errors that may be returned by the Binary Oracle Pair program.
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
Expand Down
16 changes: 9 additions & 7 deletions binary-oracle-pair/program/src/instruction.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//! Instruction types

use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
clock::Slot,
instruction::{AccountMeta, Instruction},
program_error::ProgramError,
pubkey::Pubkey,
sysvar,
use {
borsh::{BorshDeserialize, BorshSerialize},
solana_program::{
clock::Slot,
instruction::{AccountMeta, Instruction},
program_error::ProgramError,
pubkey::Pubkey,
sysvar,
},
};

/// Initialize arguments for pool
Expand Down
39 changes: 20 additions & 19 deletions binary-oracle-pair/program/src/processor.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
//! Program state processor

use crate::{
error::PoolError,
instruction::PoolInstruction,
state::{Decision, Pool, POOL_VERSION},
use {
crate::{
error::PoolError,
instruction::PoolInstruction,
state::{Decision, Pool, POOL_VERSION},
},
borsh::BorshDeserialize,
solana_program::{
account_info::{next_account_info, AccountInfo},
clock::{Clock, Slot},
entrypoint::ProgramResult,
msg,
program::{invoke, invoke_signed},
program_error::ProgramError,
program_pack::{IsInitialized, Pack},
pubkey::Pubkey,
rent::Rent,
sysvar::Sysvar,
},
spl_token::state::{Account, Mint},
};
use borsh::BorshDeserialize;
use solana_program::{
account_info::next_account_info,
account_info::AccountInfo,
clock::{Clock, Slot},
entrypoint::ProgramResult,
msg,
program::{invoke, invoke_signed},
program_error::ProgramError,
program_pack::{IsInitialized, Pack},
pubkey::Pubkey,
rent::Rent,
sysvar::Sysvar,
};
use spl_token::state::{Account, Mint};

/// Program state handler.
pub struct Processor {}
Expand Down
6 changes: 4 additions & 2 deletions binary-oracle-pair/program/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//! State transition types

use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::pubkey::Pubkey;
use {
borsh::{BorshDeserialize, BorshSerialize},
solana_program::pubkey::Pubkey,
};

/// Uninitialized version value, all instances are at least version 1
pub const UNINITIALIZED_VERSION: u8 = 0;
Expand Down
20 changes: 11 additions & 9 deletions binary-oracle-pair/program/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#![cfg(feature = "test-sbf")]

use borsh::de::BorshDeserialize;
use solana_program::{hash::Hash, program_pack::Pack, pubkey::Pubkey, system_instruction};
use solana_program_test::*;
use solana_sdk::{
account::Account,
signature::{Keypair, Signer},
transaction::Transaction,
transport::TransportError,
use {
borsh::de::BorshDeserialize,
solana_program::{hash::Hash, program_pack::Pack, pubkey::Pubkey, system_instruction},
solana_program_test::*,
solana_sdk::{
account::Account,
signature::{Keypair, Signer},
transaction::Transaction,
transport::TransportError,
},
spl_binary_oracle_pair::*,
};
use spl_binary_oracle_pair::*;

pub fn program_test() -> ProgramTest {
ProgramTest::new(
Expand Down
12 changes: 7 additions & 5 deletions examples/rust/custom-heap/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

#![cfg(not(feature = "no-entrypoint"))]

use solana_program::{
account_info::AccountInfo,
entrypoint::{ProgramResult, HEAP_LENGTH, HEAP_START_ADDRESS},
pubkey::Pubkey,
use {
solana_program::{
account_info::AccountInfo,
entrypoint::{ProgramResult, HEAP_LENGTH, HEAP_START_ADDRESS},
pubkey::Pubkey,
},
std::{alloc::Layout, mem::size_of, ptr::null_mut, usize},
};
use std::{alloc::Layout, mem::size_of, ptr::null_mut, usize};

/// Developers can implement their own heap by defining their own
/// `#[global_allocator]`. The following implements a dummy for test purposes
Expand Down
20 changes: 11 additions & 9 deletions feature-proposal/program/src/instruction.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
//! Program instructions

use crate::{state::AcceptanceCriteria, *};
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use solana_program::{
instruction::{AccountMeta, Instruction},
msg,
program_error::ProgramError,
program_pack::{Pack, Sealed},
pubkey::Pubkey,
sysvar,
use {
crate::{state::AcceptanceCriteria, *},
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
solana_program::{
instruction::{AccountMeta, Instruction},
msg,
program_error::ProgramError,
program_pack::{Pack, Sealed},
pubkey::Pubkey,
sysvar,
},
};

/// Instructions supported by the Feature Proposal program
Expand Down
28 changes: 15 additions & 13 deletions feature-proposal/program/src/processor.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
//! Program state processor

use crate::{instruction::*, state::*, *};
use solana_program::{
account_info::{next_account_info, AccountInfo},
clock::Clock,
entrypoint::ProgramResult,
feature::{self, Feature},
msg,
program::{invoke, invoke_signed},
program_error::ProgramError,
pubkey::Pubkey,
rent::Rent,
system_instruction,
sysvar::Sysvar,
use {
crate::{instruction::*, state::*, *},
solana_program::{
account_info::{next_account_info, AccountInfo},
clock::Clock,
entrypoint::ProgramResult,
feature::{self, Feature},
msg,
program::{invoke, invoke_signed},
program_error::ProgramError,
pubkey::Pubkey,
rent::Rent,
system_instruction,
sysvar::Sysvar,
},
};

/// Instruction processor
Expand Down
14 changes: 8 additions & 6 deletions feature-proposal/program/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//! Program state
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use solana_program::{
clock::UnixTimestamp,
msg,
program_error::ProgramError,
program_pack::{Pack, Sealed},
use {
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
solana_program::{
clock::UnixTimestamp,
msg,
program_error::ProgramError,
program_pack::{Pack, Sealed},
},
};

/// Criteria for accepting a feature proposal
Expand Down
8 changes: 5 additions & 3 deletions governance/addin-api/src/max_voter_weight.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//! MaxVoterWeight Addin interface

use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use solana_program::{clock::Slot, program_pack::IsInitialized, pubkey::Pubkey};
use spl_governance_tools::account::AccountMaxSize;
use {
borsh::{BorshDeserialize, BorshSchema, BorshSerialize},
solana_program::{clock::Slot, program_pack::IsInitialized, pubkey::Pubkey},
spl_governance_tools::account::AccountMaxSize,
};

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

0 comments on commit f1571f5

Please sign in to comment.