Fix all warnings when building for wasm (#11569)

* Fix all warnings when building for wasm

Besides that it also enables warnings as errors for wasm builds in the CI.

* FMT

* Make clippy happy
This commit is contained in:
Bastian Köcher
2022-06-01 15:03:21 +02:00
committed by GitHub
parent a4fdcb9a06
commit bb6bbab687
9 changed files with 19 additions and 17 deletions
@@ -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| {
+2 -2
View File
@@ -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<T: Config> {
+1 -1
View File
@@ -444,7 +444,7 @@ pub mod pallet {
MemberCount::<T, I>::insert(rank, index.checked_add(1).ok_or(Overflow)?);
IdToIndex::<T, I>::insert(rank, &who, index);
IndexToId::<T, I>::insert(rank, index, &who);
Members::<T, I>::insert(&who, MemberRecord { rank, ..record });
Members::<T, I>::insert(&who, MemberRecord { rank });
Self::deposit_event(Event::RankChanged { who, rank });
Ok(())
-1
View File
@@ -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.