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

@ -4,7 +4,6 @@ use {
itertools::Itertools,
solana_entry::entry::Entry,
solana_ledger::shred::Shredder,
solana_runtime::blockhash_queue::BlockhashQueue,
solana_sdk::{
hash::Hash,
signature::{Keypair, Signature, Signer},
@ -26,11 +25,6 @@ pub struct BroadcastDuplicatesConfig {
#[derive(Clone)]
pub(super) struct BroadcastDuplicatesRun {
config: BroadcastDuplicatesConfig,
// Local queue for broadcast to track which duplicate blockhashes we've sent
duplicate_queue: BlockhashQueue,
// Buffer for duplicate entries
duplicate_entries_buffer: Vec<Entry>,
last_duplicate_entry_hash: Hash,
current_slot: Slot,
next_shred_index: u32,
shred_version: u16,
@ -50,10 +44,7 @@ impl BroadcastDuplicatesRun {
));
Self {
config,
duplicate_queue: BlockhashQueue::default(),
duplicate_entries_buffer: vec![],
next_shred_index: u32::MAX,
last_duplicate_entry_hash: Hash::default(),
shred_version,
current_slot: 0,
recent_blockhash: None,

View File

@ -32,7 +32,6 @@ pub struct StandardBroadcastRun {
last_datapoint_submit: Arc<AtomicInterval>,
num_batches: usize,
cluster_nodes_cache: Arc<ClusterNodesCache<BroadcastStage>>,
last_peer_update: Arc<AtomicInterval>,
}
impl StandardBroadcastRun {
@ -52,7 +51,6 @@ impl StandardBroadcastRun {
last_datapoint_submit: Arc::default(),
num_batches: 0,
cluster_nodes_cache,
last_peer_update: Arc::new(AtomicInterval::default()),
}
}

View File

@ -1313,7 +1313,7 @@ pub mod test {
}
VoteState::serialize(
&VoteStateVersions::new_current(vote_state),
&mut account.data_as_mut_slice(),
account.data_as_mut_slice(),
)
.expect("serialize state");
(

View File

@ -3535,7 +3535,7 @@ pub mod tests {
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
let bank1 = bank_forks.read().unwrap().get(1).cloned().unwrap();
let mut bank1_progress = progress
let bank1_progress = progress
.entry(bank1.slot())
.or_insert_with(|| ForkProgress::new(bank1.last_blockhash(), None, None, 0, 0));
let shreds = shred_to_insert(
@ -3548,7 +3548,7 @@ pub mod tests {
let res = ReplayStage::replay_blockstore_into_bank(
&bank1,
&blockstore,
&mut bank1_progress,
bank1_progress,
None,
&replay_vote_sender,
&VerifyRecyclers::default(),
@ -3923,7 +3923,7 @@ pub mod tests {
.values()
.cloned()
.collect();
let mut heaviest_subtree_fork_choice = &mut vote_simulator.heaviest_subtree_fork_choice;
let heaviest_subtree_fork_choice = &mut vote_simulator.heaviest_subtree_fork_choice;
let mut latest_validator_votes_for_frozen_banks =
LatestValidatorVotesForFrozenBanks::default();
let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors();
@ -3938,7 +3938,7 @@ pub mod tests {
&VoteTracker::default(),
&ClusterSlots::default(),
&vote_simulator.bank_forks,
&mut heaviest_subtree_fork_choice,
heaviest_subtree_fork_choice,
&mut latest_validator_votes_for_frozen_banks,
);

View File

@ -95,9 +95,9 @@ impl ShredFetchStage {
}
}
stats.shred_count += p.packets.len();
p.packets.iter_mut().for_each(|mut packet| {
p.packets.iter_mut().for_each(|packet| {
Self::process_packet(
&mut packet,
packet,
&mut shreds_received,
&mut stats,
last_root,

View File

@ -29,25 +29,24 @@ mod tests {
#[derive(Debug)]
struct BenchmarkConfig {
pub benchmark_slots: u64,
pub batch_size: u64,
pub max_ledger_shreds: u64,
pub entries_per_slot: u64,
pub stop_size_bytes: u64,
pub stop_size_iterations: u64,
pub pre_generate_data: bool,
pub cleanup_blockstore: bool,
pub emit_cpu_info: bool,
pub assert_compaction: bool,
pub compaction_interval: Option<u64>,
pub no_compaction: bool,
benchmark_slots: u64,
batch_size: u64,
max_ledger_shreds: u64,
entries_per_slot: u64,
stop_size_bytes: u64,
stop_size_iterations: u64,
pre_generate_data: bool,
cleanup_blockstore: bool,
assert_compaction: bool,
compaction_interval: Option<u64>,
no_compaction: bool,
}
#[derive(Clone, Copy, Debug)]
struct CpuStatsInner {
pub cpu_user: f32,
pub cpu_system: f32,
pub cpu_idle: f32,
cpu_user: f32,
cpu_system: f32,
cpu_idle: f32,
}
impl From<CPULoad> for CpuStatsInner {
@ -153,7 +152,6 @@ mod tests {
let stop_size_iterations = read_env("STOP_SIZE_ITERATIONS", DEFAULT_STOP_SIZE_ITERATIONS);
let pre_generate_data = read_env("PRE_GENERATE_DATA", false);
let cleanup_blockstore = read_env("CLEANUP_BLOCKSTORE", true);
let emit_cpu_info = read_env("EMIT_CPU_INFO", true);
// set default to `true` once compaction is merged
let assert_compaction = read_env("ASSERT_COMPACTION", false);
let compaction_interval = match read_env("COMPACTION_INTERVAL", 0) {
@ -171,7 +169,6 @@ mod tests {
stop_size_iterations,
pre_generate_data,
cleanup_blockstore,
emit_cpu_info,
assert_compaction,
compaction_interval,
no_compaction,