Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

IntegrityTest implementation should be feature gated #13094

Merged
merged 3 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions frame/support/procedural/src/pallet/expand/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<
<T as #frame_system::Config>::BlockNumber
>
>::integrity_test()
>
>::integrity_test()
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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", $);
5 changes: 1 addition & 4 deletions frame/system/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down