fn main() {
foo!();
+ foo!(,);
+
bar!(a, b, c);
bar!(a, b, c,);
fn issue1178() {
macro_rules! foo {
- (#[$attr:meta] $name:ident) => {}
+ (#[$attr:meta] $name:ident) => {};
}
foo!(
acc += 1;
acc += 2;
acc
- }
+ };
}
}
// #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
};
}
-macro foo() {
+macro foo() {}
-}
-
-pub macro bar($x: ident + $y: expr;) {
+pub macro bar($x:ident + $y:expr;) {
fn foo($x: Foo) {
long_function(
a_long_argument_to_a_long_function_is_what_this_is(AAAAAAAAAAAAAAAAAAAAAAAAAAAA),
}
}
+// #2574
+macro_rules! test {
+ () => {{}};
+}
+
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,);
+
+// #2588
+macro_rules! m {
+ () => {
+ r#"
+ test
+ "#
+ };
+}
+fn foo() {
+ f!{r#"
+ test
+ "#};
+}
+
+// #2591
+fn foo() {
+ match 0u32 {
+ 0 => (),
+ _ => unreachable!(/* obviously */),
+ }
+}
+
+fn foo() {
+ let _ = column!(/* here */);
+}
+
+// #2616
+// Preserve trailing comma when using mixed layout for macro call.
+fn foo() {
+ foo!(
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+ );
+ foo!(
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ );
+}