mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: clippy warnings, or_fun_call and unnecessary_lazy_evaluations (#846)
This commit is contained in:
@ -7,9 +7,10 @@ use std::fmt::Display;
|
||||
use thiserror::Error;
|
||||
|
||||
/// RLPx disconnect reason.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum DisconnectReason {
|
||||
/// Disconnect requested by the local node or remote peer.
|
||||
#[default]
|
||||
DisconnectRequested = 0x00,
|
||||
/// TCP related error
|
||||
TcpSubsystemError = 0x01,
|
||||
@ -65,12 +66,6 @@ impl Display for DisconnectReason {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DisconnectReason {
|
||||
fn default() -> Self {
|
||||
DisconnectReason::DisconnectRequested
|
||||
}
|
||||
}
|
||||
|
||||
/// This represents an unknown disconnect reason with the given code.
|
||||
#[derive(Debug, Clone, Error)]
|
||||
#[error("unknown disconnect reason: {0}")]
|
||||
|
||||
@ -715,11 +715,12 @@ impl TryFrom<u8> for P2PMessageID {
|
||||
}
|
||||
|
||||
/// RLPx `p2p` protocol version
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ProtocolVersion {
|
||||
/// `p2p` version 4
|
||||
V4 = 4,
|
||||
/// `p2p` version 5
|
||||
#[default]
|
||||
V5 = 5,
|
||||
}
|
||||
|
||||
@ -744,12 +745,6 @@ impl Decodable for ProtocolVersion {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ProtocolVersion {
|
||||
fn default() -> Self {
|
||||
ProtocolVersion::V5
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user