Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clippy für docs #1194

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions crates/eips/src/eip1898.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ use serde::{
Deserialize, Deserializer, Serialize, Serializer,
};

/// A block hash which may have
/// a boolean requireCanonical field.
/// If false, an RPC call should raise if a block
/// matching the hash is not found.
/// If true, an RPC call should additionally raise if
/// the block is not in the canonical chain.
/// A block hash which may have a boolean requireCanonical field.
///
/// If false, an RPC call should raise if a block matching the hash is not found.
/// If true, an RPC call should additionally raise if the block is not in the canonical chain.
/// <https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1898.md#specification>
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
Expand Down
16 changes: 9 additions & 7 deletions crates/eips/src/eip2718.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ pub trait Decodable2718: Sized {
}
}

/// Encoding trait for [EIP-2718] envelopes. These envelopes wrap a transaction
/// or a receipt with a type flag. [EIP-2718] encodings are used by the
/// `eth_sendRawTransaction` RPC call, the Ethereum block header's tries, and the
/// Encoding trait for [EIP-2718] envelopes.
///
/// These envelopes wrap a transaction or a receipt with a type flag. [EIP-2718] encodings are used
/// by the `eth_sendRawTransaction` RPC call, the Ethereum block header's tries, and the
/// peer-to-peer protocol.
///
/// Users should rarely import this trait, and should instead prefer letting the
Expand Down Expand Up @@ -224,10 +225,11 @@ pub trait Encodable2718: Sized + Send + Sync + 'static {
}
}

/// An [EIP-2718] envelope, blanket implemented for types that impl
/// [`Encodable2718`] and [`Decodable2718`]. This envelope is a wrapper around
/// a transaction, or a receipt, or any other type that is differentiated by an
/// EIP-2718 transaction type.
/// An [EIP-2718] envelope, blanket implemented for types that impl [`Encodable2718`] and
/// [`Decodable2718`].
///
/// This envelope is a wrapper around a transaction, or a receipt, or any other type that is
/// differentiated by an EIP-2718 transaction type.
///
/// [EIP-2718]: https://eips.ethereum.org/EIPS/eip-2718
pub trait Eip2718Envelope: Decodable2718 + Encodable2718 {}
Expand Down
9 changes: 5 additions & 4 deletions crates/eips/src/eip4844/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ impl PartialSidecar {
}
}

/// A strategy for coding and decoding data into sidecars. Coder instances are
/// responsible for encoding and decoding data into and from the sidecar. They
/// are called by the [`SidecarBuilder`] during the [`ingest`],
/// [`take`], and (if `c_kzg` feature enabled) `build` methods.
/// A strategy for coding and decoding data into sidecars.
///
/// Coder instances are responsible for encoding and decoding data into and from the sidecar. They
/// are called by the [`SidecarBuilder`] during the [`ingest`], [`take`], and (if `c_kzg` feature
/// enabled) `build` methods.
///
/// This trait allows different downstream users to use different bit-packing
/// strategies. For example, a simple coder might only use the last 31 bytes of
Expand Down
1 change: 1 addition & 0 deletions crates/genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ pub struct CliqueConfig {
}

/// Consensus configuration for Parlia.
///
/// Parlia is the consensus engine for BNB Smart Chain.
/// For the general introduction: <https://docs.bnbchain.org/docs/learn/consensus/>
/// For the specification: <https://github.com/bnb-chain/bsc/blob/master/params/config.go#L558>
Expand Down
5 changes: 3 additions & 2 deletions crates/json-rpc/src/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ pub struct EthNotification<T = Box<serde_json::value::RawValue>> {
pub result: T,
}

/// An item received over an Ethereum pubsub transport. Ethereum pubsub uses a
/// non-standard JSON-RPC notification format. An item received over a pubsub
/// An item received over an Ethereum pubsub transport.
///
/// Ethereum pubsub uses a non-standard JSON-RPC notification format. An item received over a pubsub
/// transport may be a JSON-RPC response or an Ethereum-style notification.
#[derive(Clone, Debug)]
pub enum PubSubItem {
Expand Down
7 changes: 4 additions & 3 deletions crates/json-rpc/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ where
}
}

