refactor map macro for more general use#3850
Conversation
Signed-off-by: yjhmelody <465402634@qq.com>
|
It looks like @yjhmelody signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
core/primitives/src/lib.rs
Outdated
| #[macro_export] | ||
| macro_rules! map { | ||
| ($( $name:expr => $value:expr ),*) => ( | ||
| ($( $name:expr => $value:expr ),* ,) => ( |
There was a problem hiding this comment.
can use $(,)? to handle optional trailing comma
There was a problem hiding this comment.
Oh, I forget the syntax.
gui1117
left a comment
There was a problem hiding this comment.
substrate is using tabulation for indent
|
Can you please explain the reasoning behind your changes? I don't see how that generalizes the macro. |
That just allow to declare with a trailing comma |
The trailing comma was added after there was a suggestion in this pr. 🤷♀️ |
no before the fix trailing comma was made mandatory |
|
I checked now the first commit and understand it. I just saw in the diff the the optional trailing comma was added. |
|
@yjhmelody status? |
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
Signed-off-by: yjhmelody 465402634@qq.com