clippy
This commit is contained in:
parent
01262cda3f
commit
eefcf484cb
|
@ -179,19 +179,13 @@ where
|
|||
|
||||
info!("Generating {:?} account keys", total_keys);
|
||||
let mut account_keypairs = generate_keypairs(total_keys);
|
||||
let src_keypairs: Vec<_> = account_keypairs
|
||||
.drain(0..accounts_in_groups)
|
||||
.map(|keypair| keypair)
|
||||
.collect();
|
||||
let src_keypairs: Vec<_> = account_keypairs.drain(0..accounts_in_groups).collect();
|
||||
let src_pubkeys: Vec<Pubkey> = src_keypairs
|
||||
.iter()
|
||||
.map(|keypair| keypair.pubkey())
|
||||
.collect();
|
||||
|
||||
let profit_keypairs: Vec<_> = account_keypairs
|
||||
.drain(0..accounts_in_groups)
|
||||
.map(|keypair| keypair)
|
||||
.collect();
|
||||
let profit_keypairs: Vec<_> = account_keypairs.drain(0..accounts_in_groups).collect();
|
||||
let profit_pubkeys: Vec<Pubkey> = profit_keypairs
|
||||
.iter()
|
||||
.map(|keypair| keypair.pubkey())
|
||||
|
|
|
@ -780,7 +780,7 @@ impl ClusterInfo {
|
|||
.crds
|
||||
.table
|
||||
.values()
|
||||
.filter_map(|x| x.value.snapshot_hash().map(|v| v))
|
||||
.filter_map(|x| x.value.snapshot_hash())
|
||||
.filter_map(|x| {
|
||||
for (table_slot, hash) in &x.hashes {
|
||||
if *table_slot == slot {
|
||||
|
|
|
@ -160,7 +160,6 @@ pub fn get_multi_client(nodes: &[ContactInfo]) -> (ThinClient, usize) {
|
|||
let addrs: Vec<_> = nodes
|
||||
.iter()
|
||||
.filter_map(ContactInfo::valid_client_facing_addr)
|
||||
.map(|addrs| addrs)
|
||||
.collect();
|
||||
let rpc_addrs: Vec<_> = addrs.iter().map(|addr| addr.0).collect();
|
||||
let tpu_addrs: Vec<_> = addrs.iter().map(|addr| addr.1).collect();
|
||||
|
|
|
@ -202,7 +202,7 @@ fn run_simulation(stakes: &[u64], fanout: usize) {
|
|||
#[test]
|
||||
#[serial]
|
||||
fn test_retransmit_small() {
|
||||
let stakes: Vec<_> = (0..200).map(|i| i).collect();
|
||||
let stakes: Vec<_> = (0..200).collect();
|
||||
run_simulation(&stakes, 200);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ fn test_retransmit_small() {
|
|||
#[serial]
|
||||
fn test_retransmit_medium() {
|
||||
let num_nodes = 2000;
|
||||
let stakes: Vec<_> = (0..num_nodes).map(|i| i).collect();
|
||||
let stakes: Vec<_> = (0..num_nodes).collect();
|
||||
run_simulation(&stakes, 200);
|
||||
}
|
||||
|
||||
|
@ -229,6 +229,6 @@ fn test_retransmit_medium_equal_stakes() {
|
|||
#[serial]
|
||||
fn test_retransmit_large() {
|
||||
let num_nodes = 4000;
|
||||
let stakes: Vec<_> = (0..num_nodes).map(|i| i).collect();
|
||||
let stakes: Vec<_> = (0..num_nodes).collect();
|
||||
run_simulation(&stakes, 2);
|
||||
}
|
||||
|
|
|
@ -2170,11 +2170,7 @@ impl Blockstore {
|
|||
}
|
||||
|
||||
pub fn is_root(&self, slot: Slot) -> bool {
|
||||
if let Ok(Some(true)) = self.db.get::<cf::Root>(slot) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
matches!(self.db.get::<cf::Root>(slot), Ok(Some(true)))
|
||||
}
|
||||
|
||||
pub fn set_roots(&self, rooted_slots: &[u64]) -> Result<()> {
|
||||
|
@ -2194,15 +2190,12 @@ impl Blockstore {
|
|||
}
|
||||
|
||||
pub fn is_dead(&self, slot: Slot) -> bool {
|
||||
if let Some(true) = self
|
||||
.db
|
||||
.get::<cf::DeadSlots>(slot)
|
||||
.expect("fetch from DeadSlots column family failed")
|
||||
{
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
matches!(
|
||||
self.db
|
||||
.get::<cf::DeadSlots>(slot)
|
||||
.expect("fetch from DeadSlots column family failed"),
|
||||
Some(true)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn set_dead_slot(&self, slot: Slot) -> Result<()> {
|
||||
|
|
|
@ -58,10 +58,7 @@ impl<'a> Proof<'a> {
|
|||
None
|
||||
}
|
||||
});
|
||||
match result {
|
||||
Some(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(result, Some(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1519,13 +1519,9 @@ impl AccountsDB {
|
|||
hashes = new_hashes.chunks(fanout).map(|x| x.to_vec()).collect();
|
||||
}
|
||||
let mut hasher = Hasher::default();
|
||||
hashes
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|hash| hash)
|
||||
.for_each(|hash| {
|
||||
hasher.hash(hash.as_ref());
|
||||
});
|
||||
hashes.into_iter().flatten().for_each(|hash| {
|
||||
hasher.hash(hash.as_ref());
|
||||
});
|
||||
hasher.result()
|
||||
}
|
||||
|
||||
|
|
|
@ -198,10 +198,7 @@ pub enum HashAgeKind {
|
|||
|
||||
impl HashAgeKind {
|
||||
pub fn is_durable_nonce(&self) -> bool {
|
||||
match self {
|
||||
HashAgeKind::DurableNonce(_, _) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, HashAgeKind::DurableNonce(_, _))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,8 @@ pub fn transaction_uses_durable_nonce(tx: &Transaction) -> Option<&CompiledInstr
|
|||
Some(program_id) => system_program::check_id(&program_id),
|
||||
_ => false,
|
||||
}
|
||||
} && match limited_deserialize(&maybe_ix.data) {
|
||||
Ok(SystemInstruction::AdvanceNonceAccount) => true,
|
||||
_ => false,
|
||||
})
|
||||
} && matches!(limited_deserialize(&maybe_ix.data), Ok(SystemInstruction::AdvanceNonceAccount))
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_nonce_pubkey_from_instruction<'a>(
|
||||
|
|
Loading…
Reference in New Issue