diff --git a/frame/aura/src/lib.rs b/frame/aura/src/lib.rs index db639a4499beb..77d6a6a643b49 100644 --- a/frame/aura/src/lib.rs +++ b/frame/aura/src/lib.rs @@ -66,7 +66,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(sp_std::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet { diff --git a/frame/support/procedural/src/pallet/parse/pallet_struct.rs b/frame/support/procedural/src/pallet/parse/pallet_struct.rs index 1c979741d9803..f7fcb69c0e650 100644 --- a/frame/support/procedural/src/pallet/parse/pallet_struct.rs +++ b/frame/support/procedural/src/pallet/parse/pallet_struct.rs @@ -97,6 +97,11 @@ impl PalletStructDef { return Err(syn::Error::new(item.generics.where_clause.span(), msg)); } + if item.fields != syn::FieldsUnnamed::into(syn::parse_quote!((_))) { + let msg = "Invalid pallet::pallet, expected 1 unnamed field: `(_)`"; + return Err(syn::Error::new(item.fields.span(), msg)); + } + let mut instances = vec![]; instances.push(helper::check_type_def_gen_no_bounds(&item.generics, item.ident.span())?); diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 8e4a635c2a481..ac4fc2c33e537 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -1786,7 +1786,7 @@ pub mod pallet_prelude { /// /// #[pallet::pallet] /// #[pallet::generate_store(pub(super) trait Store)] -/// pub struct Pallet(PhantomData<(T, I)>); +/// pub struct Pallet(_); /// /// #[pallet::hooks] /// impl, I: 'static> Hooks> for Pallet { @@ -1922,7 +1922,7 @@ pub mod pallet_prelude { /// // NOTE: if the visibility of trait store is private but you want to make it available /// // in super, then use `pub(super)` or `pub(crate)` to make it available in crate. /// pub struct Pallet(_); -/// // pub struct Pallet(PhantomData); // for instantiable pallet +/// // pub struct Pallet(_); // for instantiable pallet /// } /// ``` /// 5. **migrate Config**: move trait into the module with diff --git a/frame/support/test/tests/pallet_compatibility_instance.rs b/frame/support/test/tests/pallet_compatibility_instance.rs index d7de03ea46cfd..d9f00704dcd91 100644 --- a/frame/support/test/tests/pallet_compatibility_instance.rs +++ b/frame/support/test/tests/pallet_compatibility_instance.rs @@ -96,7 +96,7 @@ pub mod pallet { } #[pallet::pallet] - pub struct Pallet(PhantomData<(T, I)>); + pub struct Pallet(_); #[pallet::hooks] impl, I: 'static> Hooks for Pallet { diff --git a/frame/support/test/tests/pallet_instance.rs b/frame/support/test/tests/pallet_instance.rs index 62654d53e19d7..1751f41595381 100644 --- a/frame/support/test/tests/pallet_instance.rs +++ b/frame/support/test/tests/pallet_instance.rs @@ -44,7 +44,7 @@ pub mod pallet { #[pallet::pallet] #[pallet::generate_store(pub(crate) trait Store)] - pub struct Pallet(PhantomData<(T, I)>); + pub struct Pallet(_); #[pallet::hooks] impl, I: 'static> Hooks> for Pallet { @@ -199,7 +199,7 @@ pub mod pallet2 { #[pallet::pallet] #[pallet::generate_store(pub(crate) trait Store)] - pub struct Pallet(PhantomData<(T, I)>); + pub struct Pallet(_); #[pallet::hooks] impl, I: 'static> Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs index 69d35344d5761..96371bbbb2482 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs @@ -9,7 +9,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs index 581c72a4240a0..c631d4d4515ac 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs @@ -9,7 +9,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs index 97f362551037d..d228630b759e0 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs @@ -8,7 +8,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_invalid_const.rs b/frame/support/test/tests/pallet_ui/call_invalid_const.rs index 1a28bc32e65c6..32b01b808ceba 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_const.rs +++ b/frame/support/test/tests/pallet_ui/call_invalid_const.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs b/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs index edf953b5976c0..bae99de29d5a7 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs +++ b/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_missing_weight.rs b/frame/support/test/tests/pallet_ui/call_missing_weight.rs index 2ce607c53ac3a..f4c38c8250582 100644 --- a/frame/support/test/tests/pallet_ui/call_missing_weight.rs +++ b/frame/support/test/tests/pallet_ui/call_missing_weight.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_no_origin.rs b/frame/support/test/tests/pallet_ui/call_no_origin.rs index 83d10b6b08b4f..8e00fac3f9a60 100644 --- a/frame/support/test/tests/pallet_ui/call_no_origin.rs +++ b/frame/support/test/tests/pallet_ui/call_no_origin.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/call_no_return.rs b/frame/support/test/tests/pallet_ui/call_no_return.rs index a18c30f6d6d90..178ab2267a208 100644 --- a/frame/support/test/tests/pallet_ui/call_no_return.rs +++ b/frame/support/test/tests/pallet_ui/call_no_return.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/duplicate_call_attr.rs b/frame/support/test/tests/pallet_ui/duplicate_call_attr.rs index b8a32a0bd9f69..7bab1f95657b3 100644 --- a/frame/support/test/tests/pallet_ui/duplicate_call_attr.rs +++ b/frame/support/test/tests/pallet_ui/duplicate_call_attr.rs @@ -9,7 +9,7 @@ mod pallet { #[pallet::pallet] #[pallet::generate_store(trait Store)] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/duplicate_store_attr.rs b/frame/support/test/tests/pallet_ui/duplicate_store_attr.rs index d675ddefe985b..c202b2671a69f 100644 --- a/frame/support/test/tests/pallet_ui/duplicate_store_attr.rs +++ b/frame/support/test/tests/pallet_ui/duplicate_store_attr.rs @@ -10,7 +10,7 @@ mod pallet { #[pallet::pallet] #[pallet::generate_store(trait Store)] #[pallet::generate_store(trait Store)] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/error_no_fieldless.rs b/frame/support/test/tests/pallet_ui/error_no_fieldless.rs index c9d444d6f90dd..4d3b975f558d2 100644 --- a/frame/support/test/tests/pallet_ui/error_no_fieldless.rs +++ b/frame/support/test/tests/pallet_ui/error_no_fieldless.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/error_where_clause.rs b/frame/support/test/tests/pallet_ui/error_where_clause.rs index 29d7435bc4bc8..d1464f496e27e 100644 --- a/frame/support/test/tests/pallet_ui/error_where_clause.rs +++ b/frame/support/test/tests/pallet_ui/error_where_clause.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/error_wrong_item.rs b/frame/support/test/tests/pallet_ui/error_wrong_item.rs index 50e66dc8c0dce..9e453d8cf1d92 100644 --- a/frame/support/test/tests/pallet_ui/error_wrong_item.rs +++ b/frame/support/test/tests/pallet_ui/error_wrong_item.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/error_wrong_item_name.rs b/frame/support/test/tests/pallet_ui/error_wrong_item_name.rs index 14107fafb06ea..813702daf0c12 100644 --- a/frame/support/test/tests/pallet_ui/error_wrong_item_name.rs +++ b/frame/support/test/tests/pallet_ui/error_wrong_item_name.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/event_field_not_member.rs b/frame/support/test/tests/pallet_ui/event_field_not_member.rs index 0ecde4c130878..40e03f4622f52 100644 --- a/frame/support/test/tests/pallet_ui/event_field_not_member.rs +++ b/frame/support/test/tests/pallet_ui/event_field_not_member.rs @@ -10,7 +10,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/event_not_in_trait.rs b/frame/support/test/tests/pallet_ui/event_not_in_trait.rs index 94151ba4c3d9d..f080f3a0713ea 100644 --- a/frame/support/test/tests/pallet_ui/event_not_in_trait.rs +++ b/frame/support/test/tests/pallet_ui/event_not_in_trait.rs @@ -9,7 +9,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs b/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs index fa3bf04d3530d..4bd5bf0f4c843 100644 --- a/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs +++ b/frame/support/test/tests/pallet_ui/event_type_invalid_bound.rs @@ -10,7 +10,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs b/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs index 564a539b89f57..f604a3559e890 100644 --- a/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs +++ b/frame/support/test/tests/pallet_ui/event_type_invalid_bound_2.rs @@ -10,7 +10,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/event_wrong_item.rs b/frame/support/test/tests/pallet_ui/event_wrong_item.rs index d6690557c39d8..84e0cf4d54815 100644 --- a/frame/support/test/tests/pallet_ui/event_wrong_item.rs +++ b/frame/support/test/tests/pallet_ui/event_wrong_item.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/event_wrong_item_name.rs b/frame/support/test/tests/pallet_ui/event_wrong_item_name.rs index d828965c5173c..3b25e66d7a492 100644 --- a/frame/support/test/tests/pallet_ui/event_wrong_item_name.rs +++ b/frame/support/test/tests/pallet_ui/event_wrong_item_name.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/genesis_default_not_satisfied.rs b/frame/support/test/tests/pallet_ui/genesis_default_not_satisfied.rs index da5e8d0c4da52..72bfeef370cda 100644 --- a/frame/support/test/tests/pallet_ui/genesis_default_not_satisfied.rs +++ b/frame/support/test/tests/pallet_ui/genesis_default_not_satisfied.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/genesis_inconsistent_build_config.rs b/frame/support/test/tests/pallet_ui/genesis_inconsistent_build_config.rs index 9ae851005acb3..2b28c7c3b7a70 100644 --- a/frame/support/test/tests/pallet_ui/genesis_inconsistent_build_config.rs +++ b/frame/support/test/tests/pallet_ui/genesis_inconsistent_build_config.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/genesis_invalid_generic.rs b/frame/support/test/tests/pallet_ui/genesis_invalid_generic.rs index f1eae16f49600..8bb55615e9d99 100644 --- a/frame/support/test/tests/pallet_ui/genesis_invalid_generic.rs +++ b/frame/support/test/tests/pallet_ui/genesis_invalid_generic.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/genesis_wrong_name.rs b/frame/support/test/tests/pallet_ui/genesis_wrong_name.rs index 5e8b297ba4ccf..b344b1b0f9f88 100644 --- a/frame/support/test/tests/pallet_ui/genesis_wrong_name.rs +++ b/frame/support/test/tests/pallet_ui/genesis_wrong_name.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/inconsistent_instance_1.rs b/frame/support/test/tests/pallet_ui/inconsistent_instance_1.rs index 00b57a01235c3..ecf55d9a97e49 100644 --- a/frame/support/test/tests/pallet_ui/inconsistent_instance_1.rs +++ b/frame/support/test/tests/pallet_ui/inconsistent_instance_1.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/inconsistent_instance_1.stderr b/frame/support/test/tests/pallet_ui/inconsistent_instance_1.stderr index 352c21013cab0..3b1c056a45579 100644 --- a/frame/support/test/tests/pallet_ui/inconsistent_instance_1.stderr +++ b/frame/support/test/tests/pallet_ui/inconsistent_instance_1.stderr @@ -13,7 +13,7 @@ error: Invalid generic declaration, trait is defined with instance but generic u error: Invalid generic declaration, trait is defined with instance but generic use none --> $DIR/inconsistent_instance_1.rs:10:20 | -10 | pub struct Pallet(core::marker::PhantomData); +10 | pub struct Pallet(_); | ^ error: Invalid generic declaration, trait is defined with instance but generic use none diff --git a/frame/support/test/tests/pallet_ui/inconsistent_instance_2.rs b/frame/support/test/tests/pallet_ui/inconsistent_instance_2.rs index e7b51cb5ebef5..3601194d9d2e9 100644 --- a/frame/support/test/tests/pallet_ui/inconsistent_instance_2.rs +++ b/frame/support/test/tests/pallet_ui/inconsistent_instance_2.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData<(T, I)>); + pub struct Pallet(_); #[pallet::hooks] impl, I: 'static> Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/inconsistent_instance_2.stderr b/frame/support/test/tests/pallet_ui/inconsistent_instance_2.stderr index 9f5d3c740cbd1..c876aada14e3c 100644 --- a/frame/support/test/tests/pallet_ui/inconsistent_instance_2.stderr +++ b/frame/support/test/tests/pallet_ui/inconsistent_instance_2.stderr @@ -13,7 +13,7 @@ error: Invalid generic declaration, trait is defined without instance but generi error: Invalid generic declaration, trait is defined without instance but generic use some --> $DIR/inconsistent_instance_2.rs:10:20 | -10 | pub struct Pallet(core::marker::PhantomData<(T, I)>); +10 | pub struct Pallet(_); | ^ error: Invalid generic declaration, trait is defined without instance but generic use some diff --git a/frame/support/test/tests/pallet_ui/inherent_check_inner_span.rs b/frame/support/test/tests/pallet_ui/inherent_check_inner_span.rs index 9704a7e1a442e..fa79455fe8be5 100644 --- a/frame/support/test/tests/pallet_ui/inherent_check_inner_span.rs +++ b/frame/support/test/tests/pallet_ui/inherent_check_inner_span.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/inherent_invalid_item.rs b/frame/support/test/tests/pallet_ui/inherent_invalid_item.rs index 97eda44721307..adb7ec0d163dc 100644 --- a/frame/support/test/tests/pallet_ui/inherent_invalid_item.rs +++ b/frame/support/test/tests/pallet_ui/inherent_invalid_item.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field.rs b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field.rs new file mode 100644 index 0000000000000..cd865d9ed7ecd --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field.rs @@ -0,0 +1,14 @@ +#[frame_support::pallet] +mod pallet { + use frame_support::pallet_prelude::Hooks; + use frame_system::pallet_prelude::BlockNumberFor; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + pub struct Pallet(); +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field.stderr b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field.stderr new file mode 100644 index 0000000000000..336dc387da826 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field.stderr @@ -0,0 +1,5 @@ +error: Invalid pallet::pallet, expected 1 unnamed field: `(_)` + --> $DIR/pallet_struct_wrong_field.rs:10:22 + | +10 | pub struct Pallet(); + | ^^ diff --git a/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field2.rs b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field2.rs new file mode 100644 index 0000000000000..f648233423d38 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field2.rs @@ -0,0 +1,16 @@ +#[frame_support::pallet] +mod pallet { + use frame_support::pallet_prelude::Hooks; + use frame_system::pallet_prelude::BlockNumberFor; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + pub struct Pallet { + some: T, + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field2.stderr b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field2.stderr new file mode 100644 index 0000000000000..473df45d1c2d2 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/pallet_struct_wrong_field2.stderr @@ -0,0 +1,8 @@ +error: Invalid pallet::pallet, expected 1 unnamed field: `(_)` + --> $DIR/pallet_struct_wrong_field2.rs:10:23 + | +10 | pub struct Pallet { + | __________________________^ +11 | | some: T, +12 | | } + | |_____^ diff --git a/frame/support/test/tests/pallet_ui/storage_incomplete_item.rs b/frame/support/test/tests/pallet_ui/storage_incomplete_item.rs index e451df8c78a02..847ff2063ee6c 100644 --- a/frame/support/test/tests/pallet_ui/storage_incomplete_item.rs +++ b/frame/support/test/tests/pallet_ui/storage_incomplete_item.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/storage_invalid_first_generic.rs b/frame/support/test/tests/pallet_ui/storage_invalid_first_generic.rs index c8df93c9b323d..fac5876868994 100644 --- a/frame/support/test/tests/pallet_ui/storage_invalid_first_generic.rs +++ b/frame/support/test/tests/pallet_ui/storage_invalid_first_generic.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/storage_not_storage_type.rs b/frame/support/test/tests/pallet_ui/storage_not_storage_type.rs index 03eee6fc8ec7d..0a2f02e1f3c3c 100644 --- a/frame/support/test/tests/pallet_ui/storage_not_storage_type.rs +++ b/frame/support/test/tests/pallet_ui/storage_not_storage_type.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/storage_value_no_generic.rs b/frame/support/test/tests/pallet_ui/storage_value_no_generic.rs index e62bdafaa2643..d20482c41c623 100644 --- a/frame/support/test/tests/pallet_ui/storage_value_no_generic.rs +++ b/frame/support/test/tests/pallet_ui/storage_value_no_generic.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/storage_wrong_item.rs b/frame/support/test/tests/pallet_ui/storage_wrong_item.rs index 56c4b86f2b35a..79062856b5ffb 100644 --- a/frame/support/test/tests/pallet_ui/storage_wrong_item.rs +++ b/frame/support/test/tests/pallet_ui/storage_wrong_item.rs @@ -7,7 +7,7 @@ mod pallet { pub trait Config: frame_system::Config {} #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/store_trait_leak_private.rs b/frame/support/test/tests/pallet_ui/store_trait_leak_private.rs index 3ebd1cb9fa608..01967c20c9392 100644 --- a/frame/support/test/tests/pallet_ui/store_trait_leak_private.rs +++ b/frame/support/test/tests/pallet_ui/store_trait_leak_private.rs @@ -9,7 +9,7 @@ mod pallet { #[pallet::pallet] #[pallet::generate_store(pub trait Store)] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/trait_constant_invalid_bound.rs b/frame/support/test/tests/pallet_ui/trait_constant_invalid_bound.rs index ce599d5a31e71..4e3c75a7efea9 100644 --- a/frame/support/test/tests/pallet_ui/trait_constant_invalid_bound.rs +++ b/frame/support/test/tests/pallet_ui/trait_constant_invalid_bound.rs @@ -10,7 +10,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/trait_invalid_item.rs b/frame/support/test/tests/pallet_ui/trait_invalid_item.rs index 8537659dcd037..66333566b80f4 100644 --- a/frame/support/test/tests/pallet_ui/trait_invalid_item.rs +++ b/frame/support/test/tests/pallet_ui/trait_invalid_item.rs @@ -10,7 +10,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_ui/trait_no_supertrait.rs b/frame/support/test/tests/pallet_ui/trait_no_supertrait.rs index 0fc987f7bbdd7..4f72ab98ec9fa 100644 --- a/frame/support/test/tests/pallet_ui/trait_no_supertrait.rs +++ b/frame/support/test/tests/pallet_ui/trait_no_supertrait.rs @@ -8,7 +8,7 @@ mod pallet { } #[pallet::pallet] - pub struct Pallet(core::marker::PhantomData); + pub struct Pallet(_); #[pallet::hooks] impl Hooks> for Pallet {} diff --git a/frame/support/test/tests/pallet_version.rs b/frame/support/test/tests/pallet_version.rs index 4cc93d395db2a..bb54daa7447fc 100644 --- a/frame/support/test/tests/pallet_version.rs +++ b/frame/support/test/tests/pallet_version.rs @@ -110,7 +110,7 @@ mod pallet4 { } #[pallet::pallet] - pub struct Pallet(PhantomData<(T, I)>); + pub struct Pallet(_); #[pallet::hooks] impl, I: 'static> Hooks> for Pallet {