Skip to content

Commit

Permalink
add doc_markdown clippy lint (paradigmxyz#8552)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Shekhirin <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
3 people authored Jun 3, 2024
1 parent 34af610 commit 7c17c6e
Show file tree
Hide file tree
Showing 440 changed files with 2,166 additions and 2,145 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ use_self = "warn"
missing_const_for_fn = "warn"
empty_line_after_doc_comments = "warn"
iter_on_single_items = "warn"
doc_markdown = "warn"
unnecessary_struct_initialization = "warn"
string_lit_as_bytes = "warn"

Expand Down
10 changes: 5 additions & 5 deletions bin/reth/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ pub struct Cli<Ext: clap::Args + fmt::Debug = NoArgs> {
/// port numbers that conflict with each other.
///
/// Changes to the following port numbers:
/// - DISCOVERY_PORT: default + `instance` - 1
/// - AUTH_PORT: default + `instance` * 100 - 100
/// - HTTP_RPC_PORT: default - `instance` + 1
/// - WS_RPC_PORT: default + `instance` * 2 - 2
/// - `DISCOVERY_PORT`: default + `instance` - 1
/// - `AUTH_PORT`: default + `instance` * 100 - 100
/// - `HTTP_RPC_PORT`: default - `instance` + 1
/// - `WS_RPC_PORT`: default + `instance` * 2 - 2
#[arg(long, value_name = "INSTANCE", global = true, default_value_t = 1, value_parser = value_parser!(u16).range(..=200))]
instance: u16,

Expand Down Expand Up @@ -90,7 +90,7 @@ impl<Ext: clap::Args + fmt::Debug> Cli<Ext> {
/// Execute the configured cli command.
///
/// This accepts a closure that is used to launch the node via the
/// [NodeCommand](node::NodeCommand).
/// [`NodeCommand`](node::NodeCommand).
///
///
/// # Example
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub enum Subcommands {
Path,
}

/// db_ro_exec opens a database in read-only mode, and then execute with the provided command
/// `db_ro_exec` opens a database in read-only mode, and then execute with the provided command
macro_rules! db_ro_exec {
($chain:expr, $db_path:expr, $db_args:ident, $sfp:ident, $tool:ident, $command:block) => {
let db = open_db_read_only($db_path, $db_args)?;
Expand Down
24 changes: 12 additions & 12 deletions bin/reth/src/commands/db/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::{
};
use tracing::error;

/// Available keybindings for the [DbListTUI]
/// Available keybindings for the [`DbListTUI`]
static CMDS: [(&str, &str); 6] = [
("q", "Quit"),
("↑", "Entry above"),
Expand All @@ -30,8 +30,8 @@ static CMDS: [(&str, &str); 6] = [
("G", "Go to a specific page"),
];

/// Modified version of the [ListState] struct that exposes the `offset` field.
/// Used to make the [DbListTUI] keys clickable.
/// Modified version of the [`ListState`] struct that exposes the `offset` field.
/// Used to make the [`DbListTUI`] keys clickable.
struct ExpListState {
pub(crate) offset: usize,
}
Expand All @@ -46,15 +46,15 @@ pub(crate) enum ViewMode {
}

enum Entries<T: Table> {
/// Pairs of [Table::Key] and [RawValue<Table::Value>]
/// Pairs of [`Table::Key`] and [`RawValue<Table::Value>`]
RawValues(Vec<(T::Key, RawValue<T::Value>)>),
/// Pairs of [Table::Key] and [Table::Value]
/// Pairs of [`Table::Key`] and [`Table::Value`]
Values(Vec<TableRow<T>>),
}

impl<T: Table> Entries<T> {
/// Creates new empty [Entries] as [Entries::RawValues] if `raw_values == true` and as
/// [Entries::Values] if `raw == false`.
/// Creates new empty [Entries] as [`Entries::RawValues`] if `raw_values == true` and as
/// [`Entries::Values`] if `raw == false`.
const fn new_with_raw_values(raw_values: bool) -> Self {
if raw_values {
Self::RawValues(Vec::new())
Expand All @@ -63,8 +63,8 @@ impl<T: Table> Entries<T> {
}
}

/// Sets the internal entries [Vec], converting the [Table::Value] into [RawValue<Table::Value>]
/// if needed.
/// Sets the internal entries [Vec], converting the [`Table::Value`] into
/// [`RawValue<Table::Value>`] if needed.
fn set(&mut self, new_entries: Vec<TableRow<T>>) {
match self {
Self::RawValues(old_entries) => {
Expand All @@ -83,8 +83,8 @@ impl<T: Table> Entries<T> {
}
}

/// Returns an iterator over keys of the internal [Vec]. For both [Entries::RawValues] and
/// [Entries::Values], this iterator will yield [Table::Key].
/// Returns an iterator over keys of the internal [Vec]. For both [`Entries::RawValues`] and
/// [`Entries::Values`], this iterator will yield [`Table::Key`].
const fn iter_keys(&self) -> EntriesKeyIter<'_, T> {
EntriesKeyIter { entries: self, index: 0 }
}
Expand Down Expand Up @@ -210,7 +210,7 @@ where
self.reset();
}

/// Show the [DbListTUI] in the terminal.
/// Show the [`DbListTUI`] in the terminal.
pub(crate) fn run(mut self) -> eyre::Result<()> {
// Setup backend
enable_raw_mode()?;
Expand Down
10 changes: 5 additions & 5 deletions bin/reth/src/commands/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ pub struct NodeCommand<Ext: clap::Args + fmt::Debug = NoArgs> {
/// port numbers that conflict with each other.
///
/// Changes to the following port numbers:
/// - DISCOVERY_PORT: default + `instance` - 1
/// - AUTH_PORT: default + `instance` * 100 - 100
/// - HTTP_RPC_PORT: default - `instance` + 1
/// - WS_RPC_PORT: default + `instance` * 2 - 2
/// - `DISCOVERY_PORT`: default + `instance` - 1
/// - `AUTH_PORT`: default + `instance` * 100 - 100
/// - `HTTP_RPC_PORT`: default - `instance` + 1
/// - `WS_RPC_PORT`: default + `instance` * 2 - 2
#[arg(long, value_name = "INSTANCE", global = true, default_value_t = 1, value_parser = value_parser!(u16).range(..=200))]
pub instance: u16,

Expand Down Expand Up @@ -119,7 +119,7 @@ impl NodeCommand {
Self::parse()
}

/// Parsers only the default [NodeCommand] arguments from the given iterator
/// Parsers only the default [`NodeCommand`] arguments from the given iterator
pub fn try_parse_args_from<I, T>(itr: I) -> Result<Self, clap::error::Error>
where
I: IntoIterator<Item = T>,
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/stage/dump/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ fn import_tables_with_range<DB: Database>(
Ok(())
}

/// Dry-run an unwind to FROM block, so we can get the PlainStorageState and
/// PlainAccountState safely. There might be some state dependency from an address
/// Dry-run an unwind to FROM block, so we can get the `PlainStorageState` and
/// `PlainAccountState` safely. There might be some state dependency from an address
/// which hasn't been changed in the given range.
async fn unwind_and_copy<DB: Database>(
db_tool: &DbTool<DB>,
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/stage/dump/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ pub struct Command {
pub enum Stages {
/// Execution stage.
Execution(StageCommand),
/// StorageHashing stage.
/// `StorageHashing` stage.
StorageHashing(StageCommand),
/// AccountHashing stage.
/// `AccountHashing` stage.
AccountHashing(StageCommand),
/// Merkle stage.
Merkle(StageCommand),
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub use reth_node_core::utils::*;
pub struct DbTool<DB: Database> {
/// The provider factory that the db tool will use.
pub provider_factory: ProviderFactory<DB>,
/// The [ChainSpec] that the db tool will use.
/// The [`ChainSpec`] that the db tool will use.
pub chain: Arc<ChainSpec>,
}

Expand Down Expand Up @@ -126,7 +126,7 @@ impl<DB: Database> DbTool<DB> {
self.provider_factory.db_ref().view(|tx| tx.get::<T>(key))?.map_err(|e| eyre::eyre!(e))
}

/// Grabs the content of the DupSort table for the given key and subkey
/// Grabs the content of the `DupSort` table for the given key and subkey
pub fn get_dup<T: DupSort>(&self, key: T::Key, subkey: T::SubKey) -> Result<Option<T::Value>> {
self.provider_factory
.db_ref()
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/checksum.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/clear.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/clear/mdbx.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/clear/static-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
40 changes: 20 additions & 20 deletions book/cli/reth/db/clear/static_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ Arguments:
Options:
--datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories.

Defaults to the OS-specific data directory:

- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`

[default: default]

--chain <CHAIN_OR_PATH>
The chain this node is running.
Possible values are either a built-in chain or the path to a chain specification file.

Built-in chains:
mainnet, sepolia, goerli, holesky, dev

[default: mainnet]

--instance <INSTANCE>
Add a new instance of a node.

Configures the ports of the node to avoid conflicts with the defaults. This is useful for running multiple nodes on the same machine.

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
-h, --help
Expand All @@ -51,7 +51,7 @@ Options:
Logging:
--log.stdout.format <FORMAT>
The format to use for logs written to stdout
[default: terminal]
Possible values:
Expand All @@ -61,12 +61,12 @@ Logging:
--log.stdout.filter <FILTER>
The filter to use for logs written to stdout
[default: ]
--log.file.format <FORMAT>
The format to use for logs written to the log file
[default: terminal]
Possible values:
Expand All @@ -76,35 +76,35 @@ Logging:
--log.file.filter <FILTER>
The filter to use for logs written to the log file
[default: debug]
--log.file.directory <PATH>
The path to put log files in
[default: <CACHE_DIR>/logs]
--log.file.max-size <SIZE>
The maximum size (in MB) of one log file
[default: 200]
--log.file.max-files <COUNT>
The maximum amount of log files that will be stored. If set to 0, background file logging is disabled
[default: 5]
--log.journald
Write logs to journald
--log.journald.filter <FILTER>
The filter to use for logs written to journald
[default: error]
--color <COLOR>
Sets whether or not the formatter emits ANSI terminal escape codes for colors and other text formatting
[default: always]
Possible values:
Expand All @@ -115,7 +115,7 @@ Logging:
Display:
-v, --verbosity...
Set the minimum log level.
-v Errors
-vv Warnings
-vvv Info
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
2 changes: 1 addition & 1 deletion book/cli/reth/db/get/mdbx.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Options:

Max number of instances is 200. It is chosen in a way so that it's not possible to have port numbers that conflict with each other.
Changes to the following port numbers: - DISCOVERY_PORT: default + `instance` - 1 - AUTH_PORT: default + `instance` * 100 - 100 - HTTP_RPC_PORT: default - `instance` + 1 - WS_RPC_PORT: default + `instance` * 2 - 2
Changes to the following port numbers: - `DISCOVERY_PORT`: default + `instance` - 1 - `AUTH_PORT`: default + `instance` * 100 - 100 - `HTTP_RPC_PORT`: default - `instance` + 1 - `WS_RPC_PORT`: default + `instance` * 2 - 2
[default: 1]
Expand Down
Loading

0 comments on commit 7c17c6e

Please sign in to comment.