Fix Rust beta compiler errors (1.77) (#5180)

* Lint fixes

* More fixes for beta compiler.

* Format fixes

* Move `#[allow(dead_code)]` to field level.

* Remove old comment.

* Update beacon_node/execution_layer/src/test_utils/mod.rs

Co-authored-by: João Oliveira <hello@jxs.pt>

* remove duplicate line
This commit is contained in:
Jimmy Chen
2024-02-06 04:54:11 +11:00
committed by GitHub
parent 8fb6989801
commit 39e9f7dc6b
19 changed files with 64 additions and 46 deletions

View File

@@ -14,11 +14,12 @@ const MAX_REQUEST_RANGE_EPOCHS: usize = 100;
const BLOCK_ROOT_CHUNK_SIZE: usize = 100;
#[derive(Debug)]
// We don't use the inner values directly, but they're used in the Debug impl.
enum AttestationPerformanceError {
BlockReplay(BlockReplayError),
BeaconState(BeaconStateError),
ParticipationCache(ParticipationCacheError),
UnableToFindValidator(usize),
BlockReplay(#[allow(dead_code)] BlockReplayError),
BeaconState(#[allow(dead_code)] BeaconStateError),
ParticipationCache(#[allow(dead_code)] ParticipationCacheError),
UnableToFindValidator(#[allow(dead_code)] usize),
}
impl From<BlockReplayError> for AttestationPerformanceError {

View File

@@ -19,10 +19,11 @@ use warp_utils::reject::{beacon_chain_error, custom_bad_request, custom_server_e
const BLOCK_ROOT_CHUNK_SIZE: usize = 100;
#[derive(Debug)]
// We don't use the inner values directly, but they're used in the Debug impl.
enum PackingEfficiencyError {
BlockReplay(BlockReplayError),
BeaconState(BeaconStateError),
CommitteeStoreError(Slot),
BlockReplay(#[allow(dead_code)] BlockReplayError),
BeaconState(#[allow(dead_code)] BeaconStateError),
CommitteeStoreError(#[allow(dead_code)] Slot),
InvalidAttestationError,
}

View File

@@ -1019,7 +1019,7 @@ pub fn serve<T: BeaconChainTypes>(
Ok((
state
.get_built_sync_committee(epoch, &chain.spec)
.map(|committee| committee.clone())
.cloned()
.map_err(|e| match e {
BeaconStateError::SyncCommitteeNotKnown { .. } => {
warp_utils::reject::custom_bad_request(format!(
@@ -2858,7 +2858,7 @@ pub fn serve<T: BeaconChainTypes>(
hex::encode(
meta_data
.syncnets()
.map(|x| x.clone())
.cloned()
.unwrap_or_default()
.into_bytes()
)