diff --git a/bin/subalfred/src/command/check/runtime.rs b/bin/subalfred/src/command/check/runtime.rs index 275bad9a..adbebd97 100644 --- a/bin/subalfred/src/command/check/runtime.rs +++ b/bin/subalfred/src/command/check/runtime.rs @@ -13,7 +13,7 @@ pub(crate) struct RuntimeCmd { #[arg(long, required = true, value_name = "PATH")] executable: String, /// Pass this name to `--chain` to launch the local chain. - #[arg(long, required = true, value_name = "NAME")] + #[arg(long, required = true, value_name = "CHAIN")] chain: String, /// Live chain's HTTP RPC endpoint. #[arg(long, required = true, value_name = "URI")] diff --git a/bin/subalfred/src/command/convert/ascii2hex.rs b/bin/subalfred/src/command/convert/ascii2hex.rs index 59160257..0808f895 100644 --- a/bin/subalfred/src/command/convert/ascii2hex.rs +++ b/bin/subalfred/src/command/convert/ascii2hex.rs @@ -7,7 +7,7 @@ use crate::prelude::*; #[derive(Debug, Args)] pub(crate) struct Ascii2HexCmd { /// Ascii data input. - #[arg(required = true, value_name = "ASCII DATA")] + #[arg(required = true, value_name = "ASCII")] data: String, } impl Ascii2HexCmd { diff --git a/bin/subalfred/src/command/convert/bytes_style.rs b/bin/subalfred/src/command/convert/bytes_style.rs index b15ebc0a..1b525299 100644 --- a/bin/subalfred/src/command/convert/bytes_style.rs +++ b/bin/subalfred/src/command/convert/bytes_style.rs @@ -11,10 +11,10 @@ pub(crate) struct BytesStyleCmd { #[arg(required = true, value_name = "BYTES")] bytes: String, /// Origin style. - #[arg(value_enum, long, required = true, value_name = "BYTES STYLE")] + #[arg(value_enum, long, required = true, value_name = "STYLE")] from: BytesStringKind, /// Target style. - #[arg(value_enum, long, required = true, value_name = "BYTES STYLE")] + #[arg(value_enum, long, required = true, value_name = "STYLE")] to: BytesStringKind, } impl BytesStyleCmd { diff --git a/bin/subalfred/src/command/impl/src/lib.rs b/bin/subalfred/src/command/impl/src/lib.rs index c3f2dff6..e29a0b5c 100644 --- a/bin/subalfred/src/command/impl/src/lib.rs +++ b/bin/subalfred/src/command/impl/src/lib.rs @@ -18,7 +18,7 @@ pub fn cmd(_: TokenStream, input: TokenStream) -> TokenStream { let ItemEnum { attrs: cmd_attrs, vis: cmd_vis, ident: cmd_name, variants: cmd_variants, .. } = cmd_enum; - let cmd_variants_names = + let cmd_variant_names = cmd_variants.iter().map(|variant| variant.ident.clone()).collect::>(); let cmd_variants = cmd_variants .into_iter() @@ -42,7 +42,7 @@ pub fn cmd(_: TokenStream, input: TokenStream) -> TokenStream { #cmd_vis fn run(&self) -> crate::prelude::Result<()> { match self { #( - Self::#cmd_variants_names(cmd) => cmd.run(), + Self::#cmd_variant_names(cmd) => cmd.run(), )* } } diff --git a/bin/subalfred/src/command/state/export.rs b/bin/subalfred/src/command/state/export.rs index 3196bfe9..974de055 100644 --- a/bin/subalfred/src/command/state/export.rs +++ b/bin/subalfred/src/command/state/export.rs @@ -13,6 +13,8 @@ pub(crate) struct ExportCmd { #[arg(required = true, value_name = "URI")] live: String, /// Export the data starting from this block. + /// + /// Accept block hash or block number. #[arg(long, value_name = "HASH/NUM")] at: Option, /// Timeout for the fetching. diff --git a/bin/subalfred/src/command/storage_key.rs b/bin/subalfred/src/command/storage_key.rs index c36c606e..bde6d39a 100644 --- a/bin/subalfred/src/command/storage_key.rs +++ b/bin/subalfred/src/command/storage_key.rs @@ -8,10 +8,10 @@ use crate::prelude::*; #[derive(Debug, Args)] pub(crate) struct StorageKeyCmd { /// Prefix of the storage. - #[arg(long, required = true, value_name = "PREFIX")] + #[arg(long, required = true, value_name = "NAME")] pallet: String, /// Name of the storage item. - #[arg(long, required = true, value_name = "ITEM")] + #[arg(long, required = true, value_name = "NAME")] item: String, } impl StorageKeyCmd { diff --git a/lib/core/src/cargo/mod.rs b/lib/core/src/cargo/mod.rs index 928f4d73..8930f4a1 100644 --- a/lib/core/src/cargo/mod.rs +++ b/lib/core/src/cargo/mod.rs @@ -85,17 +85,17 @@ pub async fn update_member_versions(to: &str, manifest_path: &str) -> Result<()> }; let mut tasks = stream::iter(&members) .map(|pkg| async { - let members_deps = pkg + let member_deps = pkg .dependencies .iter() .filter(|dep| members.iter().any(|pkg| dep.name == pkg.name)) .collect::>(); let content = system::read_file_to_string(&pkg.manifest_path)?; let content = content.replacen(&pkg.version.to_string(), to, 1); - let content = if members_deps.is_empty() { + let content = if member_deps.is_empty() { Cow::Owned(content) } else { - util::find_member_dep_regex(&members_deps).replace_all( + util::find_member_dep_regex(&member_deps).replace_all( &content, |caps: &Captures| { format!("{}\"{}\"", &caps[1], util::align_version(&caps[3], to)) diff --git a/lib/core/src/cargo/util.rs b/lib/core/src/cargo/util.rs index b54e693f..b0ea987f 100644 --- a/lib/core/src/cargo/util.rs +++ b/lib/core/src/cargo/util.rs @@ -25,10 +25,10 @@ pub fn find_package<'a>(metadata: &'a Metadata, id: &PackageId) -> Option<&'a Pa metadata.packages.iter().find(|pkg| &pkg.id == id) } -pub fn find_member_dep_regex(members_deps: &[&Dependency]) -> Regex { +pub fn find_member_dep_regex(member_deps: &[&Dependency]) -> Regex { Regex::new(&format!( "(({}) *?= *?\\{{ *?version *?= *?)\"(.+?)\"", - members_deps.iter().map(|dep| dep.name.replace('-', "\\-")).collect::>().join("|"), + member_deps.iter().map(|dep| dep.name.replace('-', "\\-")).collect::>().join("|"), )) .expect("[core::cargo] build constant regex never fails; qed") } diff --git a/lib/core/src/jsonrpc/mod.rs b/lib/core/src/jsonrpc/mod.rs index 6a7fe1b8..7fc71c9a 100644 --- a/lib/core/src/jsonrpc/mod.rs +++ b/lib/core/src/jsonrpc/mod.rs @@ -16,6 +16,7 @@ use crate::prelude::*; /// JSONRPC Id. pub type Id = usize; +// TODO: doc /// Generic JSONRPC request. #[allow(missing_docs)] #[derive(Debug, Serialize)] @@ -27,6 +28,7 @@ pub struct Request<'a, P> { pub method: &'a str, pub params: P, } +// TODO: doc /// Raw JSONRPC request. #[allow(missing_docs)] #[derive(Debug)] @@ -40,6 +42,7 @@ impl<'a, P> From<(&'a str, P)> for RawRequest<'a, P> { } } +// TODO: doc /// Generic JSONRPC response. #[allow(missing_docs)] #[derive(Debug, Deserialize)] diff --git a/substrate-minimal/subrpcer/src/client/r.rs b/substrate-minimal/subrpcer/src/client/r.rs index cf4675a4..541d50fd 100644 --- a/substrate-minimal/subrpcer/src/client/r.rs +++ b/substrate-minimal/subrpcer/src/client/r.rs @@ -5,9 +5,11 @@ use once_cell::sync::Lazy; use reqwest::{Client, Error, Response}; use serde_json::Value; +#[allow(unused)] static CLIENT: Lazy> = Lazy::new(|| Arc::new(Client::new())); /// A simple HTTP post helper which implements with [reqwest](https://crates.io/crates/reqwest). +#[allow(unused)] pub async fn send_jsonrpc(uri: &str, json: &Value) -> Result { CLIENT.post(uri).json(json).send().await } diff --git a/substrate-minimal/subrpcer/src/client/u.rs b/substrate-minimal/subrpcer/src/client/u.rs index 52ab290d..c2e8114f 100644 --- a/substrate-minimal/subrpcer/src/client/u.rs +++ b/substrate-minimal/subrpcer/src/client/u.rs @@ -3,6 +3,7 @@ use serde_json::Value; use ureq::{Error, Response}; /// A simple HTTP post helper which implements with [ureq](https://crates.io/crates/ureq). +#[allow(unused, clippy::result_large_err)] pub fn send_jsonrpc(uri: &str, body: &Value) -> Result { ureq::post(uri) .set("Content-Type", "application/json;charset=utf-8")