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

71 lines
1.0 KiB
Rust

macro_rules! m {
// a
($expr :expr, $( $func : ident ) * ) => {
{
let x = $expr;
$func (
x
)
}
};
/* b */
() => {/* c */};
(@tag) =>
{
};
// d
( $item:ident ) => {
mod macro_item { struct $item ; }
};
}
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,
) => {};
}