Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
chore: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso authored and mvines committed Jun 18, 2021
1 parent 6514096 commit 789f33e
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 83 deletions.
8 changes: 1 addition & 7 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1889,13 +1889,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
pubkey,
output_file,
use_lamports_unit,
} => process_show_account(
&rpc_client,
config,
pubkey,
output_file,
*use_lamports_unit,
),
} => process_show_account(&rpc_client, config, pubkey, output_file, *use_lamports_unit),
CliCommand::Transfer {
amount,
to,
Expand Down
8 changes: 1 addition & 7 deletions core/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,7 @@ impl Tower {
)
.clone();

Self::new(
my_pubkey,
vote_account,
root,
&heaviest_bank,
ledger_path,
)
Self::new(my_pubkey, vote_account, root, &heaviest_bank, ledger_path)
}

pub(crate) fn collect_vote_lockouts<F>(
Expand Down
19 changes: 3 additions & 16 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,7 @@ impl ReplayStage {
)
};

Self::initialize_progress_and_fork_choice(
&root_bank,
frozen_banks,
my_pubkey,
vote_account,
)
Self::initialize_progress_and_fork_choice(&root_bank, frozen_banks, my_pubkey, vote_account)
}

pub(crate) fn initialize_progress_and_fork_choice(
Expand All @@ -777,14 +772,7 @@ impl ReplayStage {
let prev_leader_slot = progress.get_bank_prev_leader_slot(bank);
progress.insert(
bank.slot(),
ForkProgress::new_from_bank(
bank,
my_pubkey,
vote_account,
prev_leader_slot,
0,
0,
),
ForkProgress::new_from_bank(bank, my_pubkey, vote_account, prev_leader_slot, 0, 0),
);
}
let root = root_bank.slot();
Expand Down Expand Up @@ -3107,8 +3095,7 @@ mod tests {
let mut entries =
entry::create_ticks(bank.ticks_per_slot(), hashes_per_tick, blockhash);
let last_entry_hash = entries.last().unwrap().hash;
let tx =
system_transaction::transfer(genesis_keypair, &keypair.pubkey(), 2, blockhash);
let tx = system_transaction::transfer(genesis_keypair, &keypair.pubkey(), 2, blockhash);
let trailing_entry = entry::next_entry(&last_entry_hash, 1, vec![tx]);
entries.push(trailing_entry);
entries_to_test_shreds(entries, slot, slot.saturating_sub(1), true, 0)
Expand Down
8 changes: 1 addition & 7 deletions gossip/src/crds_gossip_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,7 @@ impl CrdsGossipPush {
let need = Self::compute_need(self.num_active, self.active_set.len(), ratio);
let mut new_items = HashMap::new();
let (weights, peers): (Vec<_>, Vec<_>) = self
.push_options(
crds,
self_id,
self_shred_version,
stakes,
gossip_validators,
)
.push_options(crds, self_id, self_shred_version, stakes, gossip_validators)
.into_iter()
.unzip();
if peers.is_empty() {
Expand Down
3 changes: 1 addition & 2 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,7 @@ impl LocalCluster {
let (blockhash, _fee_calculator, _last_valid_slot) = client
.get_recent_blockhash_with_commitment(CommitmentConfig::processed())
.unwrap();
let mut tx =
system_transaction::transfer(source_keypair, dest_pubkey, lamports, blockhash);
let mut tx = system_transaction::transfer(source_keypair, dest_pubkey, lamports, blockhash);
info!(
"executing transfer of {} from {} to {}",
lamports,
Expand Down
5 changes: 1 addition & 4 deletions local-cluster/tests/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2844,10 +2844,7 @@ fn test_hard_fork_invalidates_tower() {
thread.join().unwrap();

// new slots should be rooted after hard-fork cluster relaunch
cluster
.lock()
.unwrap()
.check_for_new_roots(16, "hard fork");
cluster.lock().unwrap().check_for_new_roots(16, "hard fork");
}

#[test]
Expand Down
8 changes: 3 additions & 5 deletions programs/exchange/src/exchange_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,8 @@ impl ExchangeProcessor {

Self::is_account_unallocated(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?;

let mut account = Self::deserialize_account(
keyed_accounts[ACCOUNT_INDEX].try_account_ref_mut()?.data(),
)?;
let mut account =
Self::deserialize_account(keyed_accounts[ACCOUNT_INDEX].try_account_ref_mut()?.data())?;

if &account.owner != keyed_accounts[OWNER_INDEX].unsigned_key() {
error!("Signer does not own account");
Expand Down Expand Up @@ -367,8 +366,7 @@ impl ExchangeProcessor {
return Err(InstructionError::InvalidArgument);
}

let order =
Self::deserialize_order(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?;
let order = Self::deserialize_order(keyed_accounts[ORDER_INDEX].try_account_ref()?.data())?;

if &order.owner != keyed_accounts[OWNER_INDEX].unsigned_key() {
error!("Signer does not own order");
Expand Down
32 changes: 7 additions & 25 deletions runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,11 +1495,8 @@ impl AccountsDb {
.map(|pubkeys: &[Pubkey]| {
let mut reclaims = Vec::new();
for pubkey in pubkeys {
self.accounts_index.clean_rooted_entries(
pubkey,
&mut reclaims,
max_clean_root,
);
self.accounts_index
.clean_rooted_entries(pubkey, &mut reclaims, max_clean_root);
}
reclaims
});
Expand Down Expand Up @@ -9517,10 +9514,7 @@ pub mod tests {

let dummy_id1 = 22;
let entry1 = Arc::new(AccountStorageEntry::new(
dummy_path,
dummy_slot,
dummy_id1,
dummy_size,
dummy_path, dummy_slot, dummy_id1, dummy_size,
));
entry1.alive_bytes.store(8000, Ordering::Relaxed);

Expand All @@ -9531,10 +9525,7 @@ pub mod tests {

let dummy_id2 = 44;
let entry2 = Arc::new(AccountStorageEntry::new(
dummy_path,
dummy_slot,
dummy_id2,
dummy_size,
dummy_path, dummy_slot, dummy_id2, dummy_size,
));
entry2.alive_bytes.store(3000, Ordering::Relaxed);
candidates
Expand All @@ -9553,10 +9544,7 @@ pub mod tests {
let dummy_size = 4 * PAGE_SIZE;
let dummy_id1 = 22;
let entry1 = Arc::new(AccountStorageEntry::new(
dummy_path,
dummy_slot,
dummy_id1,
dummy_size,
dummy_path, dummy_slot, dummy_id1, dummy_size,
));
entry1.alive_bytes.store(3500, Ordering::Relaxed);

Expand Down Expand Up @@ -11037,18 +11025,12 @@ pub mod tests {

let dummy_id1 = 22;
let entry1 = Arc::new(AccountStorageEntry::new(
dummy_path,
dummy_slot,
dummy_id1,
dummy_size,
dummy_path, dummy_slot, dummy_id1, dummy_size,
));

let dummy_id2 = 44;
let entry2 = Arc::new(AccountStorageEntry::new(
dummy_path,
dummy_slot,
dummy_id2,
dummy_size,
dummy_path, dummy_slot, dummy_id2, dummy_size,
));

let mut recycle_stores = RecycleStores::default();
Expand Down
3 changes: 1 addition & 2 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7320,8 +7320,7 @@ pub(crate) mod tests {
.map(move |(_stake_pubkey, stake_account)| (stake_account, vote_account))
})
.map(|(stake_account, vote_account)| {
stake_state::calculate_points(stake_account, vote_account, None, true)
.unwrap_or(0)
stake_state::calculate_points(stake_account, vote_account, None, true).unwrap_or(0)
})
.sum();

Expand Down
6 changes: 2 additions & 4 deletions sdk/program/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,8 @@ impl Message {
nonce_account_pubkey: &Pubkey,
nonce_authority_pubkey: &Pubkey,
) -> Self {
let nonce_ix = system_instruction::advance_nonce_account(
nonce_account_pubkey,
nonce_authority_pubkey,
);
let nonce_ix =
system_instruction::advance_nonce_account(nonce_account_pubkey, nonce_authority_pubkey);
instructions.insert(0, nonce_ix);
Self::new(&instructions, payer)
}
Expand Down
7 changes: 3 additions & 4 deletions upload-perf/src/upload-perf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ fn main() {
*/

}
let last_median = get_last_metrics(&"median".to_string(), &db, &name, branch)
let last_median =
get_last_metrics(&"median".to_string(), &db, &name, branch).unwrap_or_default();
let last_deviation = get_last_metrics(&"deviation".to_string(), &db, &name, branch)
.unwrap_or_default();
let last_deviation =
get_last_metrics(&"deviation".to_string(), &db, &name, branch)
.unwrap_or_default();

results.insert(name, (median, deviation, last_median, last_deviation));
}
Expand Down

0 comments on commit 789f33e

Please sign in to comment.