diff --git a/src/macros/dry.md b/src/macros/dry.md index a2f3329b..bcdb9246 100644 --- a/src/macros/dry.md +++ b/src/macros/dry.md @@ -7,18 +7,18 @@ use std::ops::{Add, Mul, Sub}; macro_rules! assert_equal_len { // `tt`(token tree,标记树)指示符表示运算符和标记。 - ($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), ($a.len(),), stringify!($op), ($b.len(),)); - ) + }; } macro_rules! op { - ($func:ident, $bound:ident, $op:tt, $method:ident) => ( + ($func:ident, $bound:ident, $op:tt, $method:ident) => { fn $func + Copy>(xs: &mut Vec, ys: &Vec) { assert_equal_len!(xs, ys, $func, $op); @@ -27,7 +27,7 @@ macro_rules! op { // *x = x.$method(*y); } } - ) + }; } // 实现 `add_assign`、`mul_assign` 和 `sub_assign` 等函数。