rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Illegally adds comma to macro invocation

Open Person-93 opened this issue 8 months ago • 1 comments
trafficstars

Rustfmt adds a comma to the following and causes a compiler error.

macro_rules! idx {
    ($(#[$attr:meta])* $vis:vis struct $name:ident; $metadata:ident) => {
        $(#[$attr])*
        $vis struct $name(usize);
    };
}

idx!(
    #[derive(Debug)]
    pub struct FooIdx; // rustfmt adds a comma here
    Meta
);

Person-93 avatar Mar 10 '25 12:03 Person-93