From 5e1f8a84804a18491a3c8b7ccbe4d7ef37fed55a Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Fri, 25 Feb 2022 00:10:17 +0000 Subject: [PATCH] Update to Rust 1.59 and 2021 edition (#3038) ## Proposed Changes Lots of lint updates related to `flat_map`, `unwrap_or_else` and string patterns. I did a little more creative refactoring in the op pool, but otherwise followed Clippy's suggestions. ## Additional Info We need this PR to unblock CI. --- account_manager/Cargo.toml | 2 +- beacon_node/Cargo.toml | 2 +- beacon_node/beacon_chain/Cargo.toml | 2 +- beacon_node/beacon_chain/src/beacon_chain.rs | 2 +- .../src/naive_aggregation_pool.rs | 5 +---- .../src/sync_committee_verification.rs | 2 +- .../beacon_chain/src/validator_monitor.rs | 13 +++++-------- .../src/validator_pubkey_cache.rs | 4 +--- .../tests/sync_committee_verification.rs | 4 ++-- beacon_node/client/Cargo.toml | 2 +- beacon_node/eth1/Cargo.toml | 2 +- beacon_node/eth1/src/http.rs | 2 +- beacon_node/execution_layer/Cargo.toml | 2 +- beacon_node/genesis/Cargo.toml | 2 +- beacon_node/http_api/Cargo.toml | 2 +- beacon_node/http_metrics/Cargo.toml | 2 +- beacon_node/lighthouse_network/Cargo.toml | 2 +- .../lighthouse_network/src/behaviour/mod.rs | 2 +- beacon_node/network/Cargo.toml | 2 +- beacon_node/operation_pool/Cargo.toml | 2 +- beacon_node/operation_pool/src/lib.rs | 13 ++++++------- beacon_node/operation_pool/src/persistence.rs | 15 +++++++-------- beacon_node/src/config.rs | 16 +++++++++------- beacon_node/store/Cargo.toml | 2 +- beacon_node/store/src/hot_cold_store.rs | 2 +- beacon_node/timer/Cargo.toml | 2 +- boot_node/Cargo.toml | 2 +- common/account_utils/Cargo.toml | 2 +- common/clap_utils/Cargo.toml | 2 +- common/clap_utils/src/lib.rs | 2 +- common/compare_fields/Cargo.toml | 2 +- common/compare_fields_derive/Cargo.toml | 2 +- common/compare_fields_derive/src/lib.rs | 2 +- common/deposit_contract/Cargo.toml | 2 +- common/directory/Cargo.toml | 2 +- common/eth2/Cargo.toml | 2 +- common/eth2_config/Cargo.toml | 2 +- common/eth2_interop_keypairs/Cargo.toml | 2 +- common/eth2_network_config/Cargo.toml | 2 +- common/eth2_wallet_manager/Cargo.toml | 2 +- common/fallback/Cargo.toml | 2 +- common/filesystem/Cargo.toml | 2 +- common/hashset_delay/Cargo.toml | 2 +- common/lighthouse_metrics/Cargo.toml | 2 +- common/lighthouse_version/Cargo.toml | 2 +- common/lockfile/Cargo.toml | 2 +- common/logging/Cargo.toml | 2 +- common/logging/tests/test.rs | 6 ++---- common/lru_cache/Cargo.toml | 2 +- common/malloc_utils/Cargo.toml | 2 +- common/monitoring_api/Cargo.toml | 2 +- common/sensitive_url/Cargo.toml | 2 +- common/slot_clock/Cargo.toml | 2 +- common/target_check/Cargo.toml | 2 +- common/task_executor/Cargo.toml | 2 +- common/test_random_derive/Cargo.toml | 2 +- common/test_random_derive/src/lib.rs | 2 +- common/validator_dir/Cargo.toml | 2 +- common/warp_utils/Cargo.toml | 2 +- consensus/cached_tree_hash/Cargo.toml | 2 +- consensus/cached_tree_hash/src/cache_arena.rs | 4 ++-- consensus/fork_choice/Cargo.toml | 2 +- consensus/fork_choice/src/fork_choice.rs | 2 +- consensus/fork_choice/tests/tests.rs | 4 ++-- consensus/int_to_bytes/Cargo.toml | 2 +- consensus/merkle_proof/Cargo.toml | 2 +- consensus/proto_array/Cargo.toml | 2 +- consensus/proto_array/src/proto_array.rs | 2 +- consensus/safe_arith/Cargo.toml | 2 +- consensus/serde_utils/Cargo.toml | 2 +- consensus/serde_utils/src/u64_hex_be.rs | 2 +- consensus/ssz/Cargo.toml | 2 +- consensus/ssz/src/decode.rs | 19 ++++++++++--------- consensus/ssz_derive/Cargo.toml | 2 +- consensus/ssz_types/Cargo.toml | 2 +- consensus/state_processing/Cargo.toml | 2 +- consensus/state_processing/src/lib.rs | 2 +- .../per_block_processing/signature_sets.rs | 12 +++++------- .../base/rewards_and_penalties.rs | 5 ++--- consensus/swap_or_not_shuffle/Cargo.toml | 2 +- consensus/tree_hash/Cargo.toml | 2 +- consensus/tree_hash/src/merkle_hasher.rs | 4 ++-- consensus/tree_hash_derive/Cargo.toml | 2 +- consensus/tree_hash_derive/src/lib.rs | 2 +- consensus/types/Cargo.toml | 2 +- .../types/src/beacon_state/tree_hash_cache.rs | 2 +- consensus/types/src/lib.rs | 2 +- crypto/bls/Cargo.toml | 2 +- crypto/eth2_hashing/Cargo.toml | 2 +- crypto/eth2_key_derivation/Cargo.toml | 2 +- crypto/eth2_key_derivation/src/derived_key.rs | 3 +-- crypto/eth2_keystore/Cargo.toml | 2 +- crypto/eth2_wallet/Cargo.toml | 2 +- lcli/Cargo.toml | 2 +- lcli/src/etl/block_efficiency.rs | 6 +++--- lighthouse/Cargo.toml | 2 +- lighthouse/environment/Cargo.toml | 2 +- slasher/Cargo.toml | 2 +- slasher/service/Cargo.toml | 2 +- testing/ef_tests/Cargo.toml | 2 +- .../ef_tests/src/cases/epoch_processing.rs | 5 +---- testing/ef_tests/src/cases/operations.rs | 5 +---- testing/ef_tests/src/cases/rewards.rs | 5 +---- testing/ef_tests/src/cases/sanity_blocks.rs | 5 +---- testing/ef_tests/src/cases/sanity_slots.rs | 5 +---- testing/eth1_test_rig/Cargo.toml | 2 +- testing/node_test_rig/Cargo.toml | 2 +- testing/simulator/Cargo.toml | 2 +- testing/state_transition_vectors/Cargo.toml | 2 +- testing/test-test_logger/Cargo.toml | 2 +- testing/web3signer_tests/Cargo.toml | 2 +- validator_client/Cargo.toml | 2 +- .../slashing_protection/Cargo.toml | 2 +- .../src/slashing_database.rs | 4 ++-- .../src/http_api/tests/keystores.rs | 15 ++++++++++++++- 115 files changed, 173 insertions(+), 188 deletions(-) diff --git a/account_manager/Cargo.toml b/account_manager/Cargo.toml index c14c47787..ce863f914 100644 --- a/account_manager/Cargo.toml +++ b/account_manager/Cargo.toml @@ -2,7 +2,7 @@ name = "account_manager" version = "0.3.5" authors = ["Paul Hauner ", "Luke Anderson "] -edition = "2018" +edition = "2021" [dependencies] bls = { path = "../crypto/bls" } diff --git a/beacon_node/Cargo.toml b/beacon_node/Cargo.toml index 46ff5ba22..3242336c5 100644 --- a/beacon_node/Cargo.toml +++ b/beacon_node/Cargo.toml @@ -2,7 +2,7 @@ name = "beacon_node" version = "2.1.3" authors = ["Paul Hauner ", "Age Manning ", "Age Manning "] -edition = "2018" +edition = "2021" autotests = false # using a single test binary compiles faster [features] diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index 67aed4b48..0b9dbb50a 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -2289,7 +2289,7 @@ impl BeaconChain { .position(|(_root, block)| { block.slot().epoch(T::EthSpec::slots_per_epoch()) > start_epoch }) - .unwrap_or_else(|| filtered_chain_segment.len()); + .unwrap_or(filtered_chain_segment.len()); // Split off the first section blocks that are all either within the current epoch of // the first block. These blocks can all be signature-verified with the same diff --git a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs index 8d8dd19b5..252e9915d 100644 --- a/beacon_node/beacon_chain/src/naive_aggregation_pool.rs +++ b/beacon_node/beacon_chain/src/naive_aggregation_pool.rs @@ -421,10 +421,7 @@ impl NaiveAggregationPool { /// Iterate all items in all slots of `self`. pub fn iter(&self) -> impl Iterator { - self.maps - .iter() - .map(|(_slot, map)| map.get_map().iter().map(|(_key, value)| value)) - .flatten() + self.maps.values().flat_map(|map| map.get_map().values()) } /// Removes any items with a slot lower than `current_slot` and bars any future diff --git a/beacon_node/beacon_chain/src/sync_committee_verification.rs b/beacon_node/beacon_chain/src/sync_committee_verification.rs index fa7d4dcfe..7d56af793 100644 --- a/beacon_node/beacon_chain/src/sync_committee_verification.rs +++ b/beacon_node/beacon_chain/src/sync_committee_verification.rs @@ -635,7 +635,7 @@ pub fn verify_sync_committee_message( let pubkey = pubkey_cache .get_pubkey_from_pubkey_bytes(pubkey_bytes) .map(Cow::Borrowed) - .ok_or_else(|| Error::UnknownValidatorPubkey(*pubkey_bytes))?; + .ok_or(Error::UnknownValidatorPubkey(*pubkey_bytes))?; let next_slot_epoch = (sync_message.get_slot() + 1).epoch(T::EthSpec::slots_per_epoch()); let fork = chain.spec.fork_at_epoch(next_slot_epoch); diff --git a/beacon_node/beacon_chain/src/validator_monitor.rs b/beacon_node/beacon_chain/src/validator_monitor.rs index ef3632f26..6292409d7 100644 --- a/beacon_node/beacon_chain/src/validator_monitor.rs +++ b/beacon_node/beacon_chain/src/validator_monitor.rs @@ -198,14 +198,11 @@ impl MonitoredValidator { /// as the value recorded by the validator monitor ignores skip slots. fn min_inclusion_distance(&self, epoch: &Epoch) -> Option { let summaries = self.summaries.read(); - summaries - .get(epoch) - .map(|summary| { - summary - .attestation_min_block_inclusion_distance - .map(Into::into) - }) - .flatten() + summaries.get(epoch).and_then(|summary| { + summary + .attestation_min_block_inclusion_distance + .map(Into::into) + }) } /// Maps `func` across the `self.summaries`. diff --git a/beacon_node/beacon_chain/src/validator_pubkey_cache.rs b/beacon_node/beacon_chain/src/validator_pubkey_cache.rs index da877cf4e..14bb57e5e 100644 --- a/beacon_node/beacon_chain/src/validator_pubkey_cache.rs +++ b/beacon_node/beacon_chain/src/validator_pubkey_cache.rs @@ -175,9 +175,7 @@ impl ValidatorPubkeyCache { /// Get the `PublicKey` for a validator with `PublicKeyBytes`. pub fn get_pubkey_from_pubkey_bytes(&self, pubkey: &PublicKeyBytes) -> Option<&PublicKey> { - self.get_index(pubkey) - .map(|index| self.get(index)) - .flatten() + self.get_index(pubkey).and_then(|index| self.get(index)) } /// Get the public key (in bytes form) for a validator with index `i`. diff --git a/beacon_node/beacon_chain/tests/sync_committee_verification.rs b/beacon_node/beacon_chain/tests/sync_committee_verification.rs index 2596ff18c..18cd691ac 100644 --- a/beacon_node/beacon_chain/tests/sync_committee_verification.rs +++ b/beacon_node/beacon_chain/tests/sync_committee_verification.rs @@ -179,7 +179,7 @@ fn aggregated_gossip_verification() { get_valid_sync_contribution(&harness, RelativeSyncCommittee::Current); macro_rules! assert_invalid { - ($desc: tt, $attn_getter: expr, $($error: pat) |+ $( if $guard: expr )?) => { + ($desc: tt, $attn_getter: expr, $($error: pat_param) |+ $( if $guard: expr )?) => { assert!( matches!( harness @@ -505,7 +505,7 @@ fn unaggregated_gossip_verification() { get_valid_sync_committee_message(&harness, current_slot, RelativeSyncCommittee::Current); macro_rules! assert_invalid { - ($desc: tt, $attn_getter: expr, $subnet_getter: expr, $($error: pat) |+ $( if $guard: expr )?) => { + ($desc: tt, $attn_getter: expr, $subnet_getter: expr, $($error: pat_param) |+ $( if $guard: expr )?) => { assert!( matches!( harness diff --git a/beacon_node/client/Cargo.toml b/beacon_node/client/Cargo.toml index acb8376db..a34d02ae1 100644 --- a/beacon_node/client/Cargo.toml +++ b/beacon_node/client/Cargo.toml @@ -2,7 +2,7 @@ name = "client" version = "0.2.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dev-dependencies] toml = "0.5.6" diff --git a/beacon_node/eth1/Cargo.toml b/beacon_node/eth1/Cargo.toml index 0b0c2ea16..9600ef489 100644 --- a/beacon_node/eth1/Cargo.toml +++ b/beacon_node/eth1/Cargo.toml @@ -2,7 +2,7 @@ name = "eth1" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dev-dependencies] eth1_test_rig = { path = "../../testing/eth1_test_rig" } diff --git a/beacon_node/eth1/src/http.rs b/beacon_node/eth1/src/http.rs index 9e3465f0f..876613a2a 100644 --- a/beacon_node/eth1/src/http.rs +++ b/beacon_node/eth1/src/http.rs @@ -449,7 +449,7 @@ fn response_result_or_error(response: &str) -> Result { let json = serde_json::from_str::(response) .map_err(|e| RpcError::InvalidJson(e.to_string()))?; - if let Some(error) = json.get("error").map(|e| e.get("message")).flatten() { + if let Some(error) = json.get("error").and_then(|e| e.get("message")) { let error = error.to_string(); if error.contains(EIP155_ERROR_STR) { Err(RpcError::Eip155Error) diff --git a/beacon_node/execution_layer/Cargo.toml b/beacon_node/execution_layer/Cargo.toml index c166024c0..7dbb326a6 100644 --- a/beacon_node/execution_layer/Cargo.toml +++ b/beacon_node/execution_layer/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "execution_layer" version = "0.1.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/beacon_node/genesis/Cargo.toml b/beacon_node/genesis/Cargo.toml index 778e0a4ca..3a19fe0f2 100644 --- a/beacon_node/genesis/Cargo.toml +++ b/beacon_node/genesis/Cargo.toml @@ -2,7 +2,7 @@ name = "genesis" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dev-dependencies] eth1_test_rig = { path = "../../testing/eth1_test_rig" } diff --git a/beacon_node/http_api/Cargo.toml b/beacon_node/http_api/Cargo.toml index 315dbb9e5..7a23d128b 100644 --- a/beacon_node/http_api/Cargo.toml +++ b/beacon_node/http_api/Cargo.toml @@ -2,7 +2,7 @@ name = "http_api" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" autotests = false # using a single test binary compiles faster [dependencies] diff --git a/beacon_node/http_metrics/Cargo.toml b/beacon_node/http_metrics/Cargo.toml index c300aaa8e..c98f2cb85 100644 --- a/beacon_node/http_metrics/Cargo.toml +++ b/beacon_node/http_metrics/Cargo.toml @@ -2,7 +2,7 @@ name = "http_metrics" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/beacon_node/lighthouse_network/Cargo.toml b/beacon_node/lighthouse_network/Cargo.toml index 0cc53c09e..70a50c02d 100644 --- a/beacon_node/lighthouse_network/Cargo.toml +++ b/beacon_node/lighthouse_network/Cargo.toml @@ -2,7 +2,7 @@ name = "lighthouse_network" version = "0.2.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dependencies] discv5 = { version = "0.1.0-beta.13", features = ["libp2p"] } diff --git a/beacon_node/lighthouse_network/src/behaviour/mod.rs b/beacon_node/lighthouse_network/src/behaviour/mod.rs index c0a1fb3f7..155e01d78 100644 --- a/beacon_node/lighthouse_network/src/behaviour/mod.rs +++ b/beacon_node/lighthouse_network/src/behaviour/mod.rs @@ -458,7 +458,7 @@ impl Behaviour { GossipKind::Attestation(subnet_id) => { if let Some(v) = metrics::get_int_gauge( &metrics::FAILED_ATTESTATION_PUBLISHES_PER_SUBNET, - &[&subnet_id.to_string()], + &[subnet_id.as_ref()], ) { v.inc() }; diff --git a/beacon_node/network/Cargo.toml b/beacon_node/network/Cargo.toml index df6851888..1c7506483 100644 --- a/beacon_node/network/Cargo.toml +++ b/beacon_node/network/Cargo.toml @@ -2,7 +2,7 @@ name = "network" version = "0.2.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dev-dependencies] sloggers = { version = "2.1.1", features = ["json"] } diff --git a/beacon_node/operation_pool/Cargo.toml b/beacon_node/operation_pool/Cargo.toml index 449a2f59d..361c0a07f 100644 --- a/beacon_node/operation_pool/Cargo.toml +++ b/beacon_node/operation_pool/Cargo.toml @@ -2,7 +2,7 @@ name = "operation_pool" version = "0.2.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] derivative = "2.1.1" diff --git a/beacon_node/operation_pool/src/lib.rs b/beacon_node/operation_pool/src/lib.rs index c9b252ca1..eef09631e 100644 --- a/beacon_node/operation_pool/src/lib.rs +++ b/beacon_node/operation_pool/src/lib.rs @@ -560,9 +560,8 @@ impl OperationPool { pub fn get_all_attestations(&self) -> Vec> { self.attestations .read() - .iter() - .map(|(_, attns)| attns.iter().cloned()) - .flatten() + .values() + .flat_map(|attns| attns.iter().cloned()) .collect() } @@ -575,10 +574,10 @@ impl OperationPool { { self.attestations .read() - .iter() - .map(|(_, attns)| attns.iter().cloned()) - .flatten() - .filter(filter) + .values() + .flat_map(|attns| attns.iter()) + .filter(|attn| filter(*attn)) + .cloned() .collect() } diff --git a/beacon_node/operation_pool/src/persistence.rs b/beacon_node/operation_pool/src/persistence.rs index 50b7828fa..acab2db60 100644 --- a/beacon_node/operation_pool/src/persistence.rs +++ b/beacon_node/operation_pool/src/persistence.rs @@ -97,20 +97,19 @@ impl PersistedOperationPool { /// Reconstruct an `OperationPool`. Sets `sync_contributions` to its `Default` if `self` matches /// `PersistedOperationPool::Base`. pub fn into_operation_pool(self) -> Result, OpPoolError> { - let attestations = RwLock::new(self.attestations().to_vec().into_iter().collect()); - let attester_slashings = - RwLock::new(self.attester_slashings().to_vec().into_iter().collect()); + let attestations = RwLock::new(self.attestations().iter().cloned().collect()); + let attester_slashings = RwLock::new(self.attester_slashings().iter().cloned().collect()); let proposer_slashings = RwLock::new( self.proposer_slashings() - .to_vec() - .into_iter() + .iter() + .cloned() .map(|slashing| (slashing.signed_header_1.message.proposer_index, slashing)) .collect(), ); let voluntary_exits = RwLock::new( self.voluntary_exits() - .to_vec() - .into_iter() + .iter() + .cloned() .map(|exit| (exit.message.validator_index, exit)) .collect(), ); @@ -125,7 +124,7 @@ impl PersistedOperationPool { }, PersistedOperationPool::Altair(_) => { let sync_contributions = - RwLock::new(self.sync_contributions()?.to_vec().into_iter().collect()); + RwLock::new(self.sync_contributions()?.iter().cloned().collect()); OperationPool { attestations, diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index 33603b94e..6e8743c05 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -705,13 +705,15 @@ pub fn set_network_config( // Appending enr-port to the dns hostname to appease `to_socket_addrs()` parsing. // Since enr-update is disabled with a dns address, not setting the enr-udp-port // will make the node undiscoverable. - if let Some(enr_udp_port) = config.enr_udp_port.or_else(|| { - if use_listening_port_as_enr_port_by_default { - Some(config.discovery_port) - } else { - None - } - }) { + if let Some(enr_udp_port) = + config + .enr_udp_port + .or(if use_listening_port_as_enr_port_by_default { + Some(config.discovery_port) + } else { + None + }) + { addr.push_str(&format!(":{}", enr_udp_port)); } else { return Err( diff --git a/beacon_node/store/Cargo.toml b/beacon_node/store/Cargo.toml index 66a6cf5d2..be98f269f 100644 --- a/beacon_node/store/Cargo.toml +++ b/beacon_node/store/Cargo.toml @@ -2,7 +2,7 @@ name = "store" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dev-dependencies] tempfile = "3.1.0" diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index 62441ce0f..c413309c9 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -762,7 +762,7 @@ impl, Cold: ItemStore> HotColdDB let partial_state_bytes = self .cold_db .get_bytes(DBColumn::BeaconState.into(), state_root.as_bytes())? - .ok_or_else(|| HotColdDBError::MissingRestorePoint(*state_root))?; + .ok_or(HotColdDBError::MissingRestorePoint(*state_root))?; let mut partial_state: PartialBeaconState = PartialBeaconState::from_ssz_bytes(&partial_state_bytes, &self.spec)?; diff --git a/beacon_node/timer/Cargo.toml b/beacon_node/timer/Cargo.toml index e67f52d92..bd20f24ee 100644 --- a/beacon_node/timer/Cargo.toml +++ b/beacon_node/timer/Cargo.toml @@ -2,7 +2,7 @@ name = "timer" version = "0.2.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dependencies] beacon_chain = { path = "../beacon_chain" } diff --git a/boot_node/Cargo.toml b/boot_node/Cargo.toml index 1d86da52e..8c89ab2e4 100644 --- a/boot_node/Cargo.toml +++ b/boot_node/Cargo.toml @@ -2,7 +2,7 @@ name = "boot_node" version = "2.1.3" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dependencies] beacon_node = { path = "../beacon_node" } diff --git a/common/account_utils/Cargo.toml b/common/account_utils/Cargo.toml index b1a2f7e2f..4b42e039d 100644 --- a/common/account_utils/Cargo.toml +++ b/common/account_utils/Cargo.toml @@ -2,7 +2,7 @@ name = "account_utils" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/clap_utils/Cargo.toml b/common/clap_utils/Cargo.toml index 542a13ad4..0aa35b233 100644 --- a/common/clap_utils/Cargo.toml +++ b/common/clap_utils/Cargo.toml @@ -2,7 +2,7 @@ name = "clap_utils" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/clap_utils/src/lib.rs b/common/clap_utils/src/lib.rs index f8c6e8b7c..3dd42f2a9 100644 --- a/common/clap_utils/src/lib.rs +++ b/common/clap_utils/src/lib.rs @@ -31,7 +31,7 @@ pub fn get_eth2_network_config(cli_args: &ArgMatches) -> Result(cli_args, "terminal-total-difficulty-override")? { - let stripped = string.replace(",", ""); + let stripped = string.replace(',', ""); let terminal_total_difficulty = Uint256::from_dec_str(&stripped).map_err(|e| { format!( "Could not parse --terminal-total-difficulty-override as decimal value: {:?}", diff --git a/common/compare_fields/Cargo.toml b/common/compare_fields/Cargo.toml index dc07f940b..58527b571 100644 --- a/common/compare_fields/Cargo.toml +++ b/common/compare_fields/Cargo.toml @@ -2,7 +2,7 @@ name = "compare_fields" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dev-dependencies] compare_fields_derive = { path = "../compare_fields_derive" } diff --git a/common/compare_fields_derive/Cargo.toml b/common/compare_fields_derive/Cargo.toml index 256af2767..7696d3606 100644 --- a/common/compare_fields_derive/Cargo.toml +++ b/common/compare_fields_derive/Cargo.toml @@ -2,7 +2,7 @@ name = "compare_fields_derive" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [lib] proc-macro = true diff --git a/common/compare_fields_derive/src/lib.rs b/common/compare_fields_derive/src/lib.rs index a8f95a1bd..beabc6ca9 100644 --- a/common/compare_fields_derive/src/lib.rs +++ b/common/compare_fields_derive/src/lib.rs @@ -8,7 +8,7 @@ use syn::{parse_macro_input, DeriveInput}; fn is_slice(field: &syn::Field) -> bool { field.attrs.iter().any(|attr| { attr.path.is_ident("compare_fields") - && attr.tokens.to_string().replace(" ", "") == "(as_slice)" + && attr.tokens.to_string().replace(' ', "") == "(as_slice)" }) } diff --git a/common/deposit_contract/Cargo.toml b/common/deposit_contract/Cargo.toml index e1f0579a4..d1eae97ce 100644 --- a/common/deposit_contract/Cargo.toml +++ b/common/deposit_contract/Cargo.toml @@ -2,7 +2,7 @@ name = "deposit_contract" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" build = "build.rs" diff --git a/common/directory/Cargo.toml b/common/directory/Cargo.toml index c85c7b61f..f7b77ab7b 100644 --- a/common/directory/Cargo.toml +++ b/common/directory/Cargo.toml @@ -2,7 +2,7 @@ name = "directory" version = "0.1.0" authors = ["pawan "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/eth2/Cargo.toml b/common/eth2/Cargo.toml index d039a0c91..fecebe8ca 100644 --- a/common/eth2/Cargo.toml +++ b/common/eth2/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/eth2_config/Cargo.toml b/common/eth2_config/Cargo.toml index 18433f09f..08f8c9a39 100644 --- a/common/eth2_config/Cargo.toml +++ b/common/eth2_config/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_config" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] types = { path = "../../consensus/types" } diff --git a/common/eth2_interop_keypairs/Cargo.toml b/common/eth2_interop_keypairs/Cargo.toml index cf8f889cf..2e2d78128 100644 --- a/common/eth2_interop_keypairs/Cargo.toml +++ b/common/eth2_interop_keypairs/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_interop_keypairs" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/eth2_network_config/Cargo.toml b/common/eth2_network_config/Cargo.toml index aac11c4ea..32cee89f7 100644 --- a/common/eth2_network_config/Cargo.toml +++ b/common/eth2_network_config/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_network_config" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" build = "build.rs" diff --git a/common/eth2_wallet_manager/Cargo.toml b/common/eth2_wallet_manager/Cargo.toml index 4c72323f7..8e6f0c0e5 100644 --- a/common/eth2_wallet_manager/Cargo.toml +++ b/common/eth2_wallet_manager/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_wallet_manager" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/fallback/Cargo.toml b/common/fallback/Cargo.toml index 31a701d16..0d71bbbd2 100644 --- a/common/fallback/Cargo.toml +++ b/common/fallback/Cargo.toml @@ -2,7 +2,7 @@ name = "fallback" version = "0.1.0" authors = ["blacktemplar "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/filesystem/Cargo.toml b/common/filesystem/Cargo.toml index f263f680c..66cbedbb8 100644 --- a/common/filesystem/Cargo.toml +++ b/common/filesystem/Cargo.toml @@ -2,7 +2,7 @@ name = "filesystem" version = "0.1.0" authors = ["Mark Mackey "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/hashset_delay/Cargo.toml b/common/hashset_delay/Cargo.toml index a416b43f8..1aa525a11 100644 --- a/common/hashset_delay/Cargo.toml +++ b/common/hashset_delay/Cargo.toml @@ -2,7 +2,7 @@ name = "hashset_delay" version = "0.2.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dependencies] futures = "0.3.7" diff --git a/common/lighthouse_metrics/Cargo.toml b/common/lighthouse_metrics/Cargo.toml index 5c0acd9bd..06e33555d 100644 --- a/common/lighthouse_metrics/Cargo.toml +++ b/common/lighthouse_metrics/Cargo.toml @@ -2,7 +2,7 @@ name = "lighthouse_metrics" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/lighthouse_version/Cargo.toml b/common/lighthouse_version/Cargo.toml index 7da51ea11..782344e9c 100644 --- a/common/lighthouse_version/Cargo.toml +++ b/common/lighthouse_version/Cargo.toml @@ -2,7 +2,7 @@ name = "lighthouse_version" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/lockfile/Cargo.toml b/common/lockfile/Cargo.toml index 004aaa300..b9616e871 100644 --- a/common/lockfile/Cargo.toml +++ b/common/lockfile/Cargo.toml @@ -2,7 +2,7 @@ name = "lockfile" version = "0.1.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] fs2 = "0.4.3" diff --git a/common/logging/Cargo.toml b/common/logging/Cargo.toml index da1aa8b52..e56a1a235 100644 --- a/common/logging/Cargo.toml +++ b/common/logging/Cargo.toml @@ -2,7 +2,7 @@ name = "logging" version = "0.2.0" authors = ["blacktemplar "] -edition = "2018" +edition = "2021" [features] test_logger = [] # Print log output to stderr when running tests instead of dropping it diff --git a/common/logging/tests/test.rs b/common/logging/tests/test.rs index 1d3d3c5e2..f39f2b6d5 100644 --- a/common/logging/tests/test.rs +++ b/common/logging/tests/test.rs @@ -3,13 +3,11 @@ use std::process::Command; use std::process::Output; fn run_cmd(cmd_line: &str) -> Result { - let output; if cfg!(target_os = "windows") { - output = Command::new(r#"cmd"#).args(["/C", cmd_line]).output(); + Command::new(r#"cmd"#).args(["/C", cmd_line]).output() } else { - output = Command::new(r#"sh"#).args(["-c", cmd_line]).output(); + Command::new(r#"sh"#).args(["-c", cmd_line]).output() } - output } #[test] diff --git a/common/lru_cache/Cargo.toml b/common/lru_cache/Cargo.toml index df5d9b162..405b7be5d 100644 --- a/common/lru_cache/Cargo.toml +++ b/common/lru_cache/Cargo.toml @@ -2,7 +2,7 @@ name = "lru_cache" version = "0.1.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dependencies] fnv = "1.0.7" diff --git a/common/malloc_utils/Cargo.toml b/common/malloc_utils/Cargo.toml index 813584992..881b9e346 100644 --- a/common/malloc_utils/Cargo.toml +++ b/common/malloc_utils/Cargo.toml @@ -2,7 +2,7 @@ name = "malloc_utils" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/monitoring_api/Cargo.toml b/common/monitoring_api/Cargo.toml index 7812e5ada..4196f8cce 100644 --- a/common/monitoring_api/Cargo.toml +++ b/common/monitoring_api/Cargo.toml @@ -2,7 +2,7 @@ name = "monitoring_api" version = "0.1.0" authors = ["pawan "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/sensitive_url/Cargo.toml b/common/sensitive_url/Cargo.toml index b6b0620a0..6de591efc 100644 --- a/common/sensitive_url/Cargo.toml +++ b/common/sensitive_url/Cargo.toml @@ -2,7 +2,7 @@ name = "sensitive_url" version = "0.1.0" authors = ["Mac L "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common/slot_clock/Cargo.toml b/common/slot_clock/Cargo.toml index 63a571e5b..eaf280398 100644 --- a/common/slot_clock/Cargo.toml +++ b/common/slot_clock/Cargo.toml @@ -2,7 +2,7 @@ name = "slot_clock" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] types = { path = "../../consensus/types" } diff --git a/common/target_check/Cargo.toml b/common/target_check/Cargo.toml index 8981483ee..2cf2cacc6 100644 --- a/common/target_check/Cargo.toml +++ b/common/target_check/Cargo.toml @@ -2,7 +2,7 @@ name = "target_check" version = "0.1.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] static_assertions = "1.1.0" diff --git a/common/task_executor/Cargo.toml b/common/task_executor/Cargo.toml index db5c2e7b0..660cc1ca0 100644 --- a/common/task_executor/Cargo.toml +++ b/common/task_executor/Cargo.toml @@ -2,7 +2,7 @@ name = "task_executor" version = "0.1.0" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" [dependencies] tokio = { version = "1.14.0", features = ["rt"] } diff --git a/common/test_random_derive/Cargo.toml b/common/test_random_derive/Cargo.toml index 0186ab326..8794eeea2 100644 --- a/common/test_random_derive/Cargo.toml +++ b/common/test_random_derive/Cargo.toml @@ -2,7 +2,7 @@ name = "test_random_derive" version = "0.2.0" authors = ["thojest "] -edition = "2018" +edition = "2021" description = "Procedural derive macros for implementation of TestRandom trait" [lib] diff --git a/common/test_random_derive/src/lib.rs b/common/test_random_derive/src/lib.rs index fabc61c7f..6c72ecb44 100644 --- a/common/test_random_derive/src/lib.rs +++ b/common/test_random_derive/src/lib.rs @@ -10,7 +10,7 @@ use syn::{parse_macro_input, DeriveInput}; /// The field attribute is: `#[test_random(default)]` fn should_use_default(field: &syn::Field) -> bool { field.attrs.iter().any(|attr| { - attr.path.is_ident("test_random") && attr.tokens.to_string().replace(" ", "") == "(default)" + attr.path.is_ident("test_random") && attr.tokens.to_string().replace(' ', "") == "(default)" }) } diff --git a/common/validator_dir/Cargo.toml b/common/validator_dir/Cargo.toml index 784d4d1df..6fd4730f4 100644 --- a/common/validator_dir/Cargo.toml +++ b/common/validator_dir/Cargo.toml @@ -2,7 +2,7 @@ name = "validator_dir" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [features] insecure_keys = [] diff --git a/common/warp_utils/Cargo.toml b/common/warp_utils/Cargo.toml index 09b6f125f..e66aeddfb 100644 --- a/common/warp_utils/Cargo.toml +++ b/common/warp_utils/Cargo.toml @@ -2,7 +2,7 @@ name = "warp_utils" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/consensus/cached_tree_hash/Cargo.toml b/consensus/cached_tree_hash/Cargo.toml index b77c800b1..95762bbc7 100644 --- a/consensus/cached_tree_hash/Cargo.toml +++ b/consensus/cached_tree_hash/Cargo.toml @@ -2,7 +2,7 @@ name = "cached_tree_hash" version = "0.1.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] ethereum-types = "0.12.1" diff --git a/consensus/cached_tree_hash/src/cache_arena.rs b/consensus/cached_tree_hash/src/cache_arena.rs index a938d4826..42819e8df 100644 --- a/consensus/cached_tree_hash/src/cache_arena.rs +++ b/consensus/cached_tree_hash/src/cache_arena.rs @@ -127,7 +127,7 @@ impl CacheArena { .offsets .get(alloc_id + 1) .copied() - .unwrap_or_else(|| self.backing.len()); + .unwrap_or(self.backing.len()); Ok(end - start) } @@ -168,7 +168,7 @@ impl CacheArena { .offsets .get(alloc_id + 1) .copied() - .unwrap_or_else(|| self.backing.len()); + .unwrap_or(self.backing.len()); Ok(start..end) } diff --git a/consensus/fork_choice/Cargo.toml b/consensus/fork_choice/Cargo.toml index a17b31db6..77603d09e 100644 --- a/consensus/fork_choice/Cargo.toml +++ b/consensus/fork_choice/Cargo.toml @@ -2,7 +2,7 @@ name = "fork_choice" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index 3ab07c6af..f6c6f1641 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -219,7 +219,7 @@ fn dequeue_attestations( queued_attestations .iter() .position(|a| a.slot >= current_slot) - .unwrap_or_else(|| queued_attestations.len()), + .unwrap_or(queued_attestations.len()), ); std::mem::replace(queued_attestations, remaining) diff --git a/consensus/fork_choice/tests/tests.rs b/consensus/fork_choice/tests/tests.rs index 42b56f6ab..0b230ffd3 100644 --- a/consensus/fork_choice/tests/tests.rs +++ b/consensus/fork_choice/tests/tests.rs @@ -613,7 +613,7 @@ fn justified_balances() { } macro_rules! assert_invalid_block { - ($err: tt, $($error: pat) |+ $( if $guard: expr )?) => { + ($err: tt, $($error: pat_param) |+ $( if $guard: expr )?) => { assert!( matches!( $err, @@ -719,7 +719,7 @@ fn invalid_block_finalized_descendant() { } macro_rules! assert_invalid_attestation { - ($err: tt, $($error: pat) |+ $( if $guard: expr )?) => { + ($err: tt, $($error: pat_param) |+ $( if $guard: expr )?) => { assert!( matches!( $err, diff --git a/consensus/int_to_bytes/Cargo.toml b/consensus/int_to_bytes/Cargo.toml index 81fd49b4f..73dfec40f 100644 --- a/consensus/int_to_bytes/Cargo.toml +++ b/consensus/int_to_bytes/Cargo.toml @@ -2,7 +2,7 @@ name = "int_to_bytes" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] bytes = "1.0.1" diff --git a/consensus/merkle_proof/Cargo.toml b/consensus/merkle_proof/Cargo.toml index 7b2af88ec..89cd502cf 100644 --- a/consensus/merkle_proof/Cargo.toml +++ b/consensus/merkle_proof/Cargo.toml @@ -2,7 +2,7 @@ name = "merkle_proof" version = "0.2.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] ethereum-types = "0.12.1" diff --git a/consensus/proto_array/Cargo.toml b/consensus/proto_array/Cargo.toml index 2794d3c8e..ad79ecc1e 100644 --- a/consensus/proto_array/Cargo.toml +++ b/consensus/proto_array/Cargo.toml @@ -2,7 +2,7 @@ name = "proto_array" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [[bin]] name = "proto_array" diff --git a/consensus/proto_array/src/proto_array.rs b/consensus/proto_array/src/proto_array.rs index 465ef9d4f..759bee6ba 100644 --- a/consensus/proto_array/src/proto_array.rs +++ b/consensus/proto_array/src/proto_array.rs @@ -313,7 +313,7 @@ impl ProtoArray { .indices .get(justified_root) .copied() - .ok_or_else(|| Error::JustifiedNodeUnknown(*justified_root))?; + .ok_or(Error::JustifiedNodeUnknown(*justified_root))?; let justified_node = self .nodes diff --git a/consensus/safe_arith/Cargo.toml b/consensus/safe_arith/Cargo.toml index 7784a0392..d212f9884 100644 --- a/consensus/safe_arith/Cargo.toml +++ b/consensus/safe_arith/Cargo.toml @@ -2,7 +2,7 @@ name = "safe_arith" version = "0.1.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/consensus/serde_utils/Cargo.toml b/consensus/serde_utils/Cargo.toml index 54eb55b8f..1d258ec6e 100644 --- a/consensus/serde_utils/Cargo.toml +++ b/consensus/serde_utils/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_serde_utils" version = "0.1.1" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" description = "Serialization and deserialization utilities useful for JSON representations of Ethereum 2.0 types." license = "Apache-2.0" diff --git a/consensus/serde_utils/src/u64_hex_be.rs b/consensus/serde_utils/src/u64_hex_be.rs index 145292f8c..dc6af0fa4 100644 --- a/consensus/serde_utils/src/u64_hex_be.rs +++ b/consensus/serde_utils/src/u64_hex_be.rs @@ -51,7 +51,7 @@ where let raw = hex::encode(num.to_be_bytes()); let trimmed = raw.trim_start_matches('0'); - let hex = if trimmed.is_empty() { "0" } else { &trimmed }; + let hex = if trimmed.is_empty() { "0" } else { trimmed }; serializer.serialize_str(&format!("0x{}", &hex)) } diff --git a/consensus/ssz/Cargo.toml b/consensus/ssz/Cargo.toml index 555017daa..7ba3e0678 100644 --- a/consensus/ssz/Cargo.toml +++ b/consensus/ssz/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_ssz" version = "0.4.1" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" description = "SimpleSerialize (SSZ) as used in Ethereum 2.0" license = "Apache-2.0" diff --git a/consensus/ssz/src/decode.rs b/consensus/ssz/src/decode.rs index 1c4c04ff0..604cc68d7 100644 --- a/consensus/ssz/src/decode.rs +++ b/consensus/ssz/src/decode.rs @@ -187,12 +187,13 @@ impl<'a> SszDecoderBuilder<'a> { let start = self.items_index; self.items_index += ssz_fixed_len; - let slice = self.bytes.get(start..self.items_index).ok_or_else(|| { - DecodeError::InvalidByteLength { - len: self.bytes.len(), - expected: self.items_index, - } - })?; + let slice = + self.bytes + .get(start..self.items_index) + .ok_or(DecodeError::InvalidByteLength { + len: self.bytes.len(), + expected: self.items_index, + })?; self.items.push(slice); } else { @@ -347,12 +348,12 @@ pub fn split_union_bytes(bytes: &[u8]) -> Result<(UnionSelector, &[u8]), DecodeE /// Reads a `BYTES_PER_LENGTH_OFFSET`-byte length from `bytes`, where `bytes.len() >= /// BYTES_PER_LENGTH_OFFSET`. pub fn read_offset(bytes: &[u8]) -> Result { - decode_offset(bytes.get(0..BYTES_PER_LENGTH_OFFSET).ok_or_else(|| { + decode_offset(bytes.get(0..BYTES_PER_LENGTH_OFFSET).ok_or( DecodeError::InvalidLengthPrefix { len: bytes.len(), expected: BYTES_PER_LENGTH_OFFSET, - } - })?) + }, + )?) } /// Decode bytes as a little-endian usize, returning an `Err` if `bytes.len() != diff --git a/consensus/ssz_derive/Cargo.toml b/consensus/ssz_derive/Cargo.toml index 337530873..cac617d39 100644 --- a/consensus/ssz_derive/Cargo.toml +++ b/consensus/ssz_derive/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_ssz_derive" version = "0.3.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" description = "Procedural derive macros to accompany the eth2_ssz crate." license = "Apache-2.0" diff --git a/consensus/ssz_types/Cargo.toml b/consensus/ssz_types/Cargo.toml index 9c23ce92b..2baa8994f 100644 --- a/consensus/ssz_types/Cargo.toml +++ b/consensus/ssz_types/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_ssz_types" version = "0.2.2" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" description = "Provides types with unique properties required for SSZ serialization and Merklization." license = "Apache-2.0" diff --git a/consensus/state_processing/Cargo.toml b/consensus/state_processing/Cargo.toml index c26b020ad..d5599782a 100644 --- a/consensus/state_processing/Cargo.toml +++ b/consensus/state_processing/Cargo.toml @@ -2,7 +2,7 @@ name = "state_processing" version = "0.2.0" authors = ["Paul Hauner ", "Michael Sproul "] -edition = "2018" +edition = "2021" [dev-dependencies] env_logger = "0.9.0" diff --git a/consensus/state_processing/src/lib.rs b/consensus/state_processing/src/lib.rs index cb4ffee78..cf541d457 100644 --- a/consensus/state_processing/src/lib.rs +++ b/consensus/state_processing/src/lib.rs @@ -3,7 +3,7 @@ not(test), deny( clippy::integer_arithmetic, - clippy::disallowed_method, + clippy::disallowed_methods, clippy::indexing_slicing, clippy::unwrap_used, clippy::expect_used, diff --git a/consensus/state_processing/src/per_block_processing/signature_sets.rs b/consensus/state_processing/src/per_block_processing/signature_sets.rs index a3b8dcaf2..5a89bd686 100644 --- a/consensus/state_processing/src/per_block_processing/signature_sets.rs +++ b/consensus/state_processing/src/per_block_processing/signature_sets.rs @@ -177,7 +177,7 @@ where Ok(SignatureSet::single_pubkey( block.body().randao_reveal(), - get_pubkey(proposer_index).ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?, + get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?, message, )) } @@ -199,15 +199,13 @@ where block_header_signature_set( state, &proposer_slashing.signed_header_1, - get_pubkey(proposer_index) - .ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?, + get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?, spec, ), block_header_signature_set( state, &proposer_slashing.signed_header_2, - get_pubkey(proposer_index) - .ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?, + get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?, spec, ), )) @@ -363,7 +361,7 @@ where Ok(SignatureSet::single_pubkey( &signed_exit.signature, - get_pubkey(proposer_index).ok_or_else(|| Error::ValidatorUnknown(proposer_index as u64))?, + get_pubkey(proposer_index).ok_or(Error::ValidatorUnknown(proposer_index as u64))?, message, )) } @@ -521,7 +519,7 @@ where { let mut pubkeys = Vec::with_capacity(T::SyncSubcommitteeSize::to_usize()); for pubkey in pubkey_bytes { - pubkeys.push(get_pubkey(pubkey).ok_or_else(|| Error::ValidatorPubkeyUnknown(*pubkey))?); + pubkeys.push(get_pubkey(pubkey).ok_or(Error::ValidatorPubkeyUnknown(*pubkey))?); } let domain = spec.get_domain(epoch, Domain::SyncCommittee, fork, genesis_validators_root); diff --git a/consensus/state_processing/src/per_epoch_processing/base/rewards_and_penalties.rs b/consensus/state_processing/src/per_epoch_processing/base/rewards_and_penalties.rs index 2c1ef6178..99d08a6db 100644 --- a/consensus/state_processing/src/per_epoch_processing/base/rewards_and_penalties.rs +++ b/consensus/state_processing/src/per_epoch_processing/base/rewards_and_penalties.rs @@ -4,7 +4,6 @@ use crate::per_epoch_processing::{ Delta, Error, }; use safe_arith::SafeArith; -use std::array::IntoIter as ArrayIter; use types::{BeaconState, ChainSpec, EthSpec}; /// Combination of several deltas for different components of an attestation reward. @@ -30,13 +29,13 @@ impl AttestationDelta { inactivity_penalty_delta, } = self; let mut result = Delta::default(); - for delta in ArrayIter::new([ + for delta in [ source_delta, target_delta, head_delta, inclusion_delay_delta, inactivity_penalty_delta, - ]) { + ] { result.combine(delta)?; } Ok(result) diff --git a/consensus/swap_or_not_shuffle/Cargo.toml b/consensus/swap_or_not_shuffle/Cargo.toml index 619d8336d..ada4fba40 100644 --- a/consensus/swap_or_not_shuffle/Cargo.toml +++ b/consensus/swap_or_not_shuffle/Cargo.toml @@ -2,7 +2,7 @@ name = "swap_or_not_shuffle" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [[bench]] name = "benches" diff --git a/consensus/tree_hash/Cargo.toml b/consensus/tree_hash/Cargo.toml index 0c89fab80..bdc724403 100644 --- a/consensus/tree_hash/Cargo.toml +++ b/consensus/tree_hash/Cargo.toml @@ -2,7 +2,7 @@ name = "tree_hash" version = "0.4.1" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" license = "Apache-2.0" description = "Efficient Merkle-hashing as used in Ethereum 2.0" diff --git a/consensus/tree_hash/src/merkle_hasher.rs b/consensus/tree_hash/src/merkle_hasher.rs index c7fdb1746..1753eade1 100644 --- a/consensus/tree_hash/src/merkle_hasher.rs +++ b/consensus/tree_hash/src/merkle_hasher.rs @@ -376,8 +376,8 @@ mod test { fn compare_with_reference(leaves: &[Hash256], depth: usize) { let reference_bytes = leaves .iter() - .map(|hash| hash.as_bytes().to_vec()) - .flatten() + .flat_map(|hash| hash.as_bytes()) + .copied() .collect::>(); let reference_root = merkleize_padded(&reference_bytes, 1 << (depth - 1)); diff --git a/consensus/tree_hash_derive/Cargo.toml b/consensus/tree_hash_derive/Cargo.toml index c9231040e..5f3396eb1 100644 --- a/consensus/tree_hash_derive/Cargo.toml +++ b/consensus/tree_hash_derive/Cargo.toml @@ -2,7 +2,7 @@ name = "tree_hash_derive" version = "0.4.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" description = "Procedural derive macros to accompany the tree_hash crate." license = "Apache-2.0" diff --git a/consensus/tree_hash_derive/src/lib.rs b/consensus/tree_hash_derive/src/lib.rs index f2695b1f8..f65be1b6b 100644 --- a/consensus/tree_hash_derive/src/lib.rs +++ b/consensus/tree_hash_derive/src/lib.rs @@ -109,7 +109,7 @@ fn cached_tree_hash_attr_metas(attrs: &[Attribute]) -> Vec { fn should_skip_hashing(field: &syn::Field) -> bool { field.attrs.iter().any(|attr| { attr.path.is_ident("tree_hash") - && attr.tokens.to_string().replace(" ", "") == "(skip_hashing)" + && attr.tokens.to_string().replace(' ', "") == "(skip_hashing)" }) } diff --git a/consensus/types/Cargo.toml b/consensus/types/Cargo.toml index be1e6907c..acd6b03b9 100644 --- a/consensus/types/Cargo.toml +++ b/consensus/types/Cargo.toml @@ -2,7 +2,7 @@ name = "types" version = "0.2.0" authors = ["Paul Hauner ", "Age Manning "] -edition = "2018" +edition = "2021" [[bench]] name = "benches" diff --git a/consensus/types/src/beacon_state/tree_hash_cache.rs b/consensus/types/src/beacon_state/tree_hash_cache.rs index 40b2c4bde..e67d4096d 100644 --- a/consensus/types/src/beacon_state/tree_hash_cache.rs +++ b/consensus/types/src/beacon_state/tree_hash_cache.rs @@ -1,5 +1,5 @@ #![allow(clippy::integer_arithmetic)] -#![allow(clippy::disallowed_method)] +#![allow(clippy::disallowed_methods)] #![allow(clippy::indexing_slicing)] use super::Error; diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 7e5c66bdb..832f26269 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -7,7 +7,7 @@ not(test), deny( clippy::integer_arithmetic, - clippy::disallowed_method, + clippy::disallowed_methods, clippy::indexing_slicing ) )] diff --git a/crypto/bls/Cargo.toml b/crypto/bls/Cargo.toml index 9600da6df..d71b46dc5 100644 --- a/crypto/bls/Cargo.toml +++ b/crypto/bls/Cargo.toml @@ -2,7 +2,7 @@ name = "bls" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] eth2_ssz = "0.4.1" diff --git a/crypto/eth2_hashing/Cargo.toml b/crypto/eth2_hashing/Cargo.toml index 1eeaff54b..574dbcf2c 100644 --- a/crypto/eth2_hashing/Cargo.toml +++ b/crypto/eth2_hashing/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_hashing" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" license = "Apache-2.0" description = "Hashing primitives used in Ethereum 2.0" diff --git a/crypto/eth2_key_derivation/Cargo.toml b/crypto/eth2_key_derivation/Cargo.toml index 1fd73bad2..43a8fe88b 100644 --- a/crypto/eth2_key_derivation/Cargo.toml +++ b/crypto/eth2_key_derivation/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_key_derivation" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crypto/eth2_key_derivation/src/derived_key.rs b/crypto/eth2_key_derivation/src/derived_key.rs index 1598619df..b3373782a 100644 --- a/crypto/eth2_key_derivation/src/derived_key.rs +++ b/crypto/eth2_key_derivation/src/derived_key.rs @@ -148,8 +148,7 @@ fn parent_sk_to_lamport_pk(ikm: &[u8], index: u32) -> ZeroizeHash { lamports .iter() - .map(LamportSecretKey::iter_chunks) - .flatten() + .flat_map(LamportSecretKey::iter_chunks) .enumerate() .for_each(|(i, chunk)| { let mut hasher = Sha256::new(); diff --git a/crypto/eth2_keystore/Cargo.toml b/crypto/eth2_keystore/Cargo.toml index a629f9a37..2bfdde8ac 100644 --- a/crypto/eth2_keystore/Cargo.toml +++ b/crypto/eth2_keystore/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_keystore" version = "0.1.0" authors = ["Pawan Dhananjay "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crypto/eth2_wallet/Cargo.toml b/crypto/eth2_wallet/Cargo.toml index eeebfbfb4..e564209b6 100644 --- a/crypto/eth2_wallet/Cargo.toml +++ b/crypto/eth2_wallet/Cargo.toml @@ -2,7 +2,7 @@ name = "eth2_wallet" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/lcli/Cargo.toml b/lcli/Cargo.toml index 07f02a40b..965b16d6b 100644 --- a/lcli/Cargo.toml +++ b/lcli/Cargo.toml @@ -3,7 +3,7 @@ name = "lcli" description = "Lighthouse CLI (modeled after zcli)" version = "2.1.3" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [features] portable = ["bls/supranational-portable"] diff --git a/lcli/src/etl/block_efficiency.rs b/lcli/src/etl/block_efficiency.rs index 87175ace8..144642810 100644 --- a/lcli/src/etl/block_efficiency.rs +++ b/lcli/src/etl/block_efficiency.rs @@ -74,9 +74,9 @@ async fn get_block_attestations_set<'a, T: EthSpec>( .graffiti() .as_utf8_lossy() // Remove commas and apostropes from graffiti to ensure correct CSV format. - .replace(",", "") - .replace("\"", "") - .replace("'", ""), + .replace(',', "") + .replace('"', "") + .replace('\'', ""), }; let attestations = block.message().body().attestations(); diff --git a/lighthouse/Cargo.toml b/lighthouse/Cargo.toml index 5cf04b3b4..0b4b38b58 100644 --- a/lighthouse/Cargo.toml +++ b/lighthouse/Cargo.toml @@ -2,7 +2,7 @@ name = "lighthouse" version = "2.1.3" authors = ["Sigma Prime "] -edition = "2018" +edition = "2021" autotests = false [features] diff --git a/lighthouse/environment/Cargo.toml b/lighthouse/environment/Cargo.toml index ee196e70f..7dc31e06b 100644 --- a/lighthouse/environment/Cargo.toml +++ b/lighthouse/environment/Cargo.toml @@ -2,7 +2,7 @@ name = "environment" version = "0.1.2" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] tokio = { version = "1.14.0", features = ["macros", "rt", "rt-multi-thread", "signal" ] } diff --git a/slasher/Cargo.toml b/slasher/Cargo.toml index c319c2de1..0139b6624 100644 --- a/slasher/Cargo.toml +++ b/slasher/Cargo.toml @@ -2,7 +2,7 @@ name = "slasher" version = "0.1.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] bincode = "1.3.1" diff --git a/slasher/service/Cargo.toml b/slasher/service/Cargo.toml index 9aef23f4d..63cf1e464 100644 --- a/slasher/service/Cargo.toml +++ b/slasher/service/Cargo.toml @@ -2,7 +2,7 @@ name = "slasher_service" version = "0.1.0" authors = ["Michael Sproul "] -edition = "2018" +edition = "2021" [dependencies] beacon_chain = { path = "../../beacon_node/beacon_chain" } diff --git a/testing/ef_tests/Cargo.toml b/testing/ef_tests/Cargo.toml index 681967466..e04d67139 100644 --- a/testing/ef_tests/Cargo.toml +++ b/testing/ef_tests/Cargo.toml @@ -2,7 +2,7 @@ name = "ef_tests" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [features] # `ef_tests` feature must be enabled to actually run the tests diff --git a/testing/ef_tests/src/cases/epoch_processing.rs b/testing/ef_tests/src/cases/epoch_processing.rs index b187d46fe..08722c8e4 100644 --- a/testing/ef_tests/src/cases/epoch_processing.rs +++ b/testing/ef_tests/src/cases/epoch_processing.rs @@ -259,10 +259,7 @@ impl> LoadCase for EpochProcessing { impl> Case for EpochProcessing { fn description(&self) -> String { - self.metadata - .description - .clone() - .unwrap_or_else(String::new) + self.metadata.description.clone().unwrap_or_default() } fn is_enabled_for_fork(fork_name: ForkName) -> bool { diff --git a/testing/ef_tests/src/cases/operations.rs b/testing/ef_tests/src/cases/operations.rs index 195df7f38..2e7802225 100644 --- a/testing/ef_tests/src/cases/operations.rs +++ b/testing/ef_tests/src/cases/operations.rs @@ -304,10 +304,7 @@ impl> LoadCase for Operations { impl> Case for Operations { fn description(&self) -> String { - self.metadata - .description - .clone() - .unwrap_or_else(String::new) + self.metadata.description.clone().unwrap_or_default() } fn is_enabled_for_fork(fork_name: ForkName) -> bool { diff --git a/testing/ef_tests/src/cases/rewards.rs b/testing/ef_tests/src/cases/rewards.rs index 8aa041bce..c59ceabe0 100644 --- a/testing/ef_tests/src/cases/rewards.rs +++ b/testing/ef_tests/src/cases/rewards.rs @@ -103,10 +103,7 @@ impl LoadCase for RewardsTest { impl Case for RewardsTest { fn description(&self) -> String { - self.metadata - .description - .clone() - .unwrap_or_else(String::new) + self.metadata.description.clone().unwrap_or_default() } fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { diff --git a/testing/ef_tests/src/cases/sanity_blocks.rs b/testing/ef_tests/src/cases/sanity_blocks.rs index c155be877..5f0db25de 100644 --- a/testing/ef_tests/src/cases/sanity_blocks.rs +++ b/testing/ef_tests/src/cases/sanity_blocks.rs @@ -56,10 +56,7 @@ impl LoadCase for SanityBlocks { impl Case for SanityBlocks { fn description(&self) -> String { - self.metadata - .description - .clone() - .unwrap_or_else(String::new) + self.metadata.description.clone().unwrap_or_default() } fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { diff --git a/testing/ef_tests/src/cases/sanity_slots.rs b/testing/ef_tests/src/cases/sanity_slots.rs index 93a05b364..a38a8930a 100644 --- a/testing/ef_tests/src/cases/sanity_slots.rs +++ b/testing/ef_tests/src/cases/sanity_slots.rs @@ -50,10 +50,7 @@ impl LoadCase for SanitySlots { impl Case for SanitySlots { fn description(&self) -> String { - self.metadata - .description - .clone() - .unwrap_or_else(String::new) + self.metadata.description.clone().unwrap_or_default() } fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> { diff --git a/testing/eth1_test_rig/Cargo.toml b/testing/eth1_test_rig/Cargo.toml index 787a571e8..57162f97b 100644 --- a/testing/eth1_test_rig/Cargo.toml +++ b/testing/eth1_test_rig/Cargo.toml @@ -2,7 +2,7 @@ name = "eth1_test_rig" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] tokio = { version = "1.14.0", features = ["time"] } diff --git a/testing/node_test_rig/Cargo.toml b/testing/node_test_rig/Cargo.toml index be2416a6c..8e4b8595d 100644 --- a/testing/node_test_rig/Cargo.toml +++ b/testing/node_test_rig/Cargo.toml @@ -2,7 +2,7 @@ name = "node_test_rig" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" [dependencies] environment = { path = "../../lighthouse/environment" } diff --git a/testing/simulator/Cargo.toml b/testing/simulator/Cargo.toml index 78919c8e7..c2f435fab 100644 --- a/testing/simulator/Cargo.toml +++ b/testing/simulator/Cargo.toml @@ -2,7 +2,7 @@ name = "simulator" version = "0.2.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/testing/state_transition_vectors/Cargo.toml b/testing/state_transition_vectors/Cargo.toml index 1192f7990..4e93db3b3 100644 --- a/testing/state_transition_vectors/Cargo.toml +++ b/testing/state_transition_vectors/Cargo.toml @@ -2,7 +2,7 @@ name = "state_transition_vectors" version = "0.1.0" authors = ["Paul Hauner "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/testing/test-test_logger/Cargo.toml b/testing/test-test_logger/Cargo.toml index d2a8b87b6..3d91862db 100644 --- a/testing/test-test_logger/Cargo.toml +++ b/testing/test-test_logger/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test-test_logger" version = "0.1.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/testing/web3signer_tests/Cargo.toml b/testing/web3signer_tests/Cargo.toml index 16a4b1b10..8ce583006 100644 --- a/testing/web3signer_tests/Cargo.toml +++ b/testing/web3signer_tests/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "web3signer_tests" version = "0.1.0" -edition = "2018" +edition = "2021" build = "build.rs" diff --git a/validator_client/Cargo.toml b/validator_client/Cargo.toml index 08f5cec07..a1604064a 100644 --- a/validator_client/Cargo.toml +++ b/validator_client/Cargo.toml @@ -2,7 +2,7 @@ name = "validator_client" version = "0.3.5" authors = ["Paul Hauner ", "Age Manning ", "Luke Anderson "] -edition = "2018" +edition = "2021" [lib] name = "validator_client" diff --git a/validator_client/slashing_protection/Cargo.toml b/validator_client/slashing_protection/Cargo.toml index 697bd602b..55e7f3f71 100644 --- a/validator_client/slashing_protection/Cargo.toml +++ b/validator_client/slashing_protection/Cargo.toml @@ -2,7 +2,7 @@ name = "slashing_protection" version = "0.1.0" authors = ["Michael Sproul ", "pscott "] -edition = "2018" +edition = "2021" autotests = false [[test]] diff --git a/validator_client/slashing_protection/src/slashing_database.rs b/validator_client/slashing_protection/src/slashing_database.rs index 9f585c010..9a743ee18 100644 --- a/validator_client/slashing_protection/src/slashing_database.rs +++ b/validator_client/slashing_protection/src/slashing_database.rs @@ -287,7 +287,7 @@ impl SlashingDatabase { ) -> Result { let (validator_id, enabled) = self .get_validator_id_with_status(txn, public_key)? - .ok_or_else(|| NotSafe::UnregisteredValidator(*public_key))?; + .ok_or(NotSafe::UnregisteredValidator(*public_key))?; if enabled { Ok(validator_id) } else { @@ -303,7 +303,7 @@ impl SlashingDatabase { ) -> Result { let (validator_id, _) = self .get_validator_id_with_status(txn, public_key)? - .ok_or_else(|| NotSafe::UnregisteredValidator(*public_key))?; + .ok_or(NotSafe::UnregisteredValidator(*public_key))?; Ok(validator_id) } diff --git a/validator_client/src/http_api/tests/keystores.rs b/validator_client/src/http_api/tests/keystores.rs index c56f2f229..427f22adc 100644 --- a/validator_client/src/http_api/tests/keystores.rs +++ b/validator_client/src/http_api/tests/keystores.rs @@ -5,7 +5,6 @@ use eth2::lighthouse_vc::{ std_types::{KeystoreJsonStr as Keystore, *}, types::Web3SignerValidatorRequest, }; -// use eth2_keystore::Keystore; use itertools::Itertools; use rand::{rngs::SmallRng, Rng, SeedableRng}; use slashing_protection::interchange::{Interchange, InterchangeMetadata}; @@ -148,6 +147,7 @@ fn check_delete_response<'a>( #[test] fn get_auth_no_token() { run_test(|mut tester| async move { + let _ = &tester; tester.client.send_authorization_header(false); let auth_response = tester.client.get_auth().await.unwrap(); @@ -163,6 +163,7 @@ fn get_auth_no_token() { #[test] fn get_empty_keystores() { run_test(|tester| async move { + let _ = &tester; let res = tester.client.get_keystores().await.unwrap(); assert_eq!(res, ListKeystoresResponse { data: vec![] }); }) @@ -171,6 +172,7 @@ fn get_empty_keystores() { #[test] fn import_new_keystores() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..3) .map(|_| new_keystore(password.clone())) @@ -198,6 +200,7 @@ fn import_new_keystores() { #[test] fn import_only_duplicate_keystores() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..3) .map(|_| new_keystore(password.clone())) @@ -226,6 +229,7 @@ fn import_only_duplicate_keystores() { #[test] fn import_some_duplicate_keystores() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let num_keystores = 5; let keystores_all = (0..num_keystores) @@ -276,6 +280,7 @@ fn import_some_duplicate_keystores() { #[test] fn import_wrong_number_of_passwords() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..3) .map(|_| new_keystore(password.clone())) @@ -297,6 +302,7 @@ fn import_wrong_number_of_passwords() { #[test] fn get_web3_signer_keystores() { run_test(|tester| async move { + let _ = &tester; let num_local = 3; let num_remote = 2; @@ -356,6 +362,7 @@ fn get_web3_signer_keystores() { #[test] fn import_and_delete_conflicting_web3_signer_keystores() { run_test(|tester| async move { + let _ = &tester; let num_keystores = 3; // Create some keystores to be used as both web3signer keystores and local keystores. @@ -420,6 +427,7 @@ fn import_and_delete_conflicting_web3_signer_keystores() { #[test] fn import_keystores_wrong_password() { run_test(|tester| async move { + let _ = &tester; let num_keystores = 4; let (keystores, correct_passwords): (Vec<_>, Vec<_>) = (0..num_keystores) .map(|_| { @@ -494,6 +502,7 @@ fn import_keystores_wrong_password() { #[test] fn import_invalid_slashing_protection() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..3) .map(|_| new_keystore(password.clone())) @@ -642,6 +651,7 @@ fn generic_migration_test( second_vc_attestations: Vec<(usize, Attestation, bool)>, ) { run_dual_vc_test(move |tester1, tester2| async move { + let _ = (&tester1, &tester2); // Create the validators on VC1. let (keystores, passwords): (Vec<_>, Vec<_>) = (0..num_validators) .map(|_| { @@ -756,6 +766,7 @@ fn generic_migration_test( #[test] fn delete_keystores_twice() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..2) .map(|_| new_keystore(password.clone())) @@ -786,6 +797,7 @@ fn delete_keystores_twice() { #[test] fn delete_nonexistent_keystores() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..2) .map(|_| new_keystore(password.clone())) @@ -947,6 +959,7 @@ fn delete_concurrent_with_signing() { #[test] fn delete_then_reimport() { run_test(|tester| async move { + let _ = &tester; let password = random_password_string(); let keystores = (0..2) .map(|_| new_keystore(password.clone()))