rust/rustfmt-core/tests/source/macro_rules.rs

71 lines
1.0 KiB
Rust
Raw Normal View History

2018-01-24 19:09:49 +00:00
macro_rules! m {
2018-01-29 10:15:18 +00:00
// a
2018-01-25 14:20:17 +00:00
($expr :expr, $( $func : ident ) * ) => {
2018-01-24 19:09:49 +00:00
{
let x = $expr;
$func (
x
)
}
};
2018-01-29 10:15:18 +00:00
/* b */
2018-01-24 19:09:49 +00:00
2018-01-29 10:15:18 +00:00
() => {/* c */};
2018-01-30 17:05:31 +00:00
(@tag) =>
{
};
2018-01-29 10:15:18 +00:00
// d
2018-01-24 19:09:49 +00:00
( $item:ident ) => {
mod macro_item { struct $item ; }
};
}
2018-01-30 17:05:31 +00:00
macro m2 {
// a
($expr :expr, $( $func : ident ) * ) => {
{
let x = $expr;
$func (
x
)
}
}
/* b */
() => {/* c */}
(@tag) =>
{
}
// d
( $item:ident ) => {
mod macro_item { struct $item ; }
}
}
// #2438
macro_rules! m {
() => {
this_line_is_99_characters_long_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
); // this line is drifting
};
}
// #2439
macro_rules! m {
(
$line0_xxxxxxxxxxxxxxxxx: expr,
$line1_xxxxxxxxxxxxxxxxx: expr,
$line2_xxxxxxxxxxxxxxxxx: expr,
$line3_xxxxxxxxxxxxxxxxx: expr,
) => {};
}