mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-04 21:34:36 +00:00
Rust 1.86.0 lints (#7254)
Implement lints for the new Rust compiler version 1.86.0.
This commit is contained in:
@@ -469,7 +469,7 @@ pub mod tests {
|
|||||||
let last_finalized_eth1 = eth1s_by_count
|
let last_finalized_eth1 = eth1s_by_count
|
||||||
.range(0..(finalized_deposits + 1))
|
.range(0..(finalized_deposits + 1))
|
||||||
.map(|(_, eth1)| eth1)
|
.map(|(_, eth1)| eth1)
|
||||||
.last()
|
.next_back()
|
||||||
.cloned();
|
.cloned();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
eth1cache.finalize(finalized_checkpoint),
|
eth1cache.finalize(finalized_checkpoint),
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ impl<E: EthSpec> PeerDB<E> {
|
|||||||
matches!(
|
matches!(
|
||||||
self.connection_status(peer_id),
|
self.connection_status(peer_id),
|
||||||
Some(PeerConnectionStatus::Disconnected { .. })
|
Some(PeerConnectionStatus::Disconnected { .. })
|
||||||
| Some(PeerConnectionStatus::Unknown { .. })
|
| Some(PeerConnectionStatus::Unknown)
|
||||||
| None
|
| None
|
||||||
) && !self.score_state_banned_or_disconnected(peer_id)
|
) && !self.score_state_banned_or_disconnected(peer_id)
|
||||||
}
|
}
|
||||||
@@ -776,7 +776,7 @@ impl<E: EthSpec> PeerDB<E> {
|
|||||||
NewConnectionState::Connected { .. } // We have established a new connection (peer may not have been seen before)
|
NewConnectionState::Connected { .. } // We have established a new connection (peer may not have been seen before)
|
||||||
| NewConnectionState::Disconnecting { .. }// We are disconnecting from a peer that may not have been registered before
|
| NewConnectionState::Disconnecting { .. }// We are disconnecting from a peer that may not have been registered before
|
||||||
| NewConnectionState::Dialing { .. } // We are dialing a potentially new peer
|
| NewConnectionState::Dialing { .. } // We are dialing a potentially new peer
|
||||||
| NewConnectionState::Disconnected { .. } // Dialing a peer that responds by a different ID can be immediately
|
| NewConnectionState::Disconnected // Dialing a peer that responds by a different ID can be immediately
|
||||||
// disconnected without having being stored in the db before
|
// disconnected without having being stored in the db before
|
||||||
) {
|
) {
|
||||||
warn!(log_ref, "Updating state of unknown peer";
|
warn!(log_ref, "Updating state of unknown peer";
|
||||||
|
|||||||
@@ -1009,7 +1009,7 @@ mod tests {
|
|||||||
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
|
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
|
||||||
BeaconBlockBellatrix::empty(&Spec::default_spec());
|
BeaconBlockBellatrix::empty(&Spec::default_spec());
|
||||||
let tx = VariableList::from(vec![0; 1024]);
|
let tx = VariableList::from(vec![0; 1024]);
|
||||||
let txs = VariableList::from(std::iter::repeat(tx).take(5000).collect::<Vec<_>>());
|
let txs = VariableList::from(std::iter::repeat_n(tx, 5000).collect::<Vec<_>>());
|
||||||
|
|
||||||
block.body.execution_payload.execution_payload.transactions = txs;
|
block.body.execution_payload.execution_payload.transactions = txs;
|
||||||
|
|
||||||
@@ -1028,7 +1028,7 @@ mod tests {
|
|||||||
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
|
let mut block: BeaconBlockBellatrix<_, FullPayload<Spec>> =
|
||||||
BeaconBlockBellatrix::empty(&Spec::default_spec());
|
BeaconBlockBellatrix::empty(&Spec::default_spec());
|
||||||
let tx = VariableList::from(vec![0; 1024]);
|
let tx = VariableList::from(vec![0; 1024]);
|
||||||
let txs = VariableList::from(std::iter::repeat(tx).take(100000).collect::<Vec<_>>());
|
let txs = VariableList::from(std::iter::repeat_n(tx, 100000).collect::<Vec<_>>());
|
||||||
|
|
||||||
block.body.execution_payload.execution_payload.transactions = txs;
|
block.body.execution_payload.execution_payload.transactions = txs;
|
||||||
|
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ impl std::fmt::Display for SyncState {
|
|||||||
match self {
|
match self {
|
||||||
SyncState::SyncingFinalized { .. } => write!(f, "Syncing Finalized Chain"),
|
SyncState::SyncingFinalized { .. } => write!(f, "Syncing Finalized Chain"),
|
||||||
SyncState::SyncingHead { .. } => write!(f, "Syncing Head Chain"),
|
SyncState::SyncingHead { .. } => write!(f, "Syncing Head Chain"),
|
||||||
SyncState::Synced { .. } => write!(f, "Synced"),
|
SyncState::Synced => write!(f, "Synced"),
|
||||||
SyncState::Stalled { .. } => write!(f, "Stalled"),
|
SyncState::Stalled => write!(f, "Stalled"),
|
||||||
SyncState::SyncTransition => write!(f, "Evaluating known peers"),
|
SyncState::SyncTransition => write!(f, "Evaluating known peers"),
|
||||||
SyncState::BackFillSyncing { .. } => write!(f, "Syncing Historical Blocks"),
|
SyncState::BackFillSyncing { .. } => write!(f, "Syncing Historical Blocks"),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ type E = MinimalEthSpec;
|
|||||||
fn bellatrix_block_small(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock<E> {
|
fn bellatrix_block_small(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock<E> {
|
||||||
let mut block = BeaconBlockBellatrix::<E>::empty(spec);
|
let mut block = BeaconBlockBellatrix::<E>::empty(spec);
|
||||||
let tx = VariableList::from(vec![0; 1024]);
|
let tx = VariableList::from(vec![0; 1024]);
|
||||||
let txs = VariableList::from(std::iter::repeat(tx).take(5000).collect::<Vec<_>>());
|
let txs = VariableList::from(std::iter::repeat_n(tx, 5000).collect::<Vec<_>>());
|
||||||
|
|
||||||
block.body.execution_payload.execution_payload.transactions = txs;
|
block.body.execution_payload.execution_payload.transactions = txs;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ fn bellatrix_block_small(fork_context: &ForkContext, spec: &ChainSpec) -> Beacon
|
|||||||
fn bellatrix_block_large(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock<E> {
|
fn bellatrix_block_large(fork_context: &ForkContext, spec: &ChainSpec) -> BeaconBlock<E> {
|
||||||
let mut block = BeaconBlockBellatrix::<E>::empty(spec);
|
let mut block = BeaconBlockBellatrix::<E>::empty(spec);
|
||||||
let tx = VariableList::from(vec![0; 1024]);
|
let tx = VariableList::from(vec![0; 1024]);
|
||||||
let txs = VariableList::from(std::iter::repeat(tx).take(100000).collect::<Vec<_>>());
|
let txs = VariableList::from(std::iter::repeat_n(tx, 100000).collect::<Vec<_>>());
|
||||||
|
|
||||||
block.body.execution_payload.execution_payload.transactions = txs;
|
block.body.execution_payload.execution_payload.transactions = txs;
|
||||||
|
|
||||||
|
|||||||
@@ -841,7 +841,7 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
|||||||
| GossipDataColumnError::ProposerIndexMismatch { .. }
|
| GossipDataColumnError::ProposerIndexMismatch { .. }
|
||||||
| GossipDataColumnError::IsNotLaterThanParent { .. }
|
| GossipDataColumnError::IsNotLaterThanParent { .. }
|
||||||
| GossipDataColumnError::InvalidSubnetId { .. }
|
| GossipDataColumnError::InvalidSubnetId { .. }
|
||||||
| GossipDataColumnError::InvalidInclusionProof { .. }
|
| GossipDataColumnError::InvalidInclusionProof
|
||||||
| GossipDataColumnError::InvalidKzgProof { .. }
|
| GossipDataColumnError::InvalidKzgProof { .. }
|
||||||
| GossipDataColumnError::UnexpectedDataColumn
|
| GossipDataColumnError::UnexpectedDataColumn
|
||||||
| GossipDataColumnError::InvalidColumnIndex(_)
|
| GossipDataColumnError::InvalidColumnIndex(_)
|
||||||
|
|||||||
@@ -688,7 +688,7 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
|||||||
if new_state.is_synced()
|
if new_state.is_synced()
|
||||||
&& !matches!(
|
&& !matches!(
|
||||||
old_state,
|
old_state,
|
||||||
SyncState::Synced { .. } | SyncState::BackFillSyncing { .. }
|
SyncState::Synced | SyncState::BackFillSyncing { .. }
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
self.network.subscribe_core_topics();
|
self.network.subscribe_core_topics();
|
||||||
|
|||||||
@@ -1301,7 +1301,7 @@ impl TestRig {
|
|||||||
.sync_manager
|
.sync_manager
|
||||||
.get_sampling_request_status(block_root, index)
|
.get_sampling_request_status(block_root, index)
|
||||||
.unwrap_or_else(|| panic!("No request state for {index}"));
|
.unwrap_or_else(|| panic!("No request state for {index}"));
|
||||||
if !matches!(status, crate::sync::peer_sampling::Status::NoPeers { .. }) {
|
if !matches!(status, crate::sync::peer_sampling::Status::NoPeers) {
|
||||||
panic!("expected {block_root} {index} request to be no peers: {status:?}");
|
panic!("expected {block_root} {index} request to be no peers: {status:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use smallvec::smallvec;
|
|||||||
|
|
||||||
impl<N: Unsigned + Clone> TestRandom for BitList<N> {
|
impl<N: Unsigned + Clone> TestRandom for BitList<N> {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
let initial_len = std::cmp::max(1, (N::to_usize() + 7) / 8);
|
let initial_len = std::cmp::max(1, N::to_usize().div_ceil(8));
|
||||||
let mut raw_bytes = smallvec![0; initial_len];
|
let mut raw_bytes = smallvec![0; initial_len];
|
||||||
rng.fill_bytes(&mut raw_bytes);
|
rng.fill_bytes(&mut raw_bytes);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ impl<N: Unsigned + Clone> TestRandom for BitList<N> {
|
|||||||
|
|
||||||
impl<N: Unsigned + Clone> TestRandom for BitVector<N> {
|
impl<N: Unsigned + Clone> TestRandom for BitVector<N> {
|
||||||
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
fn random_for_test(rng: &mut impl RngCore) -> Self {
|
||||||
let mut raw_bytes = smallvec![0; std::cmp::max(1, (N::to_usize() + 7) / 8)];
|
let mut raw_bytes = smallvec![0; std::cmp::max(1, N::to_usize().div_ceil(8))];
|
||||||
rng.fill_bytes(&mut raw_bytes);
|
rng.fill_bytes(&mut raw_bytes);
|
||||||
// If N isn't divisible by 8
|
// If N isn't divisible by 8
|
||||||
// zero out bits greater than N
|
// zero out bits greater than N
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ impl<E: EthSpec> LoadCase for ForkChoiceTest<E> {
|
|||||||
fn load_from_dir(path: &Path, fork_name: ForkName) -> Result<Self, Error> {
|
fn load_from_dir(path: &Path, fork_name: ForkName) -> Result<Self, Error> {
|
||||||
let description = path
|
let description = path
|
||||||
.iter()
|
.iter()
|
||||||
.last()
|
.next_back()
|
||||||
.expect("path must be non-empty")
|
.expect("path must be non-empty")
|
||||||
.to_str()
|
.to_str()
|
||||||
.expect("path must be valid OsStr")
|
.expect("path must be valid OsStr")
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ fn keystore_pubkey(keystore: &Keystore) -> PublicKeyBytes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn all_with_status<T: Clone>(count: usize, status: T) -> impl Iterator<Item = T> {
|
fn all_with_status<T: Clone>(count: usize, status: T) -> impl Iterator<Item = T> {
|
||||||
std::iter::repeat(status).take(count)
|
std::iter::repeat_n(status, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn all_imported(count: usize) -> impl Iterator<Item = ImportKeystoreStatus> {
|
fn all_imported(count: usize) -> impl Iterator<Item = ImportKeystoreStatus> {
|
||||||
|
|||||||
Reference in New Issue
Block a user