Skip to content

Commit 4f9e0fc

Browse files
committed
Make macro comma optional
1 parent 140d51b commit 4f9e0fc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

macros/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#![feature(macro_at_most_once_rep)]
2+
13
#[macro_export]
24
macro_rules! hashmap {
35
() => {
46
HashMap::new()
57
};
68

7-
( $( $key:expr => $value:expr $(,)* ), *) => {
9+
( $( $key:expr => $value:expr $(,)? ), *) => {
810
{
911
let mut hm = HashMap::new();
1012
$(

macros/tests/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![feature(macro_at_most_once_rep)]
2+
13
#[macro_use]
24
extern crate macros;
35

0 commit comments

Comments
 (0)