rustfmt
rustfmt copied to clipboard
rustfmt breaks macros involving $
This macro:
macro_rules! test_macro {
($member:ident $($rest:tt)*) => {
paste::paste! {fn test(&self) {
(self.$member$($rest)* )
}}
};
}
gets wrongly reformatted as:
macro_rules! test_macro {
($member:ident $($rest:tt)*) => {
paste::paste! {fn test(&self) {
(self.$$member($rest)* )
}}
};
}
The diff being:
4c4
< (self.$member$($rest)* )
---
> (self.$$member($rest)* )
The version being:
rustfmt 1.6.0-stable (5680fa1 2023-08-23)
Note that if there is a space after the first argument: self.$member $($rest)*
then rustfmt doesn't produce the erroneous output.
@rustbot claim