mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Fix Rust beta compiler errors 1.78.0-beta.1 (#5439)
* remove redundant imports * fix test * contains key * fmt * Merge branch 'unstable' into fix-beta-compiler
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::rpc::{
|
||||
codec::base::OutboundCodec,
|
||||
protocol::{Encoding, ProtocolId, RPCError, SupportedProtocol, ERROR_TYPE_MAX, ERROR_TYPE_MIN},
|
||||
};
|
||||
use crate::rpc::{InboundRequest, OutboundRequest, RPCCodedResponse, RPCResponse};
|
||||
use crate::rpc::{InboundRequest, OutboundRequest};
|
||||
use libp2p::bytes::BytesMut;
|
||||
use snap::read::FrameDecoder;
|
||||
use snap::write::FrameEncoder;
|
||||
@@ -676,22 +676,13 @@ fn context_bytes_to_fork_name(
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::rpc::{protocol::*, MetaData};
|
||||
use crate::{
|
||||
rpc::{methods::StatusMessage, Ping, RPCResponseErrorCode},
|
||||
types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use crate::rpc::protocol::*;
|
||||
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield};
|
||||
use types::{
|
||||
blob_sidecar::BlobIdentifier, BeaconBlock, BeaconBlockAltair, BeaconBlockBase,
|
||||
BeaconBlockMerge, ChainSpec, EmptyBlock, Epoch, ForkContext, FullPayload, Hash256,
|
||||
Signature, SignedBeaconBlock, Slot,
|
||||
BeaconBlockMerge, EmptyBlock, Epoch, FullPayload, Signature, Slot,
|
||||
};
|
||||
|
||||
use snap::write::FrameEncoder;
|
||||
use ssz::Encode;
|
||||
use std::io::Write;
|
||||
|
||||
type Spec = types::MainnetEthSpec;
|
||||
|
||||
fn fork_context(fork_name: ForkName) -> ForkContext {
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::rpc::outbound::{OutboundFramed, OutboundRequest};
|
||||
use crate::rpc::protocol::InboundFramed;
|
||||
use fnv::FnvHashMap;
|
||||
use futures::prelude::*;
|
||||
use futures::{Sink, SinkExt};
|
||||
use futures::SinkExt;
|
||||
use libp2p::swarm::handler::{
|
||||
ConnectionEvent, ConnectionHandler, ConnectionHandlerEvent, DialUpgradeError,
|
||||
FullyNegotiatedInbound, FullyNegotiatedOutbound, StreamUpgradeError, SubstreamProtocol,
|
||||
|
||||
@@ -6,6 +6,7 @@ use serde::Serialize;
|
||||
use ssz::Encode;
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use ssz_types::{typenum::U256, VariableList};
|
||||
use std::fmt::Display;
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
@@ -44,11 +45,13 @@ impl Deref for ErrorType {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for ErrorType {
|
||||
fn to_string(&self) -> String {
|
||||
impl Display for ErrorType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
#[allow(clippy::invalid_regex)]
|
||||
let re = Regex::new("\\p{C}").expect("Regex is valid");
|
||||
String::from_utf8_lossy(&re.replace_all(self.0.deref(), &b""[..])).to_string()
|
||||
let error_type_str =
|
||||
String::from_utf8_lossy(&re.replace_all(self.0.deref(), &b""[..])).to_string();
|
||||
write!(f, "{}", error_type_str)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,7 +583,7 @@ impl<T: EthSpec> std::fmt::Display for RPCCodedResponse<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
RPCCodedResponse::Success(res) => write!(f, "{}", res),
|
||||
RPCCodedResponse::Error(code, err) => write!(f, "{}: {}", code, err.to_string()),
|
||||
RPCCodedResponse::Error(code, err) => write!(f, "{}: {}", code, err),
|
||||
RPCCodedResponse::StreamTermination(_) => write!(f, "Stream Termination"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ use super::methods::*;
|
||||
use super::protocol::ProtocolId;
|
||||
use super::protocol::SupportedProtocol;
|
||||
use super::RPCError;
|
||||
use crate::rpc::protocol::Encoding;
|
||||
use crate::rpc::{
|
||||
codec::{base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec},
|
||||
methods::ResponseTermination,
|
||||
use crate::rpc::codec::{
|
||||
base::BaseOutboundCodec, ssz_snappy::SSZSnappyOutboundCodec, OutboundCodec,
|
||||
};
|
||||
use crate::rpc::protocol::Encoding;
|
||||
use futures::future::BoxFuture;
|
||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||
use futures::{FutureExt, SinkExt};
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
use super::methods::*;
|
||||
use crate::rpc::{
|
||||
codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCodec, InboundCodec},
|
||||
methods::{MaxErrorLen, ResponseTermination, MAX_ERROR_LEN},
|
||||
};
|
||||
use crate::rpc::codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCodec, InboundCodec};
|
||||
use futures::future::BoxFuture;
|
||||
use futures::prelude::{AsyncRead, AsyncWrite};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
|
||||
@@ -3,7 +3,6 @@ use crate::rpc::Protocol;
|
||||
use fnv::FnvHashMap;
|
||||
use libp2p::PeerId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryInto;
|
||||
use std::future::Future;
|
||||
use std::hash::Hash;
|
||||
use std::pin::Pin;
|
||||
|
||||
Reference in New Issue
Block a user