Reformat imports to a consistent style for imports

rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
This commit is contained in:
Michael Vines
2021-12-03 09:00:31 -08:00
parent 0ef1b25e4b
commit b8837c04ec
397 changed files with 5990 additions and 5175 deletions

View File

@ -1,20 +1,21 @@
//! config for staking
//! carries variables that the stake program cares about
use bincode::deserialize;
use solana_config_program::{create_config_account, get_config_data};
use solana_sdk::{
account::{AccountSharedData, ReadableAccount, WritableAccount},
genesis_config::GenesisConfig,
instruction::InstructionError,
keyed_account::KeyedAccount,
stake::config::{self, Config},
};
#[deprecated(
since = "1.8.0",
note = "Please use `solana_sdk::stake::config` or `solana_program::stake::config` instead"
)]
pub use solana_sdk::stake::config::*;
use {
bincode::deserialize,
solana_config_program::{create_config_account, get_config_data},
solana_sdk::{
account::{AccountSharedData, ReadableAccount, WritableAccount},
genesis_config::GenesisConfig,
instruction::InstructionError,
keyed_account::KeyedAccount,
stake::config::{self, Config},
},
};
pub fn from<T: ReadableAccount>(account: &T) -> Option<Config> {
get_config_data(account.data())
@ -46,9 +47,7 @@ pub fn add_genesis_account(genesis_config: &mut GenesisConfig) -> u64 {
#[cfg(test)]
mod tests {
use super::*;
use solana_sdk::pubkey::Pubkey;
use std::cell::RefCell;
use {super::*, solana_sdk::pubkey::Pubkey, std::cell::RefCell};
#[test]
fn test() {

View File

@ -1,7 +1,6 @@
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(min_specialization))]
#![allow(clippy::integer_arithmetic)]
use solana_sdk::genesis_config::GenesisConfig;
#[deprecated(
since = "1.8.0",
note = "Please use `solana_sdk::stake::program::id` or `solana_program::stake::program::id` instead"

View File

@ -1,3 +1,8 @@
#[deprecated(
since = "1.8.0",
note = "Please use `solana_sdk::stake::instruction` or `solana_program::stake::instruction` instead"
)]
pub use solana_sdk::stake::instruction::*;
use {
crate::{config, stake_state::StakeAccount},
log::*,
@ -16,12 +21,6 @@ use {
},
};
#[deprecated(
since = "1.8.0",
note = "Please use `solana_sdk::stake::instruction` or `solana_program::stake::instruction` instead"
)]
pub use solana_sdk::stake::instruction::*;
pub fn process_instruction(
first_instruction_account: usize,
data: &[u8],
@ -338,25 +337,27 @@ pub fn process_instruction(
#[cfg(test)]
mod tests {
use super::*;
use crate::stake_state::{Meta, StakeState};
use bincode::serialize;
use solana_program_runtime::invoke_context::{
mock_process_instruction, prepare_mock_invoke_context, InvokeContext,
};
use solana_sdk::{
account::{self, AccountSharedData},
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
rent::Rent,
stake::{
config as stake_config,
instruction::{self, LockupArgs},
state::{Authorized, Lockup, StakeAuthorize},
use {
super::*,
crate::stake_state::{Meta, StakeState},
bincode::serialize,
solana_program_runtime::invoke_context::{
mock_process_instruction, prepare_mock_invoke_context, InvokeContext,
},
sysvar::{stake_history::StakeHistory, Sysvar},
solana_sdk::{
account::{self, AccountSharedData},
instruction::{AccountMeta, Instruction},
pubkey::Pubkey,
rent::Rent,
stake::{
config as stake_config,
instruction::{self, LockupArgs},
state::{Authorized, Lockup, StakeAuthorize},
},
sysvar::{stake_history::StakeHistory, Sysvar},
},
std::{cell::RefCell, rc::Rc, str::FromStr},
};
use std::{cell::RefCell, rc::Rc, str::FromStr};
fn create_default_account() -> Rc<RefCell<AccountSharedData>> {
AccountSharedData::new_ref(0, 0, &Pubkey::new_unique())

View File

@ -3,6 +3,11 @@
//! * keep track of rewards
//! * own mining pools
#[deprecated(
since = "1.8.0",
note = "Please use `solana_sdk::stake::state` or `solana_program::stake::state` instead"
)]
pub use solana_sdk::stake::state::*;
use {
solana_program_runtime::{ic_msg, invoke_context::InvokeContext},
solana_sdk::{
@ -25,12 +30,6 @@ use {
std::{collections::HashSet, convert::TryFrom},
};
#[deprecated(
since = "1.8.0",
note = "Please use `solana_sdk::stake::state` or `solana_program::stake::state` instead"
)]
pub use solana_sdk::stake::state::*;
#[derive(Debug)]
pub enum SkippedReason {
ZeroPoints,
@ -1374,18 +1373,20 @@ fn do_create_account(
#[cfg(test)]
mod tests {
use super::*;
use proptest::prelude::*;
use solana_program_runtime::invoke_context::InvokeContext;
use solana_sdk::{
account::{AccountSharedData, WritableAccount},
clock::UnixTimestamp,
native_token,
pubkey::Pubkey,
system_program,
use {
super::*,
proptest::prelude::*,
solana_program_runtime::invoke_context::InvokeContext,
solana_sdk::{
account::{AccountSharedData, WritableAccount},
clock::UnixTimestamp,
native_token,
pubkey::Pubkey,
system_program,
},
solana_vote_program::vote_state,
std::{cell::RefCell, iter::FromIterator},
};
use solana_vote_program::vote_state;
use std::{cell::RefCell, iter::FromIterator};
#[test]
fn test_authorized_authorize() {