clippy
This commit is contained in:
@@ -216,7 +216,7 @@ impl AccountsCache {
|
||||
// we return all slots <= `max_root`
|
||||
std::mem::replace(&mut w_maybe_unflushed_roots, greater_than_max_root)
|
||||
} else {
|
||||
std::mem::replace(&mut *w_maybe_unflushed_roots, BTreeSet::new())
|
||||
std::mem::take(&mut *w_maybe_unflushed_roots)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2109,10 +2109,7 @@ impl AccountsDb {
|
||||
}
|
||||
|
||||
pub fn shrink_candidate_slots(&self) -> usize {
|
||||
let shrink_slots = std::mem::replace(
|
||||
&mut *self.shrink_candidate_slots.lock().unwrap(),
|
||||
HashMap::new(),
|
||||
);
|
||||
let shrink_slots = std::mem::take(&mut *self.shrink_candidate_slots.lock().unwrap());
|
||||
let num_candidates = shrink_slots.len();
|
||||
for (slot, slot_shrink_candidates) in shrink_slots {
|
||||
let mut measure = Measure::start("shrink_candidate_slots-ms");
|
||||
@@ -6681,7 +6678,7 @@ pub mod tests {
|
||||
let mint_key = Pubkey::new_unique();
|
||||
let mut account_data_with_mint =
|
||||
vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
|
||||
account_data_with_mint[..PUBKEY_BYTES].clone_from_slice(&(mint_key.clone().to_bytes()));
|
||||
account_data_with_mint[..PUBKEY_BYTES].clone_from_slice(&(mint_key.to_bytes()));
|
||||
|
||||
let mut normal_account = AccountSharedData::new(1, 0, &AccountSharedData::default().owner);
|
||||
normal_account.owner = inline_spl_token_v2_0::id();
|
||||
|
@@ -2358,7 +2358,7 @@ pub mod tests {
|
||||
let account_key = Pubkey::new_unique();
|
||||
|
||||
let mut account_data = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
|
||||
account_data[key_start..key_end].clone_from_slice(&(index_key.clone().to_bytes()));
|
||||
account_data[key_start..key_end].clone_from_slice(&(index_key.to_bytes()));
|
||||
|
||||
// Insert slots into secondary index
|
||||
for slot in &slots {
|
||||
@@ -2583,7 +2583,7 @@ pub mod tests {
|
||||
let index_key = Pubkey::new_unique();
|
||||
let slot = 1;
|
||||
let mut account_data = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
|
||||
account_data[key_start..key_end].clone_from_slice(&(index_key.clone().to_bytes()));
|
||||
account_data[key_start..key_end].clone_from_slice(&(index_key.to_bytes()));
|
||||
|
||||
// Wrong program id
|
||||
index.upsert(
|
||||
@@ -2675,10 +2675,10 @@ pub mod tests {
|
||||
let slot = 1;
|
||||
let mut account_data1 = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
|
||||
account_data1[index_key_start..index_key_end]
|
||||
.clone_from_slice(&(secondary_key1.clone().to_bytes()));
|
||||
.clone_from_slice(&(secondary_key1.to_bytes()));
|
||||
let mut account_data2 = vec![0; inline_spl_token_v2_0::state::Account::get_packed_len()];
|
||||
account_data2[index_key_start..index_key_end]
|
||||
.clone_from_slice(&(secondary_key2.clone().to_bytes()));
|
||||
.clone_from_slice(&(secondary_key2.to_bytes()));
|
||||
|
||||
// First write one mint index
|
||||
index.upsert(
|
||||
|
@@ -70,8 +70,8 @@ impl BlockCommitmentCache {
|
||||
) -> Self {
|
||||
Self {
|
||||
block_commitment,
|
||||
total_stake,
|
||||
commitment_slots,
|
||||
total_stake,
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -99,8 +99,8 @@ pub fn create_genesis_config_with_vote_accounts_and_cluster_type(
|
||||
|
||||
let mut genesis_config_info = GenesisConfigInfo {
|
||||
genesis_config,
|
||||
voting_keypair,
|
||||
mint_keypair,
|
||||
voting_keypair,
|
||||
};
|
||||
|
||||
for (validator_voting_keypairs, stake) in voting_keypairs[1..].iter().zip(&stakes[1..]) {
|
||||
@@ -156,8 +156,8 @@ pub fn create_genesis_config_with_leader(
|
||||
|
||||
GenesisConfigInfo {
|
||||
genesis_config,
|
||||
voting_keypair,
|
||||
mint_keypair,
|
||||
voting_keypair,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user