From f3e9c0af04cd0cc4974fd8319a8b3e6c8334baae Mon Sep 17 00:00:00 2001 From: Zeke Mostov <z.mostov@gmail.com> Date: Wed, 2 Mar 2022 00:40:08 -0800 Subject: [PATCH] Allow trailing commas for `bounded_vec!` (#10959) --- substrate/frame/staking/src/tests.rs | 6 +++--- substrate/frame/support/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/substrate/frame/staking/src/tests.rs b/substrate/frame/staking/src/tests.rs index 0fc6cd27a26..0f979f1d592 100644 --- a/substrate/frame/staking/src/tests.rs +++ b/substrate/frame/staking/src/tests.rs @@ -1480,7 +1480,7 @@ fn rebond_is_fifo() { active: 300, unlocking: bounded_vec![ UnlockChunk { value: 400, era: 2 + 3 }, - UnlockChunk { value: 300, era: 3 + 3 } + UnlockChunk { value: 300, era: 3 + 3 }, ], claimed_rewards: vec![], }) @@ -1499,7 +1499,7 @@ fn rebond_is_fifo() { unlocking: bounded_vec![ UnlockChunk { value: 400, era: 2 + 3 }, UnlockChunk { value: 300, era: 3 + 3 }, - UnlockChunk { value: 200, era: 4 + 3 } + UnlockChunk { value: 200, era: 4 + 3 }, ], claimed_rewards: vec![], }) @@ -1515,7 +1515,7 @@ fn rebond_is_fifo() { active: 500, unlocking: bounded_vec![ UnlockChunk { value: 400, era: 2 + 3 }, - UnlockChunk { value: 100, era: 3 + 3 } + UnlockChunk { value: 100, era: 3 + 3 }, ], claimed_rewards: vec![], }) diff --git a/substrate/frame/support/src/lib.rs b/substrate/frame/support/src/lib.rs index ef60729f6d8..3988b5e9af2 100644 --- a/substrate/frame/support/src/lib.rs +++ b/substrate/frame/support/src/lib.rs @@ -123,7 +123,7 @@ impl TypeId for PalletId { #[macro_export] #[cfg(feature = "std")] macro_rules! bounded_vec { - ($ ($values:expr),* ) => { + ($ ($values:expr),* $(,)?) => { { use $crate::sp_std::convert::TryInto as _; $crate::sp_std::vec![$($values),*].try_into().unwrap() -- GitLab