Open
Description
Input
macro_rules! outer {
($d:tt) => {
macro_rules! inner {
($d s:expr) => {
println!("{}", $d s);
}
}
};
}
outer!($);
fn main() {
inner!("hi");
}
Output
Note that the body and trailing closing braces of the nested macro_rules
block is indented. With further invocations of rustfmt
, this block is continuously indented to the next level.
Removing the usage of the inner macro_rules
's $s
in the println!
usage causes the formatting to behave as expected.
macro_rules! outer {
($d:tt) => {
macro_rules! inner {
($d s:expr) => {
println!("{}", $d s);
}
}
};
}
outer!($);
fn main() {
inner!("hi");
}
Expected output
The input should likely remain unchanged.
Meta
- rustfmt version: 1.4.27-nightly (2020-11-16 580d826), as used on Rust Playground
- From where did you install rustfmt?: Rust Playground