diff --git a/Cargo.lock b/Cargo.lock index f9e2c64..1a2ed81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ad_hoc_bench" diff --git a/Cargo.toml b/Cargo.toml index da0aefa..8c9e7e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,6 +88,7 @@ let_underscore_drop = 'warn' macro_use_extern_crate = 'warn' meta_variable_misuse = 'warn' non_ascii_idents = 'warn' +non_local_definitions = 'warn' trivial_casts = 'warn' trivial_numeric_casts = 'warn' unit_bindings = 'warn' @@ -140,7 +141,7 @@ wildcard_dependencies = 'warn' # # - `clippy::single_call_fn`. # It's unidiomatic and conflicts with lints like `clippy::too_many_lines`. -# Public functions are not exempt from it as of Rust 1.77.2. +# Public functions are not exempt from it if `avoid-breaking-exported-api` is `false`. # # - `clippy::std_instead_of_alloc` # It would require adding `extern crate alloc;` everywhere. diff --git a/benches/benches/hashing.rs b/benches/benches/hashing.rs index ad727b6..ca36269 100644 --- a/benches/benches/hashing.rs +++ b/benches/benches/hashing.rs @@ -89,7 +89,7 @@ fn main() { criterion.final_summary(); } -// Arrays of arbitrary length do not implement `Default` as of Rust 1.77.2. +// Arrays of arbitrary length do not implement `Default` as of Rust 1.78.0. // See . // We work around that by using `PublicKeyBytes` and `SignatureBytes` instead. diff --git a/clippy.toml b/clippy.toml index 95bf39f..f859fac 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,9 +1,12 @@ avoid-breaking-exported-api = false doc-valid-idents = [ + '..', 'Eth1Data', 'PoS', 'PoW', 'RocksDB', + 'UPnP', + 'Web3Signer', ] # There appears to be no way to disallow an entire module. # There is an issue for it at . diff --git a/fork_choice_control/src/mutator.rs b/fork_choice_control/src/mutator.rs index 0524748..749be41 100644 --- a/fork_choice_control/src/mutator.rs +++ b/fork_choice_control/src/mutator.rs @@ -342,7 +342,7 @@ where .blob_kzg_commitments() .iter() .copied() - .map(helper_functions::misc::kzg_commitment_to_versioned_hash) + .map(misc::kzg_commitment_to_versioned_hash) .collect(); params = Some(ExecutionPayloadParams::Deneb { @@ -2007,7 +2007,7 @@ where let mut gossip_ids = vec![]; - // Use `drain_filter_polyfill` because `Vec::extract_if` is not stable as of Rust 1.77.2. + // Use `drain_filter_polyfill` because `Vec::extract_if` is not stable as of Rust 1.78.0. self.delayed_until_block.retain(|_, delayed| { let Delayed { blocks, @@ -2081,7 +2081,7 @@ where let mut gossip_ids = vec![]; - // Use `HashMap::retain` because `HashMap::extract_if` is not stable as of Rust 1.77.2. + // Use `HashMap::retain` because `HashMap::extract_if` is not stable as of Rust 1.78.0. self.waiting_for_checkpoint_states .retain(|target, waiting| { let prune = target.epoch < finalized_epoch; diff --git a/grandine/src/grandine_args.rs b/grandine/src/grandine_args.rs index f7b0157..667251a 100644 --- a/grandine/src/grandine_args.rs +++ b/grandine/src/grandine_args.rs @@ -1,3 +1,7 @@ +// Adding backquotes to doc comments affects `--help` output. +// `clap` derive macros preserve backquotes even if `verbatim_doc_comment` is disabled. +#![allow(clippy::doc_markdown)] + use core::{ fmt::Display, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, diff --git a/http_api/src/error.rs b/http_api/src/error.rs index 1ee035d..90537f8 100644 --- a/http_api/src/error.rs +++ b/http_api/src/error.rs @@ -158,7 +158,7 @@ impl Error { self.sources().format(": ") } - // `StdError::sources` is not stable as of Rust 1.77.2. + // `StdError::sources` is not stable as of Rust 1.78.0. fn sources(&self) -> impl Iterator { let mut error: Option<&dyn StdError> = Some(self); diff --git a/http_api_utils/src/error.rs b/http_api_utils/src/error.rs index a131bd5..b1ac130 100644 --- a/http_api_utils/src/error.rs +++ b/http_api_utils/src/error.rs @@ -37,7 +37,7 @@ impl Error { self.sources().format(": ") } - // `StdError::sources` is not stable as of Rust 1.77.2. + // `StdError::sources` is not stable as of Rust 1.78.0. fn sources(&self) -> impl Iterator { let mut error: Option<&dyn StdError> = Some(self); diff --git a/p2p/src/network.rs b/p2p/src/network.rs index 76570ff..9316c0c 100644 --- a/p2p/src/network.rs +++ b/p2p/src/network.rs @@ -24,7 +24,7 @@ use eth2_libp2p::{ }; use fork_choice_control::P2pMessage; use futures::{ - channel::mpsc::{self, Receiver, UnboundedReceiver, UnboundedSender}, + channel::mpsc::{Receiver, UnboundedReceiver, UnboundedSender}, future::FutureExt as _, select, stream::StreamExt as _, @@ -174,8 +174,8 @@ impl Network

