Open
Description
rustfmt will remove the comment in the following macro invocation:
macro_rules! add_my_field {
{
$(#[$m:meta])*
$v:vis struct $name:ident {
$($var_v:vis $var_name:ident: $var_ty:ty,)*
}
} => {
$(#[$m])*
$v struct $name {
$($var_v $var_name: $var_ty,)*
my_field: u32,
}
}
}
add_my_field!(
#[derive(Debug)]
struct MyStruct {
a: u8,
b: u16,
}
// this comment will be deleted (it doesn't matter if it's // or /* */)
);
fn main() {
println!("{:#?}", MyStruct {
a: 1,
b: 2,
my_field: 3,
})
}
Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c452814ae6ed3ad5042af833d1e0b359
Tested with:
- rustfmt 1.5.1-stable (fc594f15 2023-01-24)
- rustfmt 1.5.2-nightly (2023-02-16 9a7cc6c)