Make hooks and call attributes optional in pallet macro (#8853)

* Make #[pallet::hooks] optional

* Make #[pallet::call] optional

* Remove unused imports

* Update UI test expectations

* Update UI test expectations

* Remove unnecessary HooksDef::empty method

* Remove unnecessary CallDef::empty method

* Clarify what would happen when no call or hooks are specified in a pallet
This commit is contained in:
Keith Yeung
2021-05-20 12:31:56 -07:00
committed by GitHub
parent 029b8a1d07
commit e5954cf863
9 changed files with 90 additions and 57 deletions
@@ -1,3 +1,9 @@
error: Invalid generic declaration, trait is defined with instance but generic use none
--> $DIR/inconsistent_instance_1.rs:10:20
|
10 | pub struct Pallet<T>(core::marker::PhantomData<T>);
| ^
error: Invalid generic declaration, trait is defined with instance but generic use none
--> $DIR/inconsistent_instance_1.rs:16:7
|
@@ -10,12 +16,6 @@ error: Invalid generic declaration, trait is defined with instance but generic u
16 | impl<T: Config> Pallet<T> {}
| ^^^^^^
error: Invalid generic declaration, trait is defined with instance but generic use none
--> $DIR/inconsistent_instance_1.rs:10:20
|
10 | pub struct Pallet<T>(core::marker::PhantomData<T>);
| ^
error: Invalid generic declaration, trait is defined with instance but generic use none
--> $DIR/inconsistent_instance_1.rs:13:47
|
@@ -1,3 +1,9 @@
error: Invalid generic declaration, trait is defined without instance but generic use some
--> $DIR/inconsistent_instance_2.rs:10:20
|
10 | pub struct Pallet<T, I = ()>(core::marker::PhantomData<(T, I)>);
| ^
error: Invalid generic declaration, trait is defined without instance but generic use some
--> $DIR/inconsistent_instance_2.rs:16:7
|
@@ -10,12 +16,6 @@ error: Invalid generic declaration, trait is defined without instance but generi
16 | impl<T: Config<I>, I: 'static> Pallet<T, I> {}
| ^^^^^^
error: Invalid generic declaration, trait is defined without instance but generic use some
--> $DIR/inconsistent_instance_2.rs:10:20
|
10 | pub struct Pallet<T, I = ()>(core::marker::PhantomData<(T, I)>);
| ^
error: Invalid generic declaration, trait is defined without instance but generic use some
--> $DIR/inconsistent_instance_2.rs:13:62
|