Skip to content

Commit

Permalink
Pub enum runtime to pub struct runtime (paritytech#13250)
Browse files Browse the repository at this point in the history
* pub enum Runtime -> pub struct Runtime

* changing some more

* fmt

* updating *.stderr files

* re-run trybuild after rust update

* keep a test file for `pub enum Runtime`

* Delete construct_runtime_2.rs

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
  • Loading branch information
2 people authored and ukint-vs committed Apr 10, 2023
1 parent be303ce commit a46dc41
Show file tree
Hide file tree
Showing 73 changed files with 99 additions and 96 deletions.
2 changes: 1 addition & 1 deletion bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ impl frame_benchmarking_pallet_pov::Config for Runtime {
}

construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = node_primitives::Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
2 changes: 1 addition & 1 deletion frame/bags-list/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl bags_list::Config for Runtime {
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;
frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
Expand Down
2 changes: 1 addition & 1 deletion frame/election-provider-multi-phase/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub type UncheckedExtrinsic =
sp_runtime::generic::UncheckedExtrinsic<AccountId, RuntimeCall, (), ()>;

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
2 changes: 1 addition & 1 deletion frame/election-provider-support/src/onchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ mod tests {
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
2 changes: 1 addition & 1 deletion frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ mod tests {
}

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = TestBlock,
NodeBlock = TestBlock,
UncheckedExtrinsic = TestUncheckedExtrinsic
Expand Down
5 changes: 3 additions & 2 deletions frame/fast-unstake/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ impl fast_unstake::Config for Runtime {
type Block = frame_system::mocking::MockBlock<Runtime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime
where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system,
Timestamp: pallet_timestamp,
Expand Down
2 changes: 1 addition & 1 deletion frame/im-online/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>
type Block = frame_system::mocking::MockBlock<Runtime>;

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
Expand Down
2 changes: 1 addition & 1 deletion frame/nomination-pools/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl crate::Config for Runtime {}
type Block = frame_system::mocking::MockBlock<Runtime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
2 changes: 1 addition & 1 deletion frame/nomination-pools/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl pools::Config for Runtime {
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;
type Block = frame_system::mocking::MockBlock<Runtime>;
frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
Expand Down
2 changes: 1 addition & 1 deletion frame/nomination-pools/test-staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ type Block = frame_system::mocking::MockBlock<Runtime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>;

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
2 changes: 1 addition & 1 deletion frame/offences/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Runtime>
type Block = frame_system::mocking::MockBlock<Runtime>;

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
Expand Down
5 changes: 3 additions & 2 deletions frame/support/test/compile_pass/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Signature, ()>;

construct_runtime!(
pub enum Runtime where
pub struct Runtime
where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system,
}
Expand Down
4 changes: 2 additions & 2 deletions frame/support/test/tests/construct_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

//! General tests for construct_runtime macro, test for:
//! * error declareed with decl_error works
//! * error declared with decl_error works
//! * integrity test is generated
#![recursion_limit = "128"]
Expand Down Expand Up @@ -254,7 +254,7 @@ impl system::Config for Runtime {
}

frame_support::construct_runtime!(
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
Block = Block1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Sign
impl pallet::Config for Runtime {}

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
UncheckedExtrinsic = UncheckedExtrinsic,
Block = Block,
NodeBlock = Block,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
UncheckedExtrinsic = UncheckedExtrinsic,
Block = Block,
NodeBlock = Block,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
UncheckedExtrinsic = UncheckedExtrinsic,
Block = Block,
NodeBlock = Block,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
UncheckedExtrinsic = UncheckedExtrinsic,
Block = Block,
NodeBlock = Block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, RuntimeCall, Sign
impl pallet::Config for Runtime {}

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
TypeX = Block,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime {}
pub struct Runtime {}
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: expected `where`
--> tests/construct_runtime_ui/missing_where_block.rs:4:19
--> tests/construct_runtime_ui/missing_where_block.rs:4:21
|
4 | pub enum Runtime {}
| ^
4 | pub struct Runtime {}
| ^
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
{}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
UncheckedExtrinsic = UncheckedExtrinsic,
Block = Block,
NodeBlock = Block,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use frame_support::construct_runtime;

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
UncheckedExtrinsic = UncheckedExtrinsic
Block = Block,
NodeBlock = Block,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl frame_system::Config for Runtime {
}

construct_runtime! {
pub enum Runtime where
pub struct Runtime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
Expand Down
Loading

0 comments on commit a46dc41

Please sign in to comment.