Skip to content

Commit

Permalink
chore: fix rustdoc warnings (foundry-rs#8069)
Browse files Browse the repository at this point in the history
* ci

* chore: fix rustdoc warnings
  • Loading branch information
DaniPopes authored Jun 5, 2024
1 parent d5fb750 commit 11d9c1a
Show file tree
Hide file tree
Showing 84 changed files with 397 additions and 402 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/deny.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: deny

on:
push:
branches: [master]
paths: [Cargo.lock, deny.toml]
pull_request:
branches: [master]
paths: [Cargo.lock, deny.toml]
push:
branches: [master]
paths: [Cargo.lock, deny.toml]
pull_request:
branches: [master]
paths: [Cargo.lock, deny.toml]

env:
CARGO_TERM_COLOR: always
CARGO_TERM_COLOR: always

jobs:
cargo-deny:
name: cargo deny check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
# Clear out arguments to not pass `--all-features` to `cargo deny`.
# many crates have an `openssl` feature which enables banned dependencies
arguments: ""
cargo-deny:
name: cargo deny check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
# Clear out arguments to not pass `--all-features` to `cargo deny`.
# many crates have an `openssl` feature which enables banned dependencies
arguments: ""
103 changes: 50 additions & 53 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,61 @@
# Automatically run `cargo update` periodically
# Runs `cargo update` periodically.

name: dependencies

on:
schedule:
# Run weekly
- cron: "0 0 * * SUN"
workflow_dispatch:
# Needed so we can run it manually
schedule:
# Run weekly
- cron: "0 0 * * SUN"
workflow_dispatch:
# Needed so we can run it manually

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: cargo-update
TITLE: "chore(deps): weekly `cargo update`"
BODY: |
Automation to keep dependencies in `Cargo.lock` current.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: cargo-update
TITLE: "chore(deps): weekly `cargo update`"
BODY: |
Automation to keep dependencies in `Cargo.lock` current.
<details><summary><strong>cargo update log</strong></summary>
<p>
<details><summary><strong>cargo update log</strong></summary>
<p>
```log
$cargo_update_log
```
```log
$cargo_update_log
```
</p>
</details>
</p>
</details>
jobs:
update:
name: Update
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly

- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run:
cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a
cargo_update.log

- name: craft commit message and PR body
id: msg
run: |
export cargo_update_log="$(cat cargo_update.log)"
echo "commit_message<<EOF" >> $GITHUB_OUTPUT
printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" | envsubst >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
add-paths: ./Cargo.lock
commit-message: ${{ steps.msg.outputs.commit_message }}
title: ${{ env.TITLE }}
body: ${{ steps.msg.outputs.body }}
branch: ${{ env.BRANCH }}
update:
name: Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly

- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run: cargo update --color never 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log

- name: craft commit message and PR body
id: msg
run: |
export cargo_update_log="$(cat cargo_update.log)"
echo "commit_message<<EOF" >> $GITHUB_OUTPUT
printf "$TITLE\n\n$cargo_update_log\n" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$BODY" | envsubst >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
add-paths: ./Cargo.lock
commit-message: ${{ steps.msg.outputs.commit_message }}
title: ${{ env.TITLE }}
body: ${{ steps.msg.outputs.body }}
branch: ${{ env.BRANCH }}
12 changes: 5 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,18 @@ jobs:
docs:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
pages: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- run: cargo doc --workspace --all-features --no-deps --document-private-items
- name: Build documentation
run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS:
--cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page
-Zunstable-options
RUSTDOCFLAGS: --cfg docsrs -D warnings --show-type-layout --generate-link-to-definition -Zunstable-options
- name: Doc index page redirection
run: echo '<meta http-equiv="refresh" content="1; url=alloy/index.html">' > target/doc/index.html
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ rust-2018-idioms = "deny"
unused-must-use = "deny"

[workspace.lints.rustdoc]
# all = "warn"
all = "warn"

# Speed up compilation time for dev builds by reducing emitted debug info.
# NOTE: Debuggers may provide less useful information with this setting.
Expand Down
6 changes: 3 additions & 3 deletions crates/anvil/core/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ pub struct Block {
}

impl Block {
/// Creates a new block
/// Creates a new block.
///
/// Note: if the `impersonate-tx` feature is enabled this will also accept
/// [MaybeImpersonatedTransaction]
/// Note: if the `impersonate-tx` feature is enabled this will also accept
/// `MaybeImpersonatedTransaction`.
pub fn new<T>(
partial_header: PartialHeader,
transactions: impl IntoIterator<Item = T>,
Expand Down
10 changes: 5 additions & 5 deletions crates/anvil/core/src/eth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,26 +620,26 @@ pub enum EthRequest {

/// Returns the number of transactions currently pending for inclusion in the next block(s), as
/// well as the ones that are being scheduled for future execution only.
/// Ref: [Here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_status)
/// Ref: <https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_status>
#[cfg_attr(feature = "serde", serde(rename = "txpool_status", with = "empty_params"))]
TxPoolStatus(()),

/// Returns a summary of all the transactions currently pending for inclusion in the next
/// block(s), as well as the ones that are being scheduled for future execution only.
/// Ref: [Here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_inspect)
/// Ref: <https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_inspect>
#[cfg_attr(feature = "serde", serde(rename = "txpool_inspect", with = "empty_params"))]
TxPoolInspect(()),

/// Returns the details of all transactions currently pending for inclusion in the next
/// block(s), as well as the ones that are being scheduled for future execution only.
/// Ref: [Here](https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content)
/// Ref: <https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content>
#[cfg_attr(feature = "serde", serde(rename = "txpool_content", with = "empty_params"))]
TxPoolContent(()),

/// Otterscan's `ots_getApiLevel` endpoint
/// Otterscan currently requires this endpoint, even though it's not part of the ots_*
/// https://github.com/otterscan/otterscan/blob/071d8c55202badf01804f6f8d53ef9311d4a9e47/src/useProvider.ts#L71
/// Related upstream issue: https://github.com/otterscan/otterscan/issues/1081
/// <https://github.com/otterscan/otterscan/blob/071d8c55202badf01804f6f8d53ef9311d4a9e47/src/useProvider.ts#L71>
/// Related upstream issue: <https://github.com/otterscan/otterscan/issues/1081>
#[cfg_attr(feature = "serde", serde(rename = "erigon_getHeaderByNumber"))]
ErigonGetHeaderByNumber(
#[cfg_attr(
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/core/src/eth/transaction/optimism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl DepositTransaction {
len
}

/// Decodes the inner [TxDeposit] fields from RLP bytes.
/// Decodes the inner fields from RLP bytes
///
/// NOTE: This assumes a RLP header has already been decoded, and _just_ decodes the following
/// RLP fields in the following order:
Expand Down
16 changes: 8 additions & 8 deletions crates/anvil/rpc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,48 @@ pub struct RpcError {
}

impl RpcError {
/// New [Error] with the given [ErrorCode]
/// New [`RpcError`] with the given [`ErrorCode`].
pub const fn new(code: ErrorCode) -> Self {
Self { message: Cow::Borrowed(code.message()), code, data: None }
}

/// Creates a new `ParseError`
/// Creates a new `ParseError` error.
pub const fn parse_error() -> Self {
Self::new(ErrorCode::ParseError)
}

/// Creates a new `MethodNotFound`
/// Creates a new `MethodNotFound` error.
pub const fn method_not_found() -> Self {
Self::new(ErrorCode::MethodNotFound)
}

/// Creates a new `InvalidRequest`
/// Creates a new `InvalidRequest` error.
pub const fn invalid_request() -> Self {
Self::new(ErrorCode::InvalidRequest)
}

/// Creates a new `InternalError`
/// Creates a new `InternalError` error.
pub const fn internal_error() -> Self {
Self::new(ErrorCode::InternalError)
}

/// Creates a new `InvalidParams`
/// Creates a new `InvalidParams` error.
pub fn invalid_params<M>(message: M) -> Self
where
M: Into<String>,
{
Self { code: ErrorCode::InvalidParams, message: message.into().into(), data: None }
}

/// Creates a new `InternalError` with a message
/// Creates a new `InternalError` error with a message.
pub fn internal_error_with<M>(message: M) -> Self
where
M: Into<String>,
{
Self { code: ErrorCode::InternalError, message: message.into().into(), data: None }
}

/// Creates a new rpc error for when a transaction was rejected
/// Creates a new RPC error for when a transaction was rejected.
pub fn transaction_rejected<M>(message: M) -> Self
where
M: Into<String>,
Expand Down
2 changes: 1 addition & 1 deletion crates/anvil/rpc/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub enum Response {
}

impl Response {
/// Creates new [Response] with the given [Error]
/// Creates new [`Response`] with the given [`RpcError`].
pub fn error(error: RpcError) -> Self {
RpcResponse::new(Id::Null, ResponseResult::Error(error)).into()
}
Expand Down
6 changes: 3 additions & 3 deletions crates/anvil/server/src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ impl<Handler: PubSubRpcHandler> IpcEndpoint<Handler> {
Self { handler, path }
}

/// Returns a stream of incoming connection handlers
/// Returns a stream of incoming connection handlers.
///
/// This establishes the ipc endpoint, converts the incoming connections into handled eth
/// connections, See [`PubSubConnection`] that should be spawned
/// This establishes the IPC endpoint, converts the incoming connections into handled
/// connections.
#[instrument(target = "ipc", skip_all)]
pub fn incoming(self) -> io::Result<impl Stream<Item = impl Future<Output = ()>>> {
let Self { handler, path } = self;
Expand Down
6 changes: 2 additions & 4 deletions crates/anvil/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,7 @@ pub struct AnvilEvmArgs {
///
/// default value: 330
///
/// See --fork-url.
/// See also, https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second
/// See also --fork-url and <https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second>
#[arg(
long,
requires = "fork_url",
Expand All @@ -432,8 +431,7 @@ pub struct AnvilEvmArgs {
///
/// default value: false
///
/// See --fork-url.
/// See also, https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second
/// See also --fork-url and <https://docs.alchemy.com/reference/compute-units#what-are-cups-compute-units-per-second>
#[arg(
long,
requires = "fork_url",
Expand Down
11 changes: 5 additions & 6 deletions crates/anvil/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,9 @@ impl NodeConfig {
}

/// Configures everything related to forking based on the passed `eth_rpc_url`:
/// - returning a tuple of a [ForkedDatabase](ForkedDatabase) wrapped in an [Arc](Arc)
/// [RwLock](tokio::sync::RwLock) and [ClientFork](ClientFork) wrapped in an [Option](Option)
/// which can be used in a [Backend](mem::Backend) to fork from.
/// - returning a tuple of a [ForkedDatabase] wrapped in an [Arc] [RwLock](tokio::sync::RwLock)
/// and [ClientFork] wrapped in an [Option] which can be used in a [Backend](mem::Backend) to
/// fork from.
/// - modifying some parameters of the passed `env`
/// - mutating some members of `self`
pub async fn setup_fork_db(
Expand All @@ -973,9 +973,8 @@ impl NodeConfig {
}

/// Configures everything related to forking based on the passed `eth_rpc_url`:
/// - returning a tuple of a [ForkedDatabase](ForkedDatabase) and
/// [ClientForkConfig](ClientForkConfig) which can be used to build a
/// [ClientFork](ClientFork) to fork from.
/// - returning a tuple of a [ForkedDatabase] and [ClientForkConfig] which can be used to build
/// a [ClientFork] to fork from.
/// - modifying some parameters of the passed `env`
/// - mutating some members of `self`
pub async fn setup_fork_db_config(
Expand Down
Loading

0 comments on commit 11d9c1a

Please sign in to comment.