-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Special case matches!
macro
#5554
base: master
Are you sure you want to change the base?
Commits on Mar 9, 2023
-
Configuration menu - View commit details
-
Copy full SHA for f2942d2 - Browse repository at this point
Copy the full SHA f2942d2View commit details -
The first step in being able to format the `matches!` macro is to parse it into ast nodes that we know how to rewrite.
Configuration menu - View commit details
-
Copy full SHA for 00b9003 - Browse repository at this point
Copy the full SHA 00b9003View commit details -
Configuration menu - View commit details
-
Copy full SHA for 735efa6 - Browse repository at this point
Copy the full SHA 735efa6View commit details -
Better encapsulate guard rewrite logic in relation to pattern rewirte
The guard rewrite rules vary based on how the pattern was rewritten. That logic was previously written in `rewrite_match_arm`, but now it's fully encapsulates in `rewrite_guard`.
Configuration menu - View commit details
-
Copy full SHA for fbcc07a - Browse repository at this point
Copy the full SHA fbcc07aView commit details -
Add MatchesMacroItem and imp Rewrite, Spanned, and IntoOverflowableItem
These traits will make it easier to implement rewriting matches! in terms of `overflow::rewrite_with_*` methods.
Configuration menu - View commit details
-
Copy full SHA for 8de2540 - Browse repository at this point
Copy the full SHA 8de2540View commit details -
Now that we're able to parse the TokenStream of `matches!` calls into a `Matches` struct and then convert that `Matches` struct into an iterable which implments `IntoOverflowableItem` we're able to implement `matches!` rewriting in terms of `overflow::rewrite_with_*` calls.
Configuration menu - View commit details
-
Copy full SHA for 9d6a512 - Browse repository at this point
Copy the full SHA 9d6a512View commit details -
Version gate
matches!
special case formattingAfter special casing `matches!`, the formatting more closely resembles `match` expressions. These changes cause breaking formatting changes to that need to be version gated.
Configuration menu - View commit details
-
Copy full SHA for e563f1b - Browse repository at this point
Copy the full SHA e563f1bView commit details -
Add unit tests for
matches!
special case formattingThe unit tests cover version One and Two formatting
Configuration menu - View commit details
-
Copy full SHA for 9e37c1e - Browse repository at this point
Copy the full SHA 9e37c1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 93130c0 - Browse repository at this point
Copy the full SHA 93130c0View commit details -
Apply updated
matches!
formatting to rustfmtSince rustfmt uses version two formatting the self tests were failing due to the new special case handling for `matches!`. various `matches!` calls in the codebase were updated to address this issue.
Configuration menu - View commit details
-
Copy full SHA for 0c5552d - Browse repository at this point
Copy the full SHA 0c5552dView commit details