{ } } - let (network_to_service_tx, network_to_service_rx) = mpsc::unbounded(); - let (service_to_network_tx, service_to_network_rx) = mpsc::unbounded(); + let (network_to_service_tx, network_to_service_rx) = futures::channel::mpsc::unbounded(); + let (service_to_network_tx, service_to_network_rx) = futures::channel::mpsc::unbounded(); run_network_service(service, network_to_service_rx, service_to_network_tx); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b470004..db7cc5e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = 'stable-2024-04-09' +channel = 'stable-2024-05-02' profile = 'minimal' components = ['clippy', 'rustfmt'] diff --git a/ssz/src/merkle_tree.rs b/ssz/src/merkle_tree.rs index df927ac..8656435 100644 --- a/ssz/src/merkle_tree.rs +++ b/ssz/src/merkle_tree.rs @@ -237,7 +237,7 @@ impl> MerkleTree { // ``` // See . // - // `usize::saturating_shr` does not exist as of Rust 1.77.2. + // `usize::saturating_shr` does not exist as of Rust 1.78.0. let filled_left_subtree = usize::MAX .checked_shr(chunk_indices.start.leading_ones()) .unwrap_or_default(); diff --git a/ssz/src/persistent_list.rs b/ssz/src/persistent_list.rs index 61796ff..410e1c4 100644 --- a/ssz/src/persistent_list.rs +++ b/ssz/src/persistent_list.rs @@ -568,6 +568,13 @@ impl> Node { loop { match node { + // False positive. See: + // - + // - + // - + // - + // - + #[allow(clippy::assigning_clones)] Self::Internal { left, left_height, .. } if B::depth_of_length(length) <= *left_height => { diff --git a/validator/src/api.rs b/validator/src/api.rs index 4288a66..abcc7ae 100644 --- a/validator/src/api.rs +++ b/validator/src/api.rs @@ -137,7 +137,7 @@ impl Error { self.sources().format(": ") } - // `StdError::sources` is not stable as of Rust 1.77.2. + // `StdError::sources` is not stable as of Rust 1.78.0. fn sources(&self) -> impl Iterator { let mut error: Option<&dyn StdError> = Some(self); diff --git a/validator/src/own_sync_committee_subscriptions.rs b/validator/src/own_sync_committee_subscriptions.rs index c9e4a83..1d3f1c5 100644 --- a/validator/src/own_sync_committee_subscriptions.rs +++ b/validator/src/own_sync_committee_subscriptions.rs @@ -31,7 +31,7 @@ impl OwnSyncCommitteeSubscriptions

{ let next_period = current_period + 1; let next_period_start = misc::start_of_sync_committee_period::

(next_period); - if self.subscriptions.get(¤t_period).is_none() { + if self.subscriptions.contains_key(¤t_period) { let subscriptions = core::iter::repeat(current_epoch) .zip(sync_committee_subscriptions( state, @@ -44,7 +44,7 @@ impl OwnSyncCommitteeSubscriptions

{ self.subscriptions.insert(current_period, subscriptions); } - if self.subscriptions.get(&next_period).is_none() { + if self.subscriptions.contains_key(&next_period) { let next_period_expiration = misc::start_of_sync_committee_period::

(next_period + 1); let mut rng = rand::thread_rng();