rustfmt
rustfmt copied to clipboard
fix: `impl Trait` inside macro parsed incorrectly
This PR is probably (?) too blunt an approach, but it does illustrate how one could go about fixing #6036. Adds a test for illustration purposes.
Issue #3004 seems to be the only regression (surprisingly), but I'm not sure how my change caused this.
Mismatch at tests/source/macros.rs:1032:
fn issue3004() {
foo!(|_| { () });
- stringify!((foo+));
+ stringify!(( foo+ ));
}
EDIT: I misinterpreted the parse_item method's return value; I think the other parsers (for Ty and Pat) should be tried when it returns None, cause that means that the parsed argument starts with a token that's invalid for an Item. I pushed a commit that does this, and it should make tests pass.