Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
chore: fix new rustdoc lints (#2563)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Aug 21, 2023
1 parent bdb44cf commit 7603af0
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 47 deletions.
13 changes: 7 additions & 6 deletions ethers-contract/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ where
B: Borrow<M>,
M: Middleware,
{
/// Returns an [`Event`](crate::builders::Event) builder for the provided event.
/// This function operates in a static context, then it does not require a `self`
/// to reference to instantiate an [`Event`](crate::builders::Event) builder.
/// Returns an [`Event`] builder for the provided event.
///
/// This function operates in a static context, then it does not require a `self` to reference
/// to instantiate an [`Event`] builder.
pub fn event_of_type<D: EthEvent>(client: B) -> Event<B, M, D> {
Event {
provider: client,
Expand Down Expand Up @@ -299,7 +300,7 @@ where
B: Clone + Borrow<M>,
M: Middleware,
{
/// Returns an [`Event`](crate::builders::Event) builder with the provided filter.
/// Returns an [`Event`] builder with the provided filter.
pub fn event_with_filter<D>(&self, filter: Filter) -> Event<B, M, D> {
Event {
provider: self.client.clone(),
Expand All @@ -309,12 +310,12 @@ where
}
}

/// Returns an [`Event`](crate::builders::Event) builder for the provided event.
/// Returns an [`Event`] builder for the provided event.
pub fn event<D: EthEvent>(&self) -> Event<B, M, D> {
D::new(Filter::new(), self.client.clone())
}

/// Returns an [`Event`](crate::builders::Event) builder with the provided name.
/// Returns an [`Event`] builder with the provided name.
pub fn event_for_name<D>(&self, name: &str) -> Result<Event<B, M, D>, Error> {
// get the event's full name
let event = self.base_contract.abi.event(name)?;
Expand Down
11 changes: 9 additions & 2 deletions ethers-contract/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,22 @@ where
{
/// Turns this event filter into `Stream` that yields decoded events.
///
/// This will first install a new logs filter via [`eth_newFilter`](https://docs.alchemy.com/alchemy/apis/ethereum/eth-newfilter) using the configured `filter` object. See also [`FilterWatcher`](ethers_providers::FilterWatcher).
/// This will first install a new logs filter via [`eth_newFilter`] using the configured
/// `filter` object. See also [`FilterWatcher`].
///
///
/// Once the filter is created, this will periodically call [`eth_getFilterChanges`] to get the
/// newest logs and decode them.
///
/// Once the filter is created, this will periodically call [`eth_getFilterChanges`](https://docs.alchemy.com/alchemy/apis/ethereum/eth-getfilterchanges) to get the newest logs and decode them
///
/// **Note:** Compared to [`Self::subscribe`], which is only available on `PubsubClient`s, such
/// as Websocket, this is a poll-based subscription, as the node does not notify us when a new
/// matching log is available, instead we have to actively ask for new logs using additional RPC
/// requests, and this is done on an interval basis.
///
/// [`eth_newFilter`]: https://docs.alchemy.com/alchemy/apis/ethereum/eth-newfilter
/// [`eth_getFilterChanges`]: https://docs.alchemy.com/alchemy/apis/ethereum/eth-getfilterchanges
///
/// # Example
// Ignore because `ethers-contract-derive` macros do not work in doctests in `ethers-contract`.
/// ```ignore
Expand Down
2 changes: 1 addition & 1 deletion ethers-contract/src/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ where
/// Broadcasts the contract deployment transaction and after waiting for it to
/// be sufficiently confirmed (default: 1), it returns a new instance of the contract type at
/// the deployed contract's address and the corresponding
/// [`TransactionReceipt`](ethers_core::types::TransactionReceipt).
/// [`TransactionReceipt`].
pub async fn send_with_receipt(self) -> Result<(C, TransactionReceipt), ContractError<M>> {
let (contract, receipt) = self.deployer.send_with_receipt().await?;
Ok((C::from(contract), receipt))
Expand Down
2 changes: 1 addition & 1 deletion ethers-contract/src/multicall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if_providers! {
pub mod error;
}

/// The version of the [`Multicall`](super::Multicall).
/// The version of the [`Multicall`].
/// Used to determine which methods of the Multicall smart contract to use:
/// - [`Multicall`] : `aggregate((address,bytes)[])`
/// - [`Multicall2`] : `try_aggregate(bool, (address,bytes)[])`
Expand Down
2 changes: 1 addition & 1 deletion ethers-core/src/utils/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ANVIL_STARTUP_TIMEOUT_MILLIS: u64 = 10_000;

/// An anvil CLI instance. Will close the instance when dropped.
///
/// Construct this using [`Anvil`](crate::utils::Anvil)
/// Construct this using [`Anvil`].
pub struct AnvilInstance {
pid: Child,
private_keys: Vec<K256SecretKey>,
Expand Down
2 changes: 1 addition & 1 deletion ethers-core/src/utils/ganache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const GANACHE_STARTUP_TIMEOUT_MILLIS: u64 = 10_000;

/// A ganache CLI instance. Will close the instance when dropped.
///
/// Construct this using [`Ganache`](crate::utils::Ganache)
/// Construct this using [`Ganache`].
pub struct GanacheInstance {
pid: Child,
private_keys: Vec<K256SecretKey>,
Expand Down
2 changes: 1 addition & 1 deletion ethers-core/src/utils/geth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub enum GethInstanceError {

/// A geth instance. Will close the instance when dropped.
///
/// Construct this using [`Geth`](crate::utils::Geth).
/// Construct this using [`Geth`].
#[derive(Debug)]
pub struct GethInstance {
pid: Child,
Expand Down
26 changes: 10 additions & 16 deletions ethers-middleware/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ use ethers_core::types::Address;
use ethers_providers::Middleware;
use ethers_signers::Signer;

/// A builder trait to compose different [`Middleware`](ethers_providers::Middleware) layers
/// and then build a composed [`Provider`](ethers_providers::Provider) architecture.
/// [`Middleware`](ethers_providers::Middleware) composition acts in a wrapping fashion. Adding a
/// new layer results in wrapping its predecessor.
/// A builder trait to compose different [`Middleware`] layers and then build a composed
/// [`Provider`](ethers_providers::Provider) architecture.
///
/// [`Middleware`] composition acts in a wrapping fashion. Adding a new layer results in wrapping
/// its predecessor.
///
/// ```rust
/// use ethers_providers::{Middleware, Provider, Http};
Expand Down Expand Up @@ -48,10 +49,9 @@ use ethers_signers::Signer;
/// }
/// ```
pub trait MiddlewareBuilder: Middleware + Sized + 'static {
/// Wraps `self` inside a new [`Middleware`](ethers_providers::Middleware).
/// Wraps `self` inside a new [`Middleware`].
///
/// `f` Consumes `self`. Must be used to return a new
/// [`Middleware`](ethers_providers::Middleware) wrapping `self`.
/// `f` Consumes `self`. Must be used to return a new [`Middleware`] wrapping `self`.
fn wrap_into<F, T>(self, f: F) -> T
where
F: FnOnce(Self) -> T,
Expand All @@ -60,26 +60,20 @@ pub trait MiddlewareBuilder: Middleware + Sized + 'static {
f(self)
}

/// Wraps `self` inside a [`SignerMiddleware`](crate::SignerMiddleware).
///
/// [`Signer`](ethers_signers::Signer)
/// Wraps `self` inside a [`SignerMiddleware`].
fn with_signer<S>(self, s: S) -> SignerMiddleware<Self, S>
where
S: Signer,
{
SignerMiddleware::new(self, s)
}

/// Wraps `self` inside a [`NonceManagerMiddleware`](crate::NonceManagerMiddleware).
///
/// [`Address`](ethers_core::types::Address)
/// Wraps `self` inside a [`NonceManagerMiddleware`].
fn nonce_manager(self, address: Address) -> NonceManagerMiddleware<Self> {
NonceManagerMiddleware::new(self, address)
}

/// Wraps `self` inside a [`GasOracleMiddleware`](crate::gas_oracle::GasOracleMiddleware).
///
/// [`GasOracle`](crate::gas_oracle::GasOracle)
/// Wraps `self` inside a [`GasOracleMiddleware`].
fn gas_oracle<G>(self, gas_oracle: G) -> GasOracleMiddleware<Self, G>
where
G: GasOracle,
Expand Down
33 changes: 19 additions & 14 deletions ethers-middleware/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,47 @@
/// is used to re-broadcast transactions with an increasing gas price to guarantee
/// their timely inclusion.
pub mod gas_escalator;
pub use gas_escalator::GasEscalatorMiddleware;

/// The gas oracle middleware is used to get the gas price from a list of gas oracles
/// instead of using eth_gasPrice. For usage examples, refer to the
/// [`GasOracle`](crate::gas_oracle::GasOracle) trait.
/// The gas oracle middleware is used to get the gas price from a list of gas oracles instead of
/// using `eth_gasPrice`. For usage examples, refer to the [`GasOracle`] trait.
pub mod gas_oracle;
pub use gas_oracle::GasOracle;

/// The [Nonce Manager](crate::NonceManagerMiddleware) is used to locally calculate nonces instead
/// of using eth_getTransactionCount
pub mod nonce_manager;
pub use nonce_manager::NonceManagerMiddleware;

/// The [Transformer](crate::transformer::TransformerMiddleware) is used to intercept transactions
/// The [TransformerMiddleware] is used to intercept transactions
/// and transform them to be sent via various supported transformers, e.g.,
/// [DSProxy](crate::transformer::DsProxy)
/// [DSProxy](crate::transformer::DsProxy).
pub mod transformer;
pub use transformer::TransformerMiddleware;

/// The [Signer](crate::SignerMiddleware) is used to locally sign transactions and messages
/// instead of using eth_sendTransaction and eth_sign
/// The [SignerMiddleware] is used to locally sign transactions and messages instead of using
/// `eth_sendTransaction` and `eth_sign`.
pub mod signer;
pub use signer::SignerMiddleware;

/// The [Policy](crate::PolicyMiddleware) is used to ensure transactions comply with the rules
/// configured in the `PolicyMiddleware` before sending them.
/// The [Policy] is used to ensure transactions comply with the rules configured in the
/// [`PolicyMiddleware`] before sending them.
pub mod policy;
pub use policy::PolicyMiddleware;
pub use policy::{
AllowEverything, Policy, PolicyMiddleware, PolicyMiddlewareError, RejectEverything,
};

/// The [TimeLag](crate::TimeLag) provides safety against reorgs by querying state N blocks
/// before the chain tip
/// The [TimeLag] middleware provides safety against reorgs by querying state N blocks before the
/// chain tip.
pub mod timelag;
pub use timelag::TimeLag;

/// The [MiddlewareBuilder](crate::MiddlewareBuilder) provides a way to compose many
/// [`Middleware`](ethers_providers::Middleware) in a concise way
/// [MiddlewareBuilder] provides a way to compose many [`Middleware`]s in a concise way.
pub mod builder;
pub use builder::MiddlewareBuilder;

pub use ethers_providers::{Middleware, MiddlewareError};

// For macro expansions only, not public API.
// See: [#2235](https://github.com/gakonst/ethers-rs/pull/2235)

Expand Down
2 changes: 1 addition & 1 deletion ethers-middleware/src/transformer/ds_proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DS_PROXY_EXECUTE_TARGET: &str =
const DS_PROXY_EXECUTE_CODE: &str =
"function execute(bytes memory code, bytes memory data) public payable returns (address target, bytes memory response)";

/// Represents the DsProxy type that implements the [Transformer](super::Transformer) trait.
/// Represents the DsProxy type that implements the [Transformer] trait.
///
/// # Example
///
Expand Down
6 changes: 3 additions & 3 deletions ethers-solc/src/compile/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
//!
//! ### Caching and Change detection
//!
//! If caching is enabled in the [Project](crate::Project) a cache file will be created upon a
//! successful solc build. The [cache file](crate::cache::SolFilesCache) stores metadata for all the
//! files that were provided to solc.
//! If caching is enabled in the [Project] a cache file will be created upon a successful solc
//! build. The [cache file](crate::cache::SolFilesCache) stores metadata for all the files that were
//! provided to solc.
//! For every file the cache file contains a dedicated [cache entry](crate::cache::CacheEntry),
//! which represents the state of the file. A solidity file can contain several contracts, for every
//! contract a separate [artifact](crate::Artifact) is emitted. Therefor the entry also tracks all
Expand Down

0 comments on commit 7603af0

Please sign in to comment.