Skip to content

Commit 82d1674

Browse files
authored
Rust 1.86.0 lints (#7254)
Implement lints for the new Rust compiler version 1.86.0.
1 parent 0850bcf commit 82d1674

File tree

25 files changed

+52
-52
lines changed

25 files changed

+52
-52
lines changed

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
741741
///
742742
/// - `slot` always increases by `1`.
743743
/// - Skipped slots contain the root of the closest prior
744-
/// non-skipped slot (identical to the way they are stored in `state.block_roots`).
744+
/// non-skipped slot (identical to the way they are stored in `state.block_roots`).
745745
/// - Iterator returns `(Hash256, Slot)`.
746746
///
747747
/// Will return a `BlockOutOfRange` error if the requested start slot is before the period of
@@ -805,7 +805,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
805805
///
806806
/// - `slot` always decreases by `1`.
807807
/// - Skipped slots contain the root of the closest prior
808-
/// non-skipped slot (identical to the way they are stored in `state.block_roots`) .
808+
/// non-skipped slot (identical to the way they are stored in `state.block_roots`) .
809809
/// - Iterator returns `(Hash256, Slot)`.
810810
/// - The provided `block_root` is included as the first item in the iterator.
811811
pub fn rev_iter_block_roots_from(
@@ -834,7 +834,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
834834
/// - `slot` always decreases by `1`.
835835
/// - Iterator returns `(Hash256, Slot)`.
836836
/// - As this iterator starts at the `head` of the chain (viz., the best block), the first slot
837-
/// returned may be earlier than the wall-clock slot.
837+
/// returned may be earlier than the wall-clock slot.
838838
pub fn rev_iter_state_roots_from<'a>(
839839
&'a self,
840840
state_root: Hash256,

beacon_node/beacon_chain/src/beacon_proposer_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn compute_proposer_duties_from_head<T: BeaconChainTypes>(
178178
/// - Returns an error if `state.current_epoch() > target_epoch`.
179179
/// - No-op if `state.current_epoch() == target_epoch`.
180180
/// - It must be the case that `state.canonical_root() == state_root`, but this function will not
181-
/// check that.
181+
/// check that.
182182
pub fn ensure_state_is_in_epoch<E: EthSpec>(
183183
state: &mut BeaconState<E>,
184184
state_root: Hash256,

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! - Verification for gossip blocks (i.e., should we gossip some block from the network).
66
//! - Verification for normal blocks (e.g., some block received on the RPC during a parent lookup).
77
//! - Verification for chain segments (e.g., some chain of blocks received on the RPC during a
8-
//! sync).
8+
//! sync).
99
//!
1010
//! The primary source of complexity here is that we wish to avoid doing duplicate work as a block
1111
//! moves through the verification process. For example, if some block is verified for gossip, we

beacon_node/beacon_chain/src/early_attester_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct CacheItem<E: EthSpec> {
3333
///
3434
/// - Produce an attestation without using `chain.canonical_head`.
3535
/// - Verify that a block root exists (i.e., will be imported in the future) during attestation
36-
/// verification.
36+
/// verification.
3737
/// - Provide a block which can be sent to peers via RPC.
3838
#[derive(Default)]
3939
pub struct EarlyAttesterCache<E: EthSpec> {

beacon_node/beacon_chain/src/eth1_finalization_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ pub mod tests {
469469
let last_finalized_eth1 = eth1s_by_count
470470
.range(0..(finalized_deposits + 1))
471471
.map(|(_, eth1)| eth1)
472-
.last()
472+
.next_back()
473473
.cloned();
474474
assert_eq!(
475475
eth1cache.finalize(finalized_checkpoint),

beacon_node/beacon_chain/tests/payload_invalidation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ impl InvalidHeadSetup {
12831283
///
12841284
/// 1. A chain where the only viable head block has an invalid execution payload.
12851285
/// 2. A block (`fork_block`) which will become the head of the chain when
1286-
/// it is imported.
1286+
/// it is imported.
12871287
async fn new() -> InvalidHeadSetup {
12881288
let slots_per_epoch = E::slots_per_epoch();
12891289
let mut rig = InvalidPayloadRig::new().enable_attestations();

beacon_node/execution_layer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ impl<E: EthSpec> ExecutionLayer<E> {
17101710
///
17111711
/// - `Some(true)` if the given `block_hash` is the terminal proof-of-work block.
17121712
/// - `Some(false)` if the given `block_hash` is certainly *not* the terminal proof-of-work
1713-
/// block.
1713+
/// block.
17141714
/// - `None` if the `block_hash` or its parent were not present on the execution engine.
17151715
/// - `Err(_)` if there was an error connecting to the execution engine.
17161716
///

beacon_node/lighthouse_network/src/peer_manager/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -992,23 +992,23 @@ impl<E: EthSpec> PeerManager<E> {
992992
/// - Do not prune outbound peers to exceed our outbound target.
993993
/// - Do not prune more peers than our target peer count.
994994
/// - If we have an option to remove a number of peers, remove ones that have the least
995-
/// long-lived subnets.
995+
/// long-lived subnets.
996996
/// - When pruning peers based on subnet count. If multiple peers can be chosen, choose a peer
997-
/// that is not subscribed to a long-lived sync committee subnet.
997+
/// that is not subscribed to a long-lived sync committee subnet.
998998
/// - When pruning peers based on subnet count, do not prune a peer that would lower us below the
999-
/// MIN_SYNC_COMMITTEE_PEERS peer count. To keep it simple, we favour a minimum number of sync-committee-peers over
1000-
/// uniformity subnet peers. NOTE: We could apply more sophisticated logic, but the code is
1001-
/// simpler and easier to maintain if we take this approach. If we are pruning subnet peers
1002-
/// below the MIN_SYNC_COMMITTEE_PEERS and maintaining the sync committee peers, this should be
1003-
/// fine as subnet peers are more likely to be found than sync-committee-peers. Also, we're
1004-
/// in a bit of trouble anyway if we have so few peers on subnets. The
1005-
/// MIN_SYNC_COMMITTEE_PEERS
1006-
/// number should be set low as an absolute lower bound to maintain peers on the sync
1007-
/// committees.
999+
/// MIN_SYNC_COMMITTEE_PEERS peer count. To keep it simple, we favour a minimum number of sync-committee-peers over
1000+
/// uniformity subnet peers. NOTE: We could apply more sophisticated logic, but the code is
1001+
/// simpler and easier to maintain if we take this approach. If we are pruning subnet peers
1002+
/// below the MIN_SYNC_COMMITTEE_PEERS and maintaining the sync committee peers, this should be
1003+
/// fine as subnet peers are more likely to be found than sync-committee-peers. Also, we're
1004+
/// in a bit of trouble anyway if we have so few peers on subnets. The
1005+
/// MIN_SYNC_COMMITTEE_PEERS
1006+
/// number should be set low as an absolute lower bound to maintain peers on the sync
1007+
/// committees.
10081008
/// - Do not prune trusted peers. NOTE: This means if a user has more trusted peers than the
1009-
/// excess peer limit, all of the following logic is subverted as we will not prune any peers.
1010-
/// Also, the more trusted peers a user has, the less room Lighthouse has to efficiently manage
1011-
/// its peers across the subnets.
1009+
/// excess peer limit, all of the following logic is subverted as we will not prune any peers.
1010+
/// Also, the more trusted peers a user has, the less room Lighthouse has to efficiently manage
1011+
/// its peers across the subnets.
10121012
///
10131013
/// Prune peers in the following order:
10141014
/// 1. Remove worst scoring peers

beacon_node/lighthouse_network/src/peer_manager/peerdb.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl<E: EthSpec> PeerDB<E> {
155155
matches!(
156156
self.connection_status(peer_id),
157157
Some(PeerConnectionStatus::Disconnected { .. })
158-
| Some(PeerConnectionStatus::Unknown { .. })
158+
| Some(PeerConnectionStatus::Unknown)
159159
| None
160160
) && !self.score_state_banned_or_disconnected(peer_id)
161161
}
@@ -776,8 +776,8 @@ impl<E: EthSpec> PeerDB<E> {
776776
NewConnectionState::Connected { .. } // We have established a new connection (peer may not have been seen before)
777777
| NewConnectionState::Disconnecting { .. }// We are disconnecting from a peer that may not have been registered before
778778
| NewConnectionState::Dialing { .. } // We are dialing a potentially new peer
779-
| NewConnectionState::Disconnected { .. } // Dialing a peer that responds by a different ID can be immediately
780-
// disconnected without having being stored in the db before
779+
| NewConnectionState::Disconnected // Dialing a peer that responds by a different ID can be immediately
780+
// disconnected without having being stored in the db before
781781
) {
782782
warn!(log_ref, "Updating state of unknown peer";
783783
"peer_id" => %peer_id, "new_state" => ?new_state);

beacon_node/lighthouse_network/src/rpc/codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ mod tests {
10091009
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
10101010
BeaconBlockBellatrix::empty(&Spec::default_spec());
10111011
let tx = VariableList::from(vec![0; 1024]);
1012-
let txs = VariableList::from(std::iter::repeat(tx).take(5000).collect::<Vec<_>>());
1012+
let txs = VariableList::from(std::iter::repeat_n(tx, 5000).collect::<Vec<_>>());
10131013

10141014
block.body.execution_payload.execution_payload.transactions = txs;
10151015

@@ -1028,7 +1028,7 @@ mod tests {
10281028
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
10291029
BeaconBlockBellatrix::empty(&Spec::default_spec());
10301030
let tx = VariableList::from(vec![0; 1024]);
1031-
let txs = VariableList::from(std::iter::repeat(tx).take(100000).collect::<Vec<_>>());
1031+
let txs = VariableList::from(std::iter::repeat_n(tx, 100000).collect::<Vec<_>>());
10321032

10331033
block.body.execution_payload.execution_payload.transactions = txs;
10341034

0 commit comments

Comments
 (0)