/// A [`BorrowedResponsePacket`] is a [`ResponsePacket`] that has been partially
/// deserialized, borrowing its contents from the deserializer. This is used
/// primarily for intermediate deserialization. Most users will not require it.
/// A [`BorrowedResponsePacket`] is a [`ResponsePacket`] that has been partially deserialized,
/// borrowing its contents from the deserializer.
///
/// This is used primarily for intermediate deserialization. Most users will not require it.
///
/// See the [top-level docs] for more info.
///
Expand Down
9 changes: 5 additions & 4 deletions crates/json-rpc/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ impl<Params> Request<Params> {
}
}

/// A [`Request`] that has been partially serialized. The request parameters
/// have been serialized, and are represented as a boxed [`RawValue`]. This is
/// useful for collections containing many requests, as it erases the `Param`
/// type. It can be created with [`Request::box_params()`].
/// A [`Request`] that has been partially serialized.
///
/// The request parameters have been serialized, and are represented as a boxed [`RawValue`]. This
/// is useful for collections containing many requests, as it erases the `Param` type. It can be
/// created with [`Request::box_params()`].
///
/// See the [top-level docs] for more info.
///
Expand Down
7 changes: 4 additions & 3 deletions crates/provider/src/fillers/join_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use alloy_network::Network;
use alloy_transport::{Transport, TransportResult};
use futures::try_join;

/// A layer that can fill in a [`TransactionRequest`] with additional
/// information by joining two [`TxFiller`]s. This struct is itself a
/// [`TxFiller`], and can be nested to compose any number of fill layers.
/// A layer that can fill in a [`TransactionRequest`] with additional information by joining two
/// [`TxFiller`]s.
///
/// This struct is itself a [`TxFiller`], and can be nested to compose any number of fill layers.
///
/// [`TransactionRequest`]: alloy_rpc_types_eth::TransactionRequest
#[derive(Clone, Copy, Debug)]
Expand Down
9 changes: 5 additions & 4 deletions crates/provider/src/layers/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ use std::{

use crate::{Provider, ProviderLayer, RootProvider};

/// A layer that wraps an [`Anvil`] config. The config will be used
/// to spawn an [`AnvilInstance`] when the layer is applied, or when the user
/// requests any information about the anvil node (e.g. via the
/// [`AnvilLayer::ws_endpoint_url`] method ).
/// A layer that wraps an [`Anvil`] config.
///
/// The config will be used to spawn an [`AnvilInstance`] when the layer is applied, or when the
/// user requests any information about the anvil node (e.g. via the [`AnvilLayer::ws_endpoint_url`]
/// method).
#[derive(Debug, Clone, Default)]
pub struct AnvilLayer {
anvil: Anvil,
Expand Down
6 changes: 4 additions & 2 deletions crates/provider/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ fn estimate_priority_fee(rewards: &[Vec<u128>]) -> u128 {
std::cmp::max(median, EIP1559_MIN_PRIORITY_FEE)
}

/// The default EIP-1559 fee estimator which is based on the work by [MetaMask](https://github.com/MetaMask/core/blob/main/packages/gas-fee-controller/src/fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels.ts#L56)
/// (constants for "medium" priority level are used)
/// The default EIP-1559 fee estimator.
///
/// Based on the work by [MetaMask](https://github.com/MetaMask/core/blob/main/packages/gas-fee-controller/src/fetchGasEstimatesViaEthFeeHistory/calculateGasFeeEstimatesForPriorityLevels.ts#L56);
/// constants for "medium" priority level are used.
pub fn eip1559_default_estimator(
base_fee_per_gas: u128,
rewards: &[Vec<u128>],
Expand Down
14 changes: 8 additions & 6 deletions crates/rpc-types-beacon/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ pub struct ValidatorRegistrationMessage {
}

/// Represents public information about a block sent by a builder to the relay, or from the relay to
/// the proposer. Depending on the context, value might represent the claimed value by a builder
/// (not necessarily a value confirmed by the relay).
/// the proposer.
///
/// Depending on the context, value might represent the claimed value by a builder (not necessarily
/// a value confirmed by the relay).
#[serde_as]
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "ssz", derive(ssz_derive::Encode, ssz_derive::Decode))]
Expand Down Expand Up @@ -274,10 +276,10 @@ impl ProposerPayloadsDeliveredQuery {
}
}

/// OrderBy : Sort results in either ascending or descending values. * `-value` - descending value
/// (highest value first) * `value` - ascending value (lowest value first) Sort results in either
/// ascending or descending values. * `-value` - descending value (highest value first) * `value`
/// - ascending value (lowest value first)
/// Sort results in either ascending or descending values.
///
/// - `-value` - descending value (highest value first)
/// - `value` - ascending value (lowest value first)
#[derive(
Default, Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
Expand Down
2 changes: 2 additions & 0 deletions crates/rpc-types-engine/src/jwt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const JWT_MAX_IAT_DIFF: Duration = Duration::from_secs(60);
const JWT_SIGNATURE_ALGO: Algorithm = Algorithm::HS256;

/// Claims in JWT are used to represent a set of information about an entity.
///
/// Claims are essentially key-value pairs that are encoded as JSON objects and included in the
/// payload of a JWT. They are used to transmit information such as the identity of the entity, the
/// time the JWT was issued, and the expiration time of the JWT, among others.
Expand Down Expand Up @@ -128,6 +129,7 @@ impl Default for Claims {
}

/// Value-object holding a reference to a hex-encoded 256-bit secret key.
///
/// A JWT secret key is used to secure JWT-based authentication. The secret key is
/// a shared secret between the server and the client and is used to calculate a digital signature
/// for the JWT, which is included in the JWT along with its payload.
Expand Down
1 change: 1 addition & 0 deletions crates/rpc-types-eth/src/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ pub struct SimCallResult {
}

/// Simulation options for executing multiple blocks and transactions.
///
/// This struct configures how simulations are executed, including whether to trace token transfers,
/// validate transaction sequences, and whether to return full transaction objects.
#[derive(Clone, Debug, Serialize, Deserialize)]
Expand Down
5 changes: 3 additions & 2 deletions crates/rpc-types-mev/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ impl<'de> Deserialize<'de> for PrivacyHint {
}
}

/// Specifies the minimum percent of a given bundle's earnings to redistribute
/// for it to be included in a builder's block.
/// Specifies the minimum percent of a given bundle's earnings to redistribute for it to be included
/// in a builder's block.
///
/// Related endpoint: `mev_sendBundle`, `mev_simBundle`, `eth_sendPrivateTransaction`,
/// `eth_sendPrivateRawTransaction`
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
Expand Down
8 changes: 5 additions & 3 deletions crates/rpc-types-trace/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ impl AddressFilter {
}
}

/// `TraceFilterMatcher` is a filter used for matching `TransactionTrace` based on
/// it's action and result(if available). It allows filtering traces by their mode, from address
/// set, and to address set, and empty address set means match all addresses.
/// `TraceFilterMatcher` is a filter used for matching `TransactionTrace` based on it's action and
/// result (if available).
///
/// It allows filtering traces by their mode, from address set, and to address set, and empty
/// address set means match all addresses.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TraceFilterMatcher {
mode: TraceFilterMode,
Expand Down
4 changes: 3 additions & 1 deletion crates/rpc-types-trace/src/geth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ pub struct UnexpectedTracerError(pub GethTrace);
pub type TraceResult = crate::common::TraceResult<GethTrace, String>;

/// blockTraceResult represents the results of tracing a single block when an entire chain is being
/// traced. ref <https://github.com/ethereum/go-ethereum/blob/ee530c0d5aa70d2c00ab5691a89ab431b73f8165/eth/tracers/api.go#L218-L222>
/// traced.
///
/// Ref <https://github.com/ethereum/go-ethereum/blob/ee530c0d5aa70d2c00ab5691a89ab431b73f8165/eth/tracers/api.go#L218-L222>
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlockTraceResult {
/// Block number corresponding to the trace task
Expand Down