removes erroneous allow(dead_code) annotations from core (#26660)

This commit is contained in:
behzad nouri 2022-07-18 17:15:47 +00:00 committed by GitHub
parent 18e9225a75
commit 2dd8573287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 16 deletions

View File

@ -114,12 +114,11 @@ pub type Stake = u64;
pub type VotedStakes = HashMap<Slot, Stake>; pub type VotedStakes = HashMap<Slot, Stake>;
pub type PubkeyVotes = Vec<(Pubkey, Slot)>; pub type PubkeyVotes = Vec<(Pubkey, Slot)>;
// lint warning "bank_weight is never read"
#[allow(dead_code)]
pub(crate) struct ComputedBankState { pub(crate) struct ComputedBankState {
pub voted_stakes: VotedStakes, pub voted_stakes: VotedStakes,
pub total_stake: Stake, pub total_stake: Stake,
pub bank_weight: u128, #[allow(dead_code)]
bank_weight: u128,
// Tree of intervals of lockouts of the form [slot, slot + slot.lockout], // Tree of intervals of lockouts of the form [slot, slot + slot.lockout],
// keyed by end of the range // keyed by end of the range
pub lockout_intervals: LockoutIntervals, pub lockout_intervals: LockoutIntervals,

View File

@ -14,15 +14,10 @@ use {
crossbeam_channel::{Receiver as CrossbeamReceiver, Sender as CrossbeamSender}, crossbeam_channel::{Receiver as CrossbeamReceiver, Sender as CrossbeamSender},
lru::LruCache, lru::LruCache,
solana_gossip::cluster_info::ClusterInfo, solana_gossip::cluster_info::ClusterInfo,
solana_ledger::{ solana_ledger::blockstore::{Blockstore, SlotMeta},
blockstore::{Blockstore, SlotMeta},
shred::Nonce,
},
solana_measure::measure::Measure, solana_measure::measure::Measure,
solana_runtime::{bank_forks::BankForks, contains::Contains}, solana_runtime::{bank_forks::BankForks, contains::Contains},
solana_sdk::{ solana_sdk::{clock::Slot, epoch_schedule::EpochSchedule, hash::Hash, pubkey::Pubkey},
clock::Slot, epoch_schedule::EpochSchedule, hash::Hash, pubkey::Pubkey, timing::timestamp,
},
solana_streamer::sendmmsg::{batch_send, SendPktsError}, solana_streamer::sendmmsg::{batch_send, SendPktsError},
std::{ std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
@ -36,6 +31,8 @@ use {
time::{Duration, Instant}, time::{Duration, Instant},
}, },
}; };
#[cfg(test)]
use {solana_ledger::shred::Nonce, solana_sdk::timing::timestamp};
pub type DuplicateSlotsResetSender = CrossbeamSender<Vec<(Slot, Hash)>>; pub type DuplicateSlotsResetSender = CrossbeamSender<Vec<(Slot, Hash)>>;
pub type DuplicateSlotsResetReceiver = CrossbeamReceiver<Vec<(Slot, Hash)>>; pub type DuplicateSlotsResetReceiver = CrossbeamReceiver<Vec<(Slot, Hash)>>;
@ -570,7 +567,7 @@ impl RepairService {
} }
} }
#[cfg_attr(not(test), allow(dead_code))] #[cfg(test)]
fn generate_duplicate_repairs_for_slot( fn generate_duplicate_repairs_for_slot(
blockstore: &Blockstore, blockstore: &Blockstore,
slot: Slot, slot: Slot,
@ -595,7 +592,7 @@ impl RepairService {
} }
} }
#[cfg_attr(not(test), allow(dead_code))] #[cfg(test)]
fn generate_and_send_duplicate_repairs( fn generate_and_send_duplicate_repairs(
duplicate_slot_repair_statuses: &mut HashMap<Slot, DuplicateSlotRepairStatus>, duplicate_slot_repair_statuses: &mut HashMap<Slot, DuplicateSlotRepairStatus>,
cluster_slots: &ClusterSlots, cluster_slots: &ClusterSlots,
@ -646,7 +643,7 @@ impl RepairService {
}) })
} }
#[cfg_attr(not(test), allow(dead_code))] #[cfg(test)]
fn serialize_and_send_request( fn serialize_and_send_request(
repair_type: &ShredRepairType, repair_type: &ShredRepairType,
repair_socket: &UdpSocket, repair_socket: &UdpSocket,
@ -662,7 +659,7 @@ impl RepairService {
Ok(()) Ok(())
} }
#[cfg_attr(not(test), allow(dead_code))] #[cfg(test)]
fn update_duplicate_slot_repair_addr( fn update_duplicate_slot_repair_addr(
slot: Slot, slot: Slot,
status: &mut DuplicateSlotRepairStatus, status: &mut DuplicateSlotRepairStatus,
@ -684,6 +681,7 @@ impl RepairService {
} }
} }
#[cfg(test)]
#[allow(dead_code)] #[allow(dead_code)]
fn initiate_repair_for_duplicate_slot( fn initiate_repair_for_duplicate_slot(
slot: Slot, slot: Slot,

View File

@ -12,8 +12,7 @@ pub struct UnfrozenGossipVerifiedVoteHashes {
impl UnfrozenGossipVerifiedVoteHashes { impl UnfrozenGossipVerifiedVoteHashes {
// Update `latest_validator_votes_for_frozen_banks` if gossip has seen a newer vote // Update `latest_validator_votes_for_frozen_banks` if gossip has seen a newer vote
// for a frozen bank. // for a frozen bank.
#[allow(dead_code)] pub(crate) fn add_vote(
pub fn add_vote(
&mut self, &mut self,
pubkey: Pubkey, pubkey: Pubkey,
vote_slot: Slot, vote_slot: Slot,