Resolve nightly-2021-10-05 clippy complaints

This commit is contained in:
Michael Vines
2021-10-05 22:24:48 -07:00
parent eb4ce3dfed
commit 7027d56064
53 changed files with 229 additions and 293 deletions

View File

@ -602,8 +602,8 @@ fn do_process_blockstore_from_root(
blockstore
.set_roots(std::iter::once(&start_slot))
.expect("Couldn't set root slot on startup");
} else if !blockstore.is_root(start_slot) {
panic!("starting slot isn't root and can't update due to being secondary blockstore access: {}", start_slot);
} else {
assert!(blockstore.is_root(start_slot), "starting slot isn't root and can't update due to being secondary blockstore access: {}", start_slot);
}
if let Ok(metas) = blockstore.slot_meta_iterator(start_slot) {
@ -1340,8 +1340,8 @@ fn process_single_slot(
blockstore
.set_dead_slot(slot)
.expect("Failed to mark slot as dead in blockstore");
} else if !blockstore.is_dead(slot) {
panic!("Failed slot isn't dead and can't update due to being secondary blockstore access: {}", slot);
} else {
assert!(blockstore.is_dead(slot), "Failed slot isn't dead and can't update due to being secondary blockstore access: {}", slot);
}
err
})?;

View File

@ -721,8 +721,8 @@ impl Shredder {
// 2) Sign coding shreds
PAR_THREAD_POOL.with(|thread_pool| {
thread_pool.borrow().install(|| {
coding_shreds.par_iter_mut().for_each(|mut coding_shred| {
Shredder::sign_shred(keypair, &mut coding_shred);
coding_shreds.par_iter_mut().for_each(|coding_shred| {
Shredder::sign_shred(keypair, coding_shred);
})
})
});
@ -858,7 +858,7 @@ impl Shredder {
if num_coding > 0 && shreds.len() < fec_set_size {
// Let's try recovering missing shreds using erasure
let mut present = &mut vec![true; fec_set_size];
let present = &mut vec![true; fec_set_size];
let mut next_expected_index = first_index;
let mut shred_bufs: Vec<Vec<u8>> = shreds
.into_iter()
@ -871,7 +871,7 @@ impl Shredder {
first_index,
next_expected_index,
index,
&mut present,
present,
);
blocks.push(shred.payload);
next_expected_index = index + 1;
@ -887,7 +887,7 @@ impl Shredder {
first_index,
next_expected_index,
first_index + fec_set_size,
&mut present,
present,
);
shred_bufs.append(&mut pending_shreds);

View File

@ -323,7 +323,7 @@ pub fn sign_shreds_cpu(keypair: &Keypair, batches: &mut [Packets]) {
batches.par_iter_mut().for_each(|p| {
p.packets[..]
.par_iter_mut()
.for_each(|mut p| sign_shred_cpu(keypair, &mut p));
.for_each(|p| sign_shred_cpu(keypair, p));
});
});
inc_new_counter_debug!("ed25519_shred_verify_cpu", count);