Resolve nightly-2021-10-05 clippy complaints
This commit is contained in:
@ -926,9 +926,9 @@ impl Accounts {
|
||||
let keys: Vec<_> = txs
|
||||
.map(|tx| tx.get_account_locks(demote_program_write_locks))
|
||||
.collect();
|
||||
let mut account_locks = &mut self.account_locks.lock().unwrap();
|
||||
let account_locks = &mut self.account_locks.lock().unwrap();
|
||||
keys.into_iter()
|
||||
.map(|keys| self.lock_account(&mut account_locks, keys.writable, keys.readonly))
|
||||
.map(|keys| self.lock_account(account_locks, keys.writable, keys.readonly))
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,7 @@ struct GenerateIndexTimings {
|
||||
pub insertion_time_us: u64,
|
||||
pub min_bin_size: usize,
|
||||
pub max_bin_size: usize,
|
||||
#[allow(dead_code)]
|
||||
pub total_items: usize,
|
||||
pub storage_size_accounts_map_us: u64,
|
||||
pub storage_size_storages_us: u64,
|
||||
@ -971,11 +972,13 @@ pub struct AccountsDb {
|
||||
|
||||
// used by tests
|
||||
// holds this until we are dropped
|
||||
#[allow(dead_code)]
|
||||
temp_accounts_hash_cache_path: Option<TempDir>,
|
||||
|
||||
pub shrink_paths: RwLock<Option<Vec<PathBuf>>>,
|
||||
|
||||
/// Directory of paths this accounts_db needs to hold/remove
|
||||
#[allow(dead_code)]
|
||||
pub(crate) temp_paths: Option<Vec<TempDir>>,
|
||||
|
||||
/// Starting file size of appendvecs
|
||||
@ -1168,9 +1171,13 @@ impl PurgeStats {
|
||||
|
||||
#[derive(Debug)]
|
||||
struct FlushStats {
|
||||
#[allow(dead_code)]
|
||||
slot: Slot,
|
||||
#[allow(dead_code)]
|
||||
num_flushed: usize,
|
||||
#[allow(dead_code)]
|
||||
num_purged: usize,
|
||||
#[allow(dead_code)]
|
||||
total_size: u64,
|
||||
}
|
||||
|
||||
@ -3636,10 +3643,10 @@ impl AccountsDb {
|
||||
Self::page_align(size),
|
||||
));
|
||||
|
||||
if store.append_vec_id() == CACHE_VIRTUAL_STORAGE_ID {
|
||||
panic!("We've run out of storage ids!");
|
||||
}
|
||||
|
||||
assert!(
|
||||
store.append_vec_id() != CACHE_VIRTUAL_STORAGE_ID,
|
||||
"We've run out of storage ids!"
|
||||
);
|
||||
debug!(
|
||||
"creating store: {} slot: {} len: {} size: {} from: {} path: {:?}",
|
||||
store.append_vec_id(),
|
||||
@ -11734,11 +11741,10 @@ pub mod tests {
|
||||
let slot_accounts = accounts_db.scan_account_storage(
|
||||
*slot as Slot,
|
||||
|loaded_account: LoadedAccount| {
|
||||
if is_cache_at_limit {
|
||||
panic!(
|
||||
"When cache is at limit, all roots should have been flushed to storage"
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
!is_cache_at_limit,
|
||||
"When cache is at limit, all roots should have been flushed to storage"
|
||||
);
|
||||
// All slots <= requested_flush_root should have been flushed, regardless
|
||||
// of ongoing scans
|
||||
assert!(*slot > requested_flush_root);
|
||||
|
@ -680,7 +680,7 @@ impl AccountsHash {
|
||||
max_bin: usize,
|
||||
) -> (Hash, u64, PreviousPass) {
|
||||
let (mut hashes, mut total_lamports) =
|
||||
Self::de_dup_and_eliminate_zeros(data_sections_by_pubkey, &mut stats, max_bin);
|
||||
Self::de_dup_and_eliminate_zeros(data_sections_by_pubkey, stats, max_bin);
|
||||
|
||||
total_lamports += previous_state.lamports;
|
||||
|
||||
|
@ -732,7 +732,6 @@ type AccountMapsReadLock<'a, T> = RwLockReadGuard<'a, MapType<T>>;
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ScanSlotTracker {
|
||||
is_removed: bool,
|
||||
ref_count: u64,
|
||||
}
|
||||
|
||||
impl ScanSlotTracker {
|
||||
|
@ -685,6 +685,7 @@ pub(crate) struct BankFieldsToDeserialize {
|
||||
pub(crate) ns_per_slot: u128,
|
||||
pub(crate) genesis_creation_time: UnixTimestamp,
|
||||
pub(crate) slots_per_year: f64,
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unused: u64,
|
||||
pub(crate) slot: Slot,
|
||||
pub(crate) epoch: Epoch,
|
||||
@ -2902,9 +2903,11 @@ impl Bank {
|
||||
self.fee_calculator = self.fee_rate_governor.create_fee_calculator();
|
||||
|
||||
for (pubkey, account) in genesis_config.accounts.iter() {
|
||||
if self.get_account(pubkey).is_some() {
|
||||
panic!("{} repeated in genesis config", pubkey);
|
||||
}
|
||||
assert!(
|
||||
self.get_account(pubkey).is_none(),
|
||||
"{} repeated in genesis config",
|
||||
pubkey
|
||||
);
|
||||
self.store_account(pubkey, &AccountSharedData::from(account.clone()));
|
||||
self.capitalization.fetch_add(account.lamports(), Relaxed);
|
||||
}
|
||||
@ -2913,9 +2916,11 @@ impl Bank {
|
||||
self.update_fees();
|
||||
|
||||
for (pubkey, account) in genesis_config.rewards_pools.iter() {
|
||||
if self.get_account(pubkey).is_some() {
|
||||
panic!("{} repeated in genesis config", pubkey);
|
||||
}
|
||||
assert!(
|
||||
self.get_account(pubkey).is_none(),
|
||||
"{} repeated in genesis config",
|
||||
pubkey
|
||||
);
|
||||
self.store_account(pubkey, &AccountSharedData::from(account.clone()));
|
||||
}
|
||||
|
||||
@ -3514,23 +3519,14 @@ impl Bank {
|
||||
sanitized_txs: &[SanitizedTransaction],
|
||||
lock_results: &[Result<()>],
|
||||
max_age: usize,
|
||||
mut error_counters: &mut ErrorCounters,
|
||||
error_counters: &mut ErrorCounters,
|
||||
) -> Vec<TransactionCheckResult> {
|
||||
let age_results = self.check_age(
|
||||
sanitized_txs.iter(),
|
||||
lock_results,
|
||||
max_age,
|
||||
&mut error_counters,
|
||||
);
|
||||
let cache_results =
|
||||
self.check_status_cache(sanitized_txs, age_results, &mut error_counters);
|
||||
let age_results =
|
||||
self.check_age(sanitized_txs.iter(), lock_results, max_age, error_counters);
|
||||
let cache_results = self.check_status_cache(sanitized_txs, age_results, error_counters);
|
||||
if self.upgrade_epoch() {
|
||||
// Reject all non-vote transactions
|
||||
self.filter_by_vote_transactions(
|
||||
sanitized_txs.iter(),
|
||||
cache_results,
|
||||
&mut error_counters,
|
||||
)
|
||||
self.filter_by_vote_transactions(sanitized_txs.iter(), cache_results, error_counters)
|
||||
} else {
|
||||
cache_results
|
||||
}
|
||||
|
@ -75,9 +75,11 @@ pub(crate) struct DeserializableVersionedBank {
|
||||
pub(crate) epoch_schedule: EpochSchedule,
|
||||
pub(crate) inflation: Inflation,
|
||||
pub(crate) stakes: Stakes,
|
||||
#[allow(dead_code)]
|
||||
pub(crate) unused_accounts: UnusedAccounts,
|
||||
pub(crate) epoch_stakes: HashMap<Epoch, EpochStakes>,
|
||||
pub(crate) is_delta: bool,
|
||||
#[allow(dead_code)]
|
||||
pub(crate) message_processor: InstructionProcessor,
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,7 @@ struct SnapshotRootPaths {
|
||||
/// Helper type to bundle up the results from `unarchive_snapshot()`
|
||||
#[derive(Debug)]
|
||||
struct UnarchivedSnapshot {
|
||||
#[allow(dead_code)]
|
||||
unpack_dir: TempDir,
|
||||
unpacked_append_vec_map: UnpackedAppendVecMap,
|
||||
unpacked_snapshots_dir_and_version: UnpackedSnapshotsDirAndVersion,
|
||||
@ -464,7 +465,7 @@ pub fn deserialize_snapshot_data_file<T: Sized>(
|
||||
deserializer: impl FnOnce(&mut BufReader<File>) -> Result<T>,
|
||||
) -> Result<T> {
|
||||
let wrapped_deserializer = move |streams: &mut SnapshotStreams<File>| -> Result<T> {
|
||||
deserializer(&mut streams.full_snapshot_stream)
|
||||
deserializer(streams.full_snapshot_stream)
|
||||
};
|
||||
|
||||
let wrapped_data_file_path = SnapshotRootPaths {
|
||||
@ -1460,12 +1461,12 @@ fn rebuild_bank_from_snapshots(
|
||||
.map(|root_paths| root_paths.snapshot_path),
|
||||
};
|
||||
|
||||
let bank = deserialize_snapshot_data_files(&snapshot_root_paths, |mut snapshot_streams| {
|
||||
let bank = deserialize_snapshot_data_files(&snapshot_root_paths, |snapshot_streams| {
|
||||
Ok(
|
||||
match incremental_snapshot_version.unwrap_or(full_snapshot_version) {
|
||||
SnapshotVersion::V1_2_0 => bank_from_streams(
|
||||
SerdeStyle::Newer,
|
||||
&mut snapshot_streams,
|
||||
snapshot_streams,
|
||||
account_paths,
|
||||
unpacked_append_vec_map,
|
||||
genesis_config,
|
||||
|
Reference in New Issue
Block a user