Remove default expansion from construct_runtime! (#4937)

This removes the following syntactic sugar from `construct_runtime!`:

- Expansion of `default` to the default set of module parts
- Expansion of `System: system` to the default set of module parts

The macro now requires the user to provide all the module parts of a pallet.
This commit is contained in:
Bastian Köcher
2020-02-15 14:40:29 +01:00
committed by GitHub
parent 4053201046
commit 625e963aa2
18 changed files with 158 additions and 221 deletions
@@ -1,14 +0,0 @@
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
Balance: balances::{default, Error},
}
}
fn main() {}
@@ -1,5 +0,0 @@
error: Only the following modules are allowed: `Module`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
--> $DIR/default_module_invalid_arg.rs:10:32
|
10 | Balance: balances::{default, Error},
| ^^^^^
@@ -6,7 +6,7 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
System: system::{Module},
Balance: balances::{Config, Call, Config<T>, Origin<T>},
}
}
@@ -1,14 +0,0 @@
use frame_support::construct_runtime;
construct_runtime! {
pub enum Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
Balance: balances::{default, Config},
}
}
fn main() {}
@@ -1,5 +0,0 @@
error: `Config` is already included in `default`. Either remove `default` or remove `Config`
--> $DIR/double_module_parts_default.rs:10:32
|
10 | Balance: balances::{default, Config},
| ^^^^^^
@@ -6,7 +6,7 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
System: system::{Module},
Balance: balances::<Instance1>::{Call<T>, Origin<T>},
}
}
@@ -1,4 +1,4 @@
error: expected `default` or identifier
error: expected one of: `Module`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
--> $DIR/invalid_module_details_keyword.rs:9:20
|
9 | system: System::{enum},
@@ -6,7 +6,7 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
System: system::{Module},
Balance: balances::{Error},
}
}
@@ -1,4 +1,4 @@
error: Only the following modules are allowed: `Module`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
error: expected one of: `Module`, `Call`, `Storage`, `Event`, `Config`, `Origin`, `Inherent`, `ValidateUnsigned`
--> $DIR/invalid_module_entry.rs:10:23
|
10 | Balance: balances::{Error},
@@ -1,4 +1,4 @@
error: expected `,`
error: expected `::`
--> $DIR/invalid_token_after_module.rs:9:18
|
9 | system: System ?
@@ -6,7 +6,7 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
System: system::{Module},
Balance: balances::<Instance1>::{Event},
}
}
@@ -6,7 +6,7 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
System: system::{Module},
Balance: balances::<Instance1>::{Origin},
}
}
@@ -6,7 +6,7 @@ construct_runtime! {
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system,
System: system::{Module},
Balance: balances::<Instance1>::{Call(toto), Origin<I>},
}
}