浏览代码

Fix to avoid needing the extra curly braces

Getty Ritter 5 年之前
父节点
当前提交
d8f011ccc3
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/lib.rs

+ 3 - 4
src/lib.rs

@@ -1,12 +1,12 @@
 #[macro_export]
 #[macro_export]
 macro_rules! system {
 macro_rules! system {
-    ($name:ident $pat:tt => $block:block ) => {
+    ($name:ident $pat:tt => $($rest:tt)* ) => {
         struct $name;
         struct $name;
         impl<'a> specs::System<'a> for $name {
         impl<'a> specs::System<'a> for $name {
             type SystemData = args_to_systemdata!($pat);
             type SystemData = args_to_systemdata!($pat);
             fn run(&mut self, args_to_pat!($pat): Self::SystemData) {
             fn run(&mut self, args_to_pat!($pat): Self::SystemData) {
                 for args_to_pat!($pat) in args_to_join!($pat).join() {
                 for args_to_pat!($pat) in args_to_join!($pat).join() {
-                    $block
+                    $($rest)*
                 }
                 }
             }
             }
         }
         }
@@ -77,8 +77,7 @@ mod tests {
         type Storage = specs::VecStorage<Mov>;
         type Storage = specs::VecStorage<Mov>;
     }
     }
 
 
-    system!{ Foo (_x: Mov, mut y: Pos) => {
+    system!{ Foo (_x: Mov, mut y: Pos) =>
         y.x += 1;
         y.x += 1;
     }
     }
-    }
 }
 }