diff --git a/substrate/frame/contracts/proc-macro/src/lib.rs b/substrate/frame/contracts/proc-macro/src/lib.rs index 43b59debc4..dca29c805c 100644 --- a/substrate/frame/contracts/proc-macro/src/lib.rs +++ b/substrate/frame/contracts/proc-macro/src/lib.rs @@ -24,7 +24,7 @@ extern crate alloc; use alloc::string::ToString; use proc_macro2::TokenStream; use quote::{quote, quote_spanned}; -use syn::{parse_macro_input, spanned::Spanned, Data, DataStruct, DeriveInput, Fields, Ident}; +use syn::{parse_macro_input, Data, DeriveInput, Ident}; /// This derives `Debug` for a struct where each field must be of some numeric type. /// It interprets each field as its represents some weight and formats it as times so that @@ -84,7 +84,9 @@ fn derive_debug( /// This is only used then the `full` feature is activated. #[cfg(feature = "full")] -fn iterate_fields(data: &DataStruct, fmt: impl Fn(&Ident) -> TokenStream) -> TokenStream { +fn iterate_fields(data: &syn::DataStruct, fmt: impl Fn(&Ident) -> TokenStream) -> TokenStream { + use syn::{spanned::Spanned, Fields}; + match &data.fields { Fields::Named(fields) => { let recurse = fields.named.iter().filter_map(|f| { diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index c9d811fa4a..fd8ae8ab76 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -316,7 +316,7 @@ use frame_support::{ Currency, Defensive, DefensiveOption, DefensiveResult, DefensiveSaturating, ExistenceRequirement, Get, }, - CloneNoBound, DefaultNoBound, PartialEqNoBound, RuntimeDebugNoBound, + CloneNoBound, DefaultNoBound, RuntimeDebugNoBound, }; use scale_info::TypeInfo; use sp_core::U256; @@ -398,7 +398,7 @@ enum AccountType { /// A member in a pool. #[derive(Encode, Decode, MaxEncodedLen, TypeInfo, RuntimeDebugNoBound, CloneNoBound)] -#[cfg_attr(feature = "std", derive(PartialEqNoBound, DefaultNoBound))] +#[cfg_attr(feature = "std", derive(frame_support::PartialEqNoBound, DefaultNoBound))] #[codec(mel_bound(T: Config))] #[scale_info(skip_type_params(T))] pub struct PoolMember { diff --git a/substrate/frame/ranked-collective/src/lib.rs b/substrate/frame/ranked-collective/src/lib.rs index 521dfb6aad..61686f1efe 100644 --- a/substrate/frame/ranked-collective/src/lib.rs +++ b/substrate/frame/ranked-collective/src/lib.rs @@ -444,7 +444,7 @@ pub mod pallet { MemberCount::::insert(rank, index.checked_add(1).ok_or(Overflow)?); IdToIndex::::insert(rank, &who, index); IndexToId::::insert(rank, index, &who); - Members::::insert(&who, MemberRecord { rank, ..record }); + Members::::insert(&who, MemberRecord { rank }); Self::deposit_event(Event::RankChanged { who, rank }); Ok(()) diff --git a/substrate/frame/try-runtime/src/lib.rs b/substrate/frame/try-runtime/src/lib.rs index bf08112bfc..e4f01d40c9 100644 --- a/substrate/frame/try-runtime/src/lib.rs +++ b/substrate/frame/try-runtime/src/lib.rs @@ -20,7 +20,6 @@ #![cfg_attr(not(feature = "std"), no_std)] use frame_support::weights::Weight; -use sp_std::prelude::*; sp_api::decl_runtime_apis! { /// Runtime api for testing the execution of a runtime upgrade. diff --git a/substrate/primitives/block-builder/src/lib.rs b/substrate/primitives/block-builder/src/lib.rs index 1b74c27b7a..cf1bfa2560 100644 --- a/substrate/primitives/block-builder/src/lib.rs +++ b/substrate/primitives/block-builder/src/lib.rs @@ -20,10 +20,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use sp_inherents::{CheckInherentsResult, InherentData}; -use sp_runtime::{ - legacy::byte_sized_error::ApplyExtrinsicResult as ApplyExtrinsicResultBeforeV6, - traits::Block as BlockT, ApplyExtrinsicResult, -}; +use sp_runtime::{traits::Block as BlockT, ApplyExtrinsicResult}; sp_api::decl_runtime_apis! { /// The `BlockBuilder` api trait that provides the required functionality for building a block. @@ -36,7 +33,9 @@ sp_api::decl_runtime_apis! { fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResult; #[changed_in(6)] - fn apply_extrinsic(extrinsic: ::Extrinsic) -> ApplyExtrinsicResultBeforeV6; + fn apply_extrinsic( + extrinsic: ::Extrinsic, + ) -> sp_runtime::legacy::byte_sized_error::ApplyExtrinsicResult; /// Finish the current block. #[renamed("finalise_block", 3)] diff --git a/substrate/primitives/io/src/lib.rs b/substrate/primitives/io/src/lib.rs index 89b74dc3c6..edffc37351 100644 --- a/substrate/primitives/io/src/lib.rs +++ b/substrate/primitives/io/src/lib.rs @@ -1522,17 +1522,17 @@ mod tracing_setup { fn new_span(&self, attrs: &Attributes<'_>) -> Id { Id::from_u64(wasm_tracing::enter_span(Crossing(attrs.into()))) } - fn enter(&self, span: &Id) { + fn enter(&self, _: &Id) { // Do nothing, we already entered the span previously } /// Not implemented! We do not support recording values later /// Will panic when used. - fn record(&self, span: &Id, values: &Record<'_>) { + fn record(&self, _: &Id, _: &Record<'_>) { unimplemented! {} // this usage is not supported } /// Not implemented! We do not support recording values later /// Will panic when used. - fn record_follows_from(&self, span: &Id, follows: &Id) { + fn record_follows_from(&self, _: &Id, _: &Id) { unimplemented! {} // this usage is not supported } fn event(&self, event: &Event<'_>) { diff --git a/substrate/primitives/state-machine/src/trie_backend_essence.rs b/substrate/primitives/state-machine/src/trie_backend_essence.rs index c55a6b7e80..7d910cc960 100644 --- a/substrate/primitives/state-machine/src/trie_backend_essence.rs +++ b/substrate/primitives/state-machine/src/trie_backend_essence.rs @@ -29,8 +29,7 @@ use sp_trie::{ child_delta_trie_root, delta_trie_root, empty_child_trie_root, read_child_trie_value, read_trie_value, trie_types::{TrieDB, TrieError}, - DBValue, KeySpacedDB, LayoutV1 as Layout, PrefixedMemoryDB, Trie, TrieDBIterator, - TrieDBKeyIterator, + DBValue, KeySpacedDB, LayoutV1 as Layout, Trie, TrieDBIterator, TrieDBKeyIterator, }; #[cfg(feature = "std")] use std::collections::HashMap; @@ -619,7 +618,7 @@ pub trait TrieBackendStorage: Send + Sync { // This implementation is used by normal storage trie clients. #[cfg(feature = "std")] impl TrieBackendStorage for Arc> { - type Overlay = PrefixedMemoryDB; + type Overlay = sp_trie::PrefixedMemoryDB; fn get(&self, key: &H::Out, prefix: Prefix) -> Result> { Storage::::get(std::ops::Deref::deref(self), key, prefix) diff --git a/substrate/primitives/version/src/lib.rs b/substrate/primitives/version/src/lib.rs index 46f8af9e22..0bd62f0bac 100644 --- a/substrate/primitives/version/src/lib.rs +++ b/substrate/primitives/version/src/lib.rs @@ -273,6 +273,7 @@ impl fmt::Display for RuntimeVersion { } } +#[cfg(feature = "std")] fn has_api_with bool>(apis: &ApisVec, id: &ApiId, predicate: P) -> bool { apis.iter().any(|(s, v)| s == id && predicate(*v)) } diff --git a/substrate/scripts/ci/gitlab/pipeline/test.yml b/substrate/scripts/ci/gitlab/pipeline/test.yml index 419e9f0c7e..5d7572395d 100644 --- a/substrate/scripts/ci/gitlab/pipeline/test.yml +++ b/substrate/scripts/ci/gitlab/pipeline/test.yml @@ -205,6 +205,7 @@ test-linux-stable: RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" RUST_BACKTRACE: 1 WASM_BUILD_NO_COLOR: 1 + WASM_BUILD_RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" # Ensure we run the UI tests. RUN_UI_TESTS: 1 script: @@ -247,6 +248,7 @@ test-linux-stable-int: RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" RUST_BACKTRACE: 1 WASM_BUILD_NO_COLOR: 1 + WASM_BUILD_RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" # Ensure we run the UI tests. RUN_UI_TESTS: 1 script: