mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
cargo: Switch to workspace lints (#1299)
* subxt: Remove unstable lints that cause compile warnings Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Switch to workspace lints Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Fix codec package at root level Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Move profiles to the root level Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Fix lightclient and metadata crates Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Revert "cargo: Fix codec package at root level" This reverts commit cdf9e1628d708a972673eb3a9e967b6896edbd73. * Fix complexity clippy Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Remove lints to be replaced by `cargo machete` Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Remove unused dependencies (detected by machete) Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Add machete step Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * cargo: Bump rust version Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Rename machete step Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * ci: Rename cargo machete step Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -318,3 +318,30 @@ jobs:
|
||||
with:
|
||||
command: clippy
|
||||
args: --all-targets -- -D warnings
|
||||
machete:
|
||||
name: "Check unused dependencies"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use substrate-node binary
|
||||
uses: ./.github/workflows/actions/use-substrate
|
||||
|
||||
- name: Install Rust stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1
|
||||
|
||||
- name: Install cargo-machete
|
||||
run: cargo install cargo-machete
|
||||
|
||||
- name: Check unused dependencies
|
||||
uses: actions-rs/cargo@v1.0.3
|
||||
with:
|
||||
command: machete
|
||||
|
||||
Generated
-2
@@ -1660,7 +1660,6 @@ dependencies = [
|
||||
"frame-metadata 16.0.0",
|
||||
"parity-scale-codec",
|
||||
"scale-info",
|
||||
"subxt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4438,7 +4437,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
"tracing",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
|
||||
+29
-1
@@ -30,12 +30,31 @@ resolver = "2"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2021"
|
||||
version = "0.32.1"
|
||||
rust-version = "1.70.0"
|
||||
rust-version = "1.74.0"
|
||||
license = "Apache-2.0 OR GPL-3.0"
|
||||
repository = "https://github.com/paritytech/subxt"
|
||||
documentation = "https://docs.rs/subxt"
|
||||
homepage = "https://www.parity.io/"
|
||||
|
||||
[workspace.lints.rust]
|
||||
bad_style = "deny"
|
||||
improper_ctypes = "deny"
|
||||
missing_docs = "deny"
|
||||
non_shorthand_field_patterns = "deny"
|
||||
no_mangle_generic_items = "deny"
|
||||
overflowing_literals = "deny"
|
||||
path_statements = "deny"
|
||||
patterns_in_fns_without_body = "deny"
|
||||
unconditional_recursion = "deny"
|
||||
unused_allocation = "deny"
|
||||
unused_comparisons = "deny"
|
||||
unused_parens = "deny"
|
||||
unused_extern_crates = "deny"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
type_complexity = "allow"
|
||||
all = "deny"
|
||||
|
||||
[workspace.dependencies]
|
||||
async-trait = "0.1.74"
|
||||
assert_matches = "1.5.0"
|
||||
@@ -124,3 +143,12 @@ secp256k1 = "0.28.0"
|
||||
secrecy = "0.8.0"
|
||||
sha2 = "0.10.8"
|
||||
zeroize = { version = "1", default-features = false }
|
||||
|
||||
[profile.dev.package.smoldot-light]
|
||||
opt-level = 2
|
||||
[profile.test.package.smoldot-light]
|
||||
opt-level = 2
|
||||
[profile.dev.package.smoldot]
|
||||
opt-level = 2
|
||||
[profile.test.package.smoldot]
|
||||
opt-level = 2
|
||||
|
||||
@@ -16,6 +16,9 @@ description = "Command line utilities for working with subxt codegen"
|
||||
name = "subxt"
|
||||
path = "src/main.rs"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
# Compute the state root hash from the genesis entry.
|
||||
# Enable this to create a smaller chain spec file.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//! Build script for the CLI.
|
||||
|
||||
use std::{borrow::Cow, process::Command};
|
||||
|
||||
fn main() {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
#![deny(unused_crate_dependencies)]
|
||||
//! The Subxt CLI tool.
|
||||
|
||||
mod commands;
|
||||
mod utils;
|
||||
|
||||
@@ -12,6 +12,7 @@ documentation = "https://docs.rs/subxt-codegen"
|
||||
homepage.workspace = true
|
||||
description = "Generate an API for interacting with a substrate node from FRAME metadata"
|
||||
|
||||
|
||||
[features]
|
||||
default = []
|
||||
fetch-metadata = ["dep:jsonrpsee", "dep:tokio", "dep:frame-metadata"]
|
||||
|
||||
Generated
+130
-1503
File diff suppressed because it is too large
Load Diff
@@ -8,10 +8,4 @@ edition = "2021"
|
||||
[dependencies]
|
||||
subxt = { path = "../../subxt" }
|
||||
subxt-signer = { path = "../../signer" }
|
||||
futures = { version = "0.3.27", default-features = false, features = ["std"] }
|
||||
tokio = { version = "1.28", features = ["macros", "time", "rt-multi-thread"] }
|
||||
sp-core = "21.0.0"
|
||||
sp-runtime = "24.0.0"
|
||||
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false }
|
||||
scale-decode = "0.7.0"
|
||||
scale-encode = "0.3.0"
|
||||
|
||||
+3
-10
@@ -14,6 +14,9 @@ homepage.workspace = true
|
||||
description = "Light Client for chain interaction"
|
||||
keywords = ["parity", "substrate", "blockchain"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
default = ["native"]
|
||||
|
||||
@@ -72,17 +75,7 @@ wasm-bindgen = { workspace = true, optional = true }
|
||||
wasm-bindgen-futures = { workspace = true, optional = true }
|
||||
futures-timer = { workspace = true, optional = true }
|
||||
instant = { workspace = true, optional = true }
|
||||
tokio-util = { workspace = true, optional = true }
|
||||
pin-project = { workspace = true, optional = true }
|
||||
|
||||
# Included if "web" feature is enabled, to enable its js feature.
|
||||
getrandom = { workspace = true, optional = true }
|
||||
|
||||
[profile.dev.package.smoldot-light]
|
||||
opt-level = 2
|
||||
[profile.test.package.smoldot-light]
|
||||
opt-level = 2
|
||||
[profile.dev.package.smoldot]
|
||||
opt-level = 2
|
||||
[profile.test.package.smoldot]
|
||||
opt-level = 2
|
||||
|
||||
@@ -55,6 +55,7 @@ pub enum FromSubxt {
|
||||
}
|
||||
|
||||
/// Background task data.
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub struct BackgroundTask<TPlatform: PlatformRef, TChain> {
|
||||
/// Smoldot light client implementation that leverages the exposed platform.
|
||||
client: smoldot_light::Client<TPlatform, TChain>,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2019-2023 Parity Technologies (UK) Ltd.
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use std::iter;
|
||||
|
||||
use super::{
|
||||
@@ -175,6 +174,7 @@ impl LightClientRpc {
|
||||
///
|
||||
/// This method sends a request to the light-client to establish an RPC subscription with the provided parameters.
|
||||
/// The parameters are parsed into a valid JSON object in the background.
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn subscription_request(
|
||||
&self,
|
||||
method: String,
|
||||
|
||||
@@ -10,14 +10,6 @@
|
||||
//!
|
||||
//! This leverages the smoldot crate to connect to the chain.
|
||||
|
||||
#![deny(
|
||||
missing_docs,
|
||||
unused_crate_dependencies,
|
||||
unused_extern_crates,
|
||||
clippy::all
|
||||
)]
|
||||
#![allow(clippy::type_complexity)]
|
||||
|
||||
#[cfg(any(
|
||||
all(feature = "web", feature = "native"),
|
||||
not(any(feature = "web", feature = "native"))
|
||||
|
||||
+3
-1
@@ -2,6 +2,8 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
//! Subxt macro for generating Substrate runtime interfaces.
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
use codec::Decode;
|
||||
@@ -73,7 +75,7 @@ struct SubstituteType {
|
||||
with: syn::Path,
|
||||
}
|
||||
|
||||
// Note: docs for this are in the subxt library; don't add any here as they will be appended.
|
||||
// Note: docs for this are in the subxt library; don't add further docs here as they will be appended.
|
||||
#[proc_macro_attribute]
|
||||
#[proc_macro_error]
|
||||
pub fn subxt(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
//! Benchmarks for metadata hashing.
|
||||
|
||||
use codec::Decode;
|
||||
use criterion::*;
|
||||
use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed};
|
||||
|
||||
@@ -55,3 +55,6 @@ getrandom = { workspace = true, optional = true }
|
||||
[dev-dependencies]
|
||||
sp-core = { workspace = true, features = ["std"] }
|
||||
sp-keyring = { workspace = true }
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["getrandom"]
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
//! Enable the `subxt` feature to enable use of this [`sr25519::Keypair`] in signing
|
||||
//! subxt transactions for chains supporting sr25519 signatures.
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[macro_use]
|
||||
mod utils;
|
||||
mod crypto;
|
||||
|
||||
@@ -14,6 +14,9 @@ homepage.workspace = true
|
||||
description = "Submit extrinsics (transactions) to a substrate node via RPC"
|
||||
keywords = ["parity", "substrate", "blockchain"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
# For dev and documentation reasons we enable more features than are often desired.
|
||||
# it's recommended to use `--no-default-features` and then select what you need.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_small.scale")]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use futures::StreamExt;
|
||||
use std::{iter, num::NonZeroU32};
|
||||
use subxt::{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{client::LightClient, PolkadotConfig};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::backend::{legacy::LegacyRpcMethods, rpc::RpcClient};
|
||||
use subxt::config::DefaultExtrinsicParamsBuilder as Params;
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::dynamic::Value;
|
||||
use subxt::{config::PolkadotConfig, OnlineClient};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::ext::codec::Compact;
|
||||
use subxt::ext::frame_metadata::RuntimeMetadataPrefixed;
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{config::PolkadotConfig, OnlineClient};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use std::{
|
||||
fmt::Write,
|
||||
pin::Pin,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::ext::codec::Decode;
|
||||
use subxt::metadata::Metadata;
|
||||
use subxt::utils::H256;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use codec::Encode;
|
||||
use subxt::client::OfflineClientT;
|
||||
use subxt::config::{Config, ExtrinsicParams, ExtrinsicParamsEncoder, ExtrinsicParamsError};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use codec::Encode;
|
||||
use scale_encode::EncodeAsType;
|
||||
use scale_info::PortableRegistry;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::dynamic::{At, Value};
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use polkadot::multisig::events::NewMultisig;
|
||||
use polkadot::runtime_types::{
|
||||
frame_system::pallet::Call, polkadot_runtime::RuntimeCall, sp_weights::weight_v2::Weight,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::{tx::TxStatus, OnlineClient, PolkadotConfig};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(missing_docs)]
|
||||
use subxt::config::polkadot::PolkadotExtrinsicParamsBuilder as Params;
|
||||
use subxt::{OnlineClient, PolkadotConfig};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
@@ -337,6 +337,7 @@ const STORAGE_PAGE_SIZE: u32 = 32;
|
||||
|
||||
/// This provides a stream of values given some prefix `key`. It
|
||||
/// internally manages pagination and such.
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub struct StorageFetchDescendantKeysStream<T: Config> {
|
||||
methods: LegacyRpcMethods<T>,
|
||||
key: Vec<u8>,
|
||||
@@ -408,6 +409,7 @@ impl<T: Config> Stream for StorageFetchDescendantKeysStream<T> {
|
||||
}
|
||||
|
||||
/// This provides a stream of values given some stream of keys.
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub struct StorageFetchDescendantValuesStream<T: Config> {
|
||||
// Stream of keys.
|
||||
keys: StorageFetchDescendantKeysStream<T>,
|
||||
|
||||
@@ -809,6 +809,8 @@ pub(crate) mod hashmap_as_tuple_list {
|
||||
{
|
||||
deserializer.deserialize_any(HashMapVisitor(PhantomData))
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
struct HashMapVisitor<K, V, BH>(PhantomData<fn() -> HashMap<K, V, BH>>);
|
||||
|
||||
impl<'de, K, V, BH> Visitor<'de> for HashMapVisitor<K, V, BH>
|
||||
|
||||
@@ -10,30 +10,6 @@
|
||||
//!
|
||||
//! Take a look at [the Subxt guide](book) to learn more about how to use Subxt.
|
||||
|
||||
#![deny(
|
||||
bad_style,
|
||||
improper_ctypes,
|
||||
missing_docs,
|
||||
non_shorthand_field_patterns,
|
||||
no_mangle_generic_items,
|
||||
overflowing_literals,
|
||||
path_statements,
|
||||
patterns_in_fns_without_body,
|
||||
private_interfaces,
|
||||
private_bounds,
|
||||
unconditional_recursion,
|
||||
unused_allocation,
|
||||
unused_comparisons,
|
||||
unused_parens,
|
||||
while_true,
|
||||
trivial_casts,
|
||||
trivial_numeric_casts,
|
||||
unused_crate_dependencies,
|
||||
unused_extern_crates,
|
||||
clippy::all
|
||||
)]
|
||||
#![allow(clippy::type_complexity)]
|
||||
|
||||
#[cfg(any(
|
||||
all(feature = "web", feature = "native"),
|
||||
not(any(feature = "web", feature = "native"))
|
||||
|
||||
@@ -12,7 +12,6 @@ homepage.workspace = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
subxt = { workspace = true, features = ["native"] }
|
||||
scale-info = { workspace = true, features = ["bit-vec"] }
|
||||
frame-metadata = { workspace = true }
|
||||
codec = { package = "parity-scale-codec", workspace = true, features = ["derive", "bit-vec"] }
|
||||
|
||||
@@ -16,3 +16,6 @@ which = { workspace = true }
|
||||
jsonrpsee = { workspace = true, features = ["async-client", "client-ws-transport-native-tls"] }
|
||||
hex = { workspace = true }
|
||||
codec = { workspace = true }
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["subxt"]
|
||||
|
||||
Reference in New Issue
Block a user