Fix rust 1.65 lints (#3682)

## Issue Addressed

New lints for rust 1.65

## Proposed Changes

Notable change is the identification or parameters that are only used in recursion

## Additional Info
na
This commit is contained in:
Divma
2022-11-04 07:43:43 +00:00
parent e8604757a2
commit 8600645f65
26 changed files with 37 additions and 77 deletions

View File

@@ -45,7 +45,7 @@ impl HeadTracker {
/// Returns a `SszHeadTracker`, which contains all necessary information to restore the state
/// of `Self` at some later point.
pub fn to_ssz_container(&self) -> SszHeadTracker {
SszHeadTracker::from_map(&*self.0.read())
SszHeadTracker::from_map(&self.0.read())
}
/// Creates a new `Self` from the given `SszHeadTracker`, restoring `Self` to the same state of

View File

@@ -588,7 +588,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> BackgroundMigrator<E, Ho
let persisted_head = PersistedBeaconChain {
_canonical_head_block_root: DUMMY_CANONICAL_HEAD_BLOCK_ROOT,
genesis_block_root,
ssz_head_tracker: SszHeadTracker::from_map(&*head_tracker_lock),
ssz_head_tracker: SszHeadTracker::from_map(&head_tracker_lock),
};
drop(head_tracker_lock);
kv_batch.push(persisted_head.as_kv_store_op(BEACON_CHAIN_DB_KEY));

View File

@@ -17,7 +17,6 @@ use crate::persisted_fork_choice::{
};
use crate::types::ChainSpec;
use slog::{warn, Logger};
use std::path::Path;
use std::sync::Arc;
use store::hot_cold_store::{HotColdDB, HotColdDBError};
use store::metadata::{SchemaVersion, CURRENT_SCHEMA_VERSION};
@@ -27,7 +26,6 @@ use store::{Error as StoreError, StoreItem};
pub fn migrate_schema<T: BeaconChainTypes>(
db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>,
deposit_contract_deploy_block: u64,
datadir: &Path,
from: SchemaVersion,
to: SchemaVersion,
log: Logger,
@@ -42,21 +40,12 @@ pub fn migrate_schema<T: BeaconChainTypes>(
migrate_schema::<T>(
db.clone(),
deposit_contract_deploy_block,
datadir,
from,
next,
log.clone(),
spec,
)?;
migrate_schema::<T>(
db,
deposit_contract_deploy_block,
datadir,
next,
to,
log,
spec,
)
migrate_schema::<T>(db, deposit_contract_deploy_block, next, to, log, spec)
}
// Downgrade across multiple versions by recursively migrating one step at a time.
(_, _) if to.as_u64() + 1 < from.as_u64() => {
@@ -64,21 +53,12 @@ pub fn migrate_schema<T: BeaconChainTypes>(
migrate_schema::<T>(
db.clone(),
deposit_contract_deploy_block,
datadir,
from,
next,
log.clone(),
spec,
)?;
migrate_schema::<T>(
db,
deposit_contract_deploy_block,
datadir,
next,
to,
log,
spec,
)
migrate_schema::<T>(db, deposit_contract_deploy_block, next, to, log, spec)
}
//

View File

@@ -356,7 +356,7 @@ where
let urls: Vec<SensitiveUrl> = urls
.iter()
.map(|s| SensitiveUrl::parse(*s))
.map(|s| SensitiveUrl::parse(s))
.collect::<Result<_, _>>()
.unwrap();

View File

@@ -332,34 +332,22 @@ impl<T: EthSpec> ValidatorMonitor<T> {
metrics::set_int_gauge(
&metrics::VALIDATOR_MONITOR_SLASHED,
&[id],
if validator.slashed { 1 } else { 0 },
i64::from(validator.slashed),
);
metrics::set_int_gauge(
&metrics::VALIDATOR_MONITOR_ACTIVE,
&[id],
if validator.is_active_at(current_epoch) {
1
} else {
0
},
i64::from(validator.is_active_at(current_epoch)),
);
metrics::set_int_gauge(
&metrics::VALIDATOR_MONITOR_EXITED,
&[id],
if validator.is_exited_at(current_epoch) {
1
} else {
0
},
i64::from(validator.is_exited_at(current_epoch)),
);
metrics::set_int_gauge(
&metrics::VALIDATOR_MONITOR_WITHDRAWABLE,
&[id],
if validator.is_withdrawable_at(current_epoch) {
1
} else {
0
},
i64::from(validator.is_withdrawable_at(current_epoch)),
);
metrics::set_int_gauge(
&metrics::VALIDATOR_ACTIVATION_ELIGIBILITY_EPOCH,

View File

@@ -858,7 +858,6 @@ where
/// Specifies that the `Client` should use a `HotColdDB` database.
pub fn disk_store(
mut self,
datadir: &Path,
hot_path: &Path,
cold_path: &Path,
config: StoreConfig,
@@ -888,7 +887,6 @@ where
migrate_schema::<Witness<TSlotClock, TEth1Backend, _, _, _>>(
db,
deposit_contract_deploy_block,
datadir,
from,
to,
log,

View File

@@ -1,3 +1,4 @@
#![recursion_limit = "256"]
//! This crate contains a HTTP server which serves the endpoints listed here:
//!
//! https://github.com/ethereum/beacon-APIs

View File

@@ -269,7 +269,7 @@ pub(crate) fn save_metadata_to_disk<E: EthSpec>(
metadata: MetaData<E>,
log: &slog::Logger,
) {
let _ = std::fs::create_dir_all(&dir);
let _ = std::fs::create_dir_all(dir);
match File::create(dir.join(METADATA_FILENAME))
.and_then(|mut f| f.write_all(&metadata.as_ssz_bytes()))
{

View File

@@ -267,7 +267,7 @@ impl<T: EthSpec> OperationPool<T> {
&prev_epoch_key,
&*all_attestations,
state,
&*reward_cache,
&reward_cache,
total_active_balance,
prev_epoch_validity_filter,
spec,
@@ -278,7 +278,7 @@ impl<T: EthSpec> OperationPool<T> {
&curr_epoch_key,
&*all_attestations,
state,
&*reward_cache,
&reward_cache,
total_active_balance,
curr_epoch_validity_filter,
spec,

View File

@@ -61,7 +61,7 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
let client_genesis = client_config.genesis.clone();
let store_config = client_config.store.clone();
let log = context.log().clone();
let datadir = client_config.create_data_dir()?;
let _datadir = client_config.create_data_dir()?;
let db_path = client_config.create_db_path()?;
let freezer_db_path = client_config.create_freezer_db_path()?;
let executor = context.executor.clone();
@@ -84,13 +84,7 @@ impl<E: EthSpec> ProductionBeaconNode<E> {
.runtime_context(context)
.chain_spec(spec)
.http_api_config(client_config.http_api.clone())
.disk_store(
&datadir,
&db_path,
&freezer_db_path,
store_config,
log.clone(),
)?;
.disk_store(&db_path, &freezer_db_path, store_config, log.clone())?;
let builder = if let Some(slasher_config) = client_config.slasher.clone() {
let slasher = Arc::new(