]> git.lizzy.rs Git - rust.git/blobdiff - tests/target/macros.rs
Tidy up and pass tests
[rust.git] / tests / target / macros.rs
index a79eb8fb2941e8881f7b79e1675c0f2b8b49eadb..8db2fbb60ee99ebbd74d77b3322dd738b13b6619 100644 (file)
@@ -141,7 +141,7 @@ fn issue_1555() {
 
 fn issue1178() {
     macro_rules! foo {
-        (#[$attr:meta] $name:ident) => {}
+        (#[$attr: meta] $name: ident) => {};
     }
 
     foo!(
@@ -207,7 +207,7 @@ fn issue_1921() {
             acc += 1;
             acc += 2;
             acc
-        }
+        };
     }
 }
 
@@ -246,11 +246,15 @@ fn __bindgen_test_layout_HandleWithDtor_open0_int_close0_instantiation() {
 
 // #878
 macro_rules! try_opt {
-    ($expr:expr) => (match $expr {
-        Some(val) => val,
+    ($expr: expr) => {
+        match $expr {
+            Some(val) => val,
 
-        None => { return None; }
-    })
+            None => {
+                return None;
+            }
+        }
+    };
 }
 
 // #2214
@@ -885,9 +889,7 @@ fn macro_in_pattern_position() {
     };
 }
 
-macro foo() {
-
-}
+macro foo() {}
 
 pub macro bar($x: ident + $y: expr;) {
     fn foo($x: Foo) {
@@ -909,3 +911,7 @@ fn foo() {
 macro lex_err($kind: ident $(, $body: expr)*) {
     Err(QlError::LexError(LexError::$kind($($body,)*)))
 }
+
+// Preserve trailing comma on item-level macro with `()` or `[]`.
+methods![get, post, delete,];
+methods!(get, post, delete,);