diff --git a/frame/support/procedural/src/pallet/expand/hooks.rs b/frame/support/procedural/src/pallet/expand/hooks.rs index c2b70c5632f94..c41a65b57b57a 100644 --- a/frame/support/procedural/src/pallet/expand/hooks.rs +++ b/frame/support/procedural/src/pallet/expand/hooks.rs @@ -191,16 +191,19 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream { } } - impl<#type_impl_gen> - #frame_support::traits::IntegrityTest + // Integrity tests are only required for when `std` is enabled. + #frame_support::std_enabled! { + impl<#type_impl_gen> + #frame_support::traits::IntegrityTest for #pallet_ident<#type_use_gen> #where_clause - { - fn integrity_test() { - < - Self as #frame_support::traits::Hooks< + { + fn integrity_test() { + < + Self as #frame_support::traits::Hooks< ::BlockNumber - > - >::integrity_test() + > + >::integrity_test() + } } } diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index efecbb75f9c62..902893972f0b1 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -2744,3 +2744,6 @@ pub mod pallet_macros { type_value, unbounded, validate_unsigned, weight, whitelist_storage, }; } + +// Generate a macro that will enable/disable code based on `std` feature being active. +sp_core::generate_feature_enabled_macro!(std_enabled, feature = "std", $); diff --git a/frame/system/benches/bench.rs b/frame/system/benches/bench.rs index a623a17dc49b2..f2acc319d3f5d 100644 --- a/frame/system/benches/bench.rs +++ b/frame/system/benches/bench.rs @@ -16,10 +16,7 @@ // limitations under the License. use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use frame_support::{ - traits::{ConstU32, ConstU64}, - weights::Weight, -}; +use frame_support::traits::{ConstU32, ConstU64}; use sp_core::H256; use sp_runtime::{ testing::Header,