From 827e572f0e0a7eff6c81eb02b4a70299f4cb0ba3 Mon Sep 17 00:00:00 2001 From: lzutao Date: Sun, 7 Jul 2019 00:55:27 +0700 Subject: [PATCH 1/2] Fix syntax highlighting in macro guide --- src/rust-2018/macros/at-most-once.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rust-2018/macros/at-most-once.md b/src/rust-2018/macros/at-most-once.md index 551934c1..b629704e 100644 --- a/src/rust-2018/macros/at-most-once.md +++ b/src/rust-2018/macros/at-most-once.md @@ -12,7 +12,7 @@ In Rust 2018, we have made a couple of changes to the macros-by-example syntax. For example, consider the following Rust 2015 code: -```rust2018 +```rust macro_rules! foo { ($a:ident, $b:expr) => { println!("{}", $a); @@ -29,7 +29,7 @@ but you need a whole other matcher to represent this possibility. This is annoying if your matchers are long. In Rust 2018, one can simply write the following: -```rust2018 +```rust macro_rules! foo { ($a:ident $(, $b:expr)?) => { println!("{}", $a); From 4729949d2de52d8afa34cad868d6eea848f1e361 Mon Sep 17 00:00:00 2001 From: lzutao Date: Sun, 7 Jul 2019 02:35:51 +0700 Subject: [PATCH 2/2] Fix up --- src/rust-2018/macros/at-most-once.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust-2018/macros/at-most-once.md b/src/rust-2018/macros/at-most-once.md index b629704e..56e30b97 100644 --- a/src/rust-2018/macros/at-most-once.md +++ b/src/rust-2018/macros/at-most-once.md @@ -17,7 +17,7 @@ macro_rules! foo { ($a:ident, $b:expr) => { println!("{}", $a); println!("{}", $b); - } + }; ($a:ident) => { println!("{}", $a); }