chore: fix doc lints (#4639)

This commit is contained in:
Alexey Shekhirin
2023-09-18 18:08:35 +01:00
committed by GitHub
parent cabb5bee24
commit 4aa3ebdbdd
23 changed files with 52 additions and 61 deletions

View File

@ -1,5 +1,4 @@
//! Builder structs for [`Status`](crate::types::Status) and
//! [`HelloMessage`](crate::HelloMessage) messages.
//! Builder structs for [`Status`] and [`HelloMessage`] messages.
use crate::{
capability::Capability, hello::HelloMessage, p2pstream::ProtocolVersion, EthVersion, Status,
@ -7,7 +6,7 @@ use crate::{
use reth_discv4::DEFAULT_DISCOVERY_PORT;
use reth_primitives::{Chain, ForkId, PeerId, H256, U256};
/// Builder for [`Status`](crate::types::Status) messages.
/// Builder for [`Status`] messages.
///
/// # Example
/// ```
@ -43,7 +42,7 @@ pub struct StatusBuilder {
}
impl StatusBuilder {
/// Consumes the type and creates the actual [`Status`](crate::types::Status) message.
/// Consumes the type and creates the actual [`Status`] message.
pub fn build(self) -> Status {
self.status
}
@ -85,14 +84,14 @@ impl StatusBuilder {
}
}
/// Builder for [`HelloMessage`](crate::HelloMessage) messages.
/// Builder for [`HelloMessage`] messages.
pub struct HelloBuilder {
hello: HelloMessage,
}
impl HelloBuilder {
/// Creates a new [`HelloBuilder`](crate::builder::HelloBuilder) with default [`HelloMessage`]
/// values, and a `PeerId` corresponding to the given pubkey.
/// Creates a new [`HelloBuilder`] with default [`HelloMessage`] values, and a `PeerId`
/// corresponding to the given pubkey.
pub fn new(pubkey: PeerId) -> Self {
Self {
hello: HelloMessage {

View File

@ -106,8 +106,8 @@ impl TryFrom<u8> for DisconnectReason {
}
}
/// The [`Encodable`](reth_rlp::Encodable) implementation for [`DisconnectReason`] encodes the
/// disconnect reason in a single-element RLP list.
/// The [`Encodable`] implementation for [`DisconnectReason`] encodes the disconnect reason in a
/// single-element RLP list.
impl Encodable for DisconnectReason {
fn encode(&self, out: &mut dyn BufMut) {
vec![*self as u8].encode(out);
@ -117,8 +117,8 @@ impl Encodable for DisconnectReason {
}
}
/// The [`Decodable`](reth_rlp::Decodable) implementation for [`DisconnectReason`] supports either
/// a disconnect reason encoded a single byte or a RLP list containing the disconnect reason.
/// The [`Decodable`] implementation for [`DisconnectReason`] supports either a disconnect reason
/// encoded a single byte or a RLP list containing the disconnect reason.
impl Decodable for DisconnectReason {
fn decode(buf: &mut &[u8]) -> Result<Self, DecodeError> {
if buf.is_empty() {

View File

@ -687,10 +687,10 @@ impl P2PMessage {
}
}
/// The [`Encodable`](reth_rlp::Encodable) implementation for [`P2PMessage::Ping`] and
/// [`P2PMessage::Pong`] encodes the message as RLP, and prepends a snappy header to the RLP bytes
/// for all variants except the [`P2PMessage::Hello`] variant, because the hello message is never
/// compressed in the `p2p` subprotocol.
/// The [`Encodable`] implementation for [`P2PMessage::Ping`] and [`P2PMessage::Pong`] encodes the
/// message as RLP, and prepends a snappy header to the RLP bytes for all variants except the
/// [`P2PMessage::Hello`] variant, because the hello message is never compressed in the `p2p`
/// subprotocol.
impl Encodable for P2PMessage {
fn encode(&self, out: &mut dyn BufMut) {
(self.message_id() as u8).encode(out);
@ -724,11 +724,12 @@ impl Encodable for P2PMessage {
}
}
/// The [`Decodable`](reth_rlp::Decodable) implementation for [`P2PMessage`] assumes that each of
/// the message variants are snappy compressed, except for the [`P2PMessage::Hello`] variant since
/// the hello message is never compressed in the `p2p` subprotocol.
/// The [`Decodable`] implementation for [`P2PMessage::Ping`] and
/// [`P2PMessage::Pong`] expects a snappy encoded payload, see [`Encodable`] implementation.
/// The [`Decodable`] implementation for [`P2PMessage`] assumes that each of the message variants
/// are snappy compressed, except for the [`P2PMessage::Hello`] variant since the hello message is
/// never compressed in the `p2p` subprotocol.
///
/// The [`Decodable`] implementation for [`P2PMessage::Ping`] and [`P2PMessage::Pong`] expects a
/// snappy encoded payload, see [`Encodable`] implementation.
impl Decodable for P2PMessage {
fn decode(buf: &mut &[u8]) -> Result<Self, DecodeError> {
/// Removes the snappy prefix from the Ping/Pong buffer

View File

@ -67,8 +67,7 @@ impl Status {
Default::default()
}
/// Create a [`StatusBuilder`] from the given [`ChainSpec`](reth_primitives::ChainSpec) and
/// head block.
/// Create a [`StatusBuilder`] from the given [`ChainSpec`] and head block.
///
/// Sets the `chain` and `genesis`, `blockhash`, and `forkid` fields based on the [`ChainSpec`]
/// and head.