mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
clippy: add unnested_or_patterns clippy lint (#10526)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Oliver <onbjerg@users.noreply.github.com>
This commit is contained in:
@ -111,9 +111,7 @@ impl SessionError for EthStreamError {
|
||||
fn merits_discovery_ban(&self) -> bool {
|
||||
match self {
|
||||
Self::P2PStreamError(P2PStreamError::HandshakeError(
|
||||
P2PHandshakeError::HelloNotInHandshake,
|
||||
)) |
|
||||
Self::P2PStreamError(P2PStreamError::HandshakeError(
|
||||
P2PHandshakeError::HelloNotInHandshake |
|
||||
P2PHandshakeError::NonHelloMessageInHandshake,
|
||||
)) => true,
|
||||
Self::EthHandshakeError(err) => !matches!(err, EthHandshakeError::NoResponse),
|
||||
@ -126,29 +124,24 @@ impl SessionError for EthStreamError {
|
||||
Self::P2PStreamError(err) => {
|
||||
matches!(
|
||||
err,
|
||||
P2PStreamError::HandshakeError(P2PHandshakeError::NoSharedCapabilities) |
|
||||
P2PStreamError::HandshakeError(P2PHandshakeError::HelloNotInHandshake) |
|
||||
P2PStreamError::HandshakeError(
|
||||
P2PHandshakeError::NonHelloMessageInHandshake
|
||||
) |
|
||||
P2PStreamError::HandshakeError(P2PHandshakeError::Disconnected(
|
||||
DisconnectReason::UselessPeer
|
||||
)) |
|
||||
P2PStreamError::HandshakeError(P2PHandshakeError::Disconnected(
|
||||
DisconnectReason::IncompatibleP2PProtocolVersion
|
||||
)) |
|
||||
P2PStreamError::HandshakeError(P2PHandshakeError::Disconnected(
|
||||
DisconnectReason::ProtocolBreach
|
||||
)) |
|
||||
P2PStreamError::UnknownReservedMessageId(_) |
|
||||
P2PStreamError::HandshakeError(
|
||||
P2PHandshakeError::NoSharedCapabilities |
|
||||
P2PHandshakeError::HelloNotInHandshake |
|
||||
P2PHandshakeError::NonHelloMessageInHandshake |
|
||||
P2PHandshakeError::Disconnected(
|
||||
DisconnectReason::UselessPeer |
|
||||
DisconnectReason::IncompatibleP2PProtocolVersion |
|
||||
DisconnectReason::ProtocolBreach
|
||||
)
|
||||
) | P2PStreamError::UnknownReservedMessageId(_) |
|
||||
P2PStreamError::EmptyProtocolMessage |
|
||||
P2PStreamError::ParseSharedCapability(_) |
|
||||
P2PStreamError::CapabilityNotShared |
|
||||
P2PStreamError::Disconnected(DisconnectReason::UselessPeer) |
|
||||
P2PStreamError::Disconnected(
|
||||
DisconnectReason::IncompatibleP2PProtocolVersion
|
||||
DisconnectReason::UselessPeer |
|
||||
DisconnectReason::IncompatibleP2PProtocolVersion |
|
||||
DisconnectReason::ProtocolBreach
|
||||
) |
|
||||
P2PStreamError::Disconnected(DisconnectReason::ProtocolBreach) |
|
||||
P2PStreamError::MismatchedProtocolVersion { .. }
|
||||
)
|
||||
}
|
||||
@ -190,16 +183,20 @@ impl SessionError for EthStreamError {
|
||||
match self {
|
||||
// timeouts
|
||||
Self::EthHandshakeError(EthHandshakeError::NoResponse) |
|
||||
Self::P2PStreamError(P2PStreamError::HandshakeError(P2PHandshakeError::NoResponse)) |
|
||||
Self::P2PStreamError(P2PStreamError::PingTimeout) => Some(BackoffKind::Low),
|
||||
Self::P2PStreamError(
|
||||
P2PStreamError::HandshakeError(P2PHandshakeError::NoResponse) |
|
||||
P2PStreamError::PingTimeout,
|
||||
) => Some(BackoffKind::Low),
|
||||
// malformed messages
|
||||
Self::P2PStreamError(P2PStreamError::Rlp(_)) |
|
||||
Self::P2PStreamError(P2PStreamError::UnknownReservedMessageId(_)) |
|
||||
Self::P2PStreamError(P2PStreamError::UnknownDisconnectReason(_)) |
|
||||
Self::P2PStreamError(P2PStreamError::MessageTooBig { .. }) |
|
||||
Self::P2PStreamError(P2PStreamError::EmptyProtocolMessage) |
|
||||
Self::P2PStreamError(P2PStreamError::PingerError(_)) |
|
||||
Self::P2PStreamError(P2PStreamError::Snap(_)) => Some(BackoffKind::Medium),
|
||||
Self::P2PStreamError(
|
||||
P2PStreamError::Rlp(_) |
|
||||
P2PStreamError::UnknownReservedMessageId(_) |
|
||||
P2PStreamError::UnknownDisconnectReason(_) |
|
||||
P2PStreamError::MessageTooBig { .. } |
|
||||
P2PStreamError::EmptyProtocolMessage |
|
||||
P2PStreamError::PingerError(_) |
|
||||
P2PStreamError::Snap(_),
|
||||
) => Some(BackoffKind::Medium),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user