Skip to content

Commit

Permalink
refactor: allow non-trailing commas in map macro
Browse files Browse the repository at this point in the history
  • Loading branch information
benpueschel committed Aug 3, 2024
1 parent 435a202 commit ab6dceb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/config/colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ pub struct ColorValue {
}

macro_rules! map {
($( $key: expr => $value:expr ),*) => {{
() => {
HashMap::new()
};
($($key:expr => $value:expr),+ $(,)?) => {{
let mut map = HashMap::new();
$( map.insert($key, $value); )*
map
Expand Down

0 comments on commit ab6dceb

Please sign in to comment.