diff --git a/Cargo.toml b/Cargo.toml index b824bd9739..225b532c61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,6 +58,8 @@ unused_extern_crates = "deny" [workspace.lints.clippy] type_complexity = "allow" all = "deny" +# https://github.com/rust-lang/rust-clippy/issues/12643 +manual-unwrap-or-default = "allow" [workspace.dependencies] async-trait = "0.1.80" diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 5ffde7e92f..cc122419e6 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -43,3 +43,6 @@ rustdoc-args = ["--cfg", "docsrs"] [package.metadata.playground] defalt-features = true + +[lints] +workspace = true \ No newline at end of file diff --git a/core/Cargo.toml b/core/Cargo.toml index 7e6019ff61..cc77f943ea 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -35,7 +35,6 @@ std = [ substrate-compat = ["sp-core", "sp-runtime"] [dependencies] - codec = { package = "parity-scale-codec", workspace = true, default-features = false, features = ["derive"] } scale-info = { workspace = true, default-features = false, features = ["bit-vec"] } scale-value = { workspace = true, default-features = false } @@ -83,3 +82,6 @@ rustdoc-args = ["--cfg", "docsrs"] [package.metadata.playground] defalt-features = true + +[lints] +workspace = true \ No newline at end of file diff --git a/macro/Cargo.toml b/macro/Cargo.toml index 24263aab29..90fb392591 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -27,3 +27,6 @@ syn = { workspace = true } quote = { workspace = true } subxt-codegen = { workspace = true, features = ["fetch-metadata"] } scale-typegen = { workspace = true } + +[lints] +workspace = true \ No newline at end of file diff --git a/macro/src/lib.rs b/macro/src/lib.rs index 6b72667e7e..288ac6162b 100644 --- a/macro/src/lib.rs +++ b/macro/src/lib.rs @@ -3,8 +3,8 @@ // see LICENSE for license details. //! Subxt macro for generating Substrate runtime interfaces. - -extern crate proc_macro; +// TODO: The workspace lint is not working properly so it's disabled here for now. +#![allow(clippy::manual_unwrap_or_default)] use codec::Decode; use darling::{ast::NestedMeta, FromMeta}; @@ -85,6 +85,7 @@ struct SubstituteType { } // Note: docs for this are in the subxt library; don't add further docs here as they will be appended. +#[allow(missing_docs)] #[proc_macro_attribute] #[proc_macro_error] pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream { diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index b080adb8b5..0ad5316100 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -37,3 +37,6 @@ bench = false [[bench]] name = "bench" harness = false + +[lints] +workspace = true \ No newline at end of file diff --git a/metadata/benches/bench.rs b/metadata/benches/bench.rs index c19e0adaae..f3d9439ae6 100644 --- a/metadata/benches/bench.rs +++ b/metadata/benches/bench.rs @@ -3,7 +3,7 @@ // see LICENSE for license details. //! Benchmarks for metadata hashing. - +#![allow(missing_docs)] use codec::Decode; use criterion::*; use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed}; @@ -92,4 +92,5 @@ criterion_group!( bench_get_constant_hash, bench_get_storage_hash, ); + criterion_main!(benches); diff --git a/signer/Cargo.toml b/signer/Cargo.toml index b4ce0e5df4..d83c5f31f7 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -79,3 +79,6 @@ rustdoc-args = ["--cfg", "docsrs"] [package.metadata.playground] defalt-features = true + +[lints] +workspace = true \ No newline at end of file diff --git a/signer/src/eth.rs b/signer/src/eth.rs index 0d4d8a6b49..3a82580a4c 100644 --- a/signer/src/eth.rs +++ b/signer/src/eth.rs @@ -207,6 +207,18 @@ impl Display for AccountId20 { } } +/// Verify that some signature for a message was created by the owner of the [`PublicKey`]. +/// +/// ```rust +/// use subxt_signer::{ bip39::Mnemonic, eth }; +/// +/// let keypair = eth::dev::alith(); +/// let message = b"Hello!"; +/// +/// let signature = keypair.sign(message); +/// let public_key = keypair.public_key(); +/// assert!(eth::verify(&signature, message, &public_key)); +/// ``` pub fn verify>(sig: &Signature, message: M, pubkey: &ecdsa::PublicKey) -> bool { let message_hash = keccak(message.as_ref()); let wrapped = diff --git a/signer/src/utils.rs b/signer/src/utils.rs index 89d261e3b9..72b6e14fa7 100644 --- a/signer/src/utils.rs +++ b/signer/src/utils.rs @@ -21,6 +21,7 @@ macro_rules! once_static_cloned { ($($(#[$attr:meta])* $vis:vis fn $name:ident() -> $ty:ty { $expr:expr } )+) => { $( $(#[$attr])* + #[allow(missing_docs)] $vis fn $name() -> $ty { cfg_if::cfg_if! { if #[cfg(feature = "std")] {