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

@ -36,7 +36,7 @@ impl<P: ConnectionProvider> Resolver for AsyncResolver<P> {
/// An asynchronous DNS resolver
///
/// See also [TokioAsyncResolver](trust_dns_resolver::TokioAsyncResolver)
/// See also [TokioAsyncResolver]
///
/// ```
/// # fn t() {

View File

@ -297,8 +297,7 @@ where
self.into_task_with(&TokioTaskExecutor::default())
}
/// Convert the downloader into a [`TaskDownloader`](super::task::TaskDownloader) by spawning
/// it via the given spawner.
/// Convert the downloader into a [`TaskDownloader`] by spawning it via the given spawner.
pub fn into_task_with<S>(self, spawner: &S) -> TaskDownloader
where
S: TaskSpawner,

View File

@ -643,8 +643,7 @@ where
self.into_task_with(&TokioTaskExecutor::default())
}
/// Convert the downloader into a [`TaskDownloader`](super::task::TaskDownloader) by spawning
/// it via the given `spawner`.
/// Convert the downloader into a [`TaskDownloader`] by spawning it via the given `spawner`.
pub fn into_task_with<S>(self, spawner: &S) -> TaskDownloader
where
S: TaskSpawner,

View File

@ -56,7 +56,7 @@ pub struct FileClient {
bodies: HashMap<BlockHash, BlockBody>,
}
/// An error that can occur when constructing and using a [`FileClient`](FileClient).
/// An error that can occur when constructing and using a [`FileClient`].
#[derive(Debug, Error)]
pub enum FileClientError {
/// An error occurred when opening or reading the file.
@ -75,7 +75,7 @@ impl FileClient {
FileClient::from_file(file).await
}
/// Initialize the [`FileClient`](FileClient) with a file directly.
/// Initialize the [`FileClient`] with a file directly.
pub(crate) async fn from_file(mut file: File) -> Result<Self, FileClientError> {
// get file len from metadata before reading
let metadata = file.metadata().await?;

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.

View File

@ -1217,7 +1217,7 @@ impl PeersConfig {
/// The durations to use when a backoff should be applied to a peer.
///
/// See also [`BackoffKind`](BackoffKind).
/// See also [`BackoffKind`].
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PeerBackoffDurations {

View File

@ -236,7 +236,7 @@ where
/// Propagate the transactions to all connected peers either as full objects or hashes
///
/// The message for new pooled hashes depends on the negotiated version of the stream.
/// See [NewPooledTransactionHashes](NewPooledTransactionHashes)
/// See [NewPooledTransactionHashes]
///
/// Note: EIP-4844 are disallowed from being broadcast in full and are only ever sent as hashes, see also <https://eips.ethereum.org/EIPS/eip-4844#networking>.
fn propagate_transactions(
@ -827,7 +827,7 @@ struct Peer {
client_version: Arc<String>,
}
/// Commands to send to the [`TransactionsManager`](crate::transactions::TransactionsManager)
/// Commands to send to the [`TransactionsManager`]
enum TransactionsCommand {
PropagateHash(H256),
}