From 449f00b51d4cbb548b8c6503c88127fbe3c0bd77 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Wed, 7 Nov 2018 16:31:59 +0300 Subject: [PATCH 1/3] Remove an extra space character --- src/macros/dry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros/dry.md b/src/macros/dry.md index 6e765e8469..d3dc2f5871 100644 --- a/src/macros/dry.md +++ b/src/macros/dry.md @@ -10,7 +10,7 @@ use std::ops::{Add, Mul, Sub}; macro_rules! assert_equal_len { // The `tt` (token tree) designator is used for // operators and tokens. - ($a:ident, $b: ident, $func:ident, $op:tt) => ( + ($a:ident, $b:ident, $func:ident, $op:tt) => ( assert!($a.len() == $b.len(), "{:?}: dimension mismatch: {:?} {:?} {:?}", stringify!($func), @@ -41,7 +41,7 @@ op!(sub_assign, Sub, -=, sub); mod test { use std::iter; macro_rules! test { - ($func: ident, $x:expr, $y:expr, $z:expr) => { + ($func:ident, $x:expr, $y:expr, $z:expr) => { #[test] fn $func() { for size in 0usize..10 { From bb6fb9ebd728a42c605b8164846eb41321e0e6f5 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Wed, 7 Nov 2018 16:57:54 +0300 Subject: [PATCH 2/3] Reformat the comment to match the rest of the file --- src/macros/dry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/macros/dry.md b/src/macros/dry.md index d3dc2f5871..ffa8250687 100644 --- a/src/macros/dry.md +++ b/src/macros/dry.md @@ -57,7 +57,7 @@ mod test { } } - // Test `add_assign`, `mul_assign` and `sub_assign` + // Test `add_assign`, `mul_assign`, and `sub_assign`. test!(add_assign, 1u32, 2u32, 3u32); test!(mul_assign, 2u32, 3u32, 6u32); test!(sub_assign, 3u32, 2u32, 1u32); From 81739b4709cda6b699ffc8330962c88cac8c416b Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Thu, 8 Nov 2018 14:21:39 +0300 Subject: [PATCH 3/3] Add a comment about curly braces --- src/macros/dsl.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/macros/dsl.md b/src/macros/dsl.md index 1182b97cc7..de28910cd0 100644 --- a/src/macros/dsl.md +++ b/src/macros/dsl.md @@ -39,3 +39,6 @@ Output: This was a very simple example, but much more complex interfaces have been developed, such as [`lazy_static`](https://crates.io/crates/lazy_static) or [`clap`](https://crates.io/crates/clap). + +Also, note the two pairs of braces in the macro. The outer ones are +part of the syntax of `macro_rules!`, in addition to `()` or `[]`.