-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ci: use some tricks to format macro bodies #4107
Conversation
r? @JohnTitor rustbot has assigned @JohnTitor. Use |
53da92e
to
7d9b3f9
Compare
Run `ci/style.sh` with the changes introduced in [1]. [1]: rust-lang#4107
eee7658
to
a0c7f80
Compare
Start with the commit for formatting macro bodies in [1]. [1]: rust-lang#4107
This still isn't ideal, I really wish Sorry everyone, conflicts ahead 🚢 |
Currently this only matches `$body` if every line ends with a semicolon. Make this simpler by just using the `block` matcher. Additionally, allow a trailing comma.
Apparently we already violate this in a few places, it just doesn't show up because whitespace doesn't line up with what we expect (lack of formatting). Just disable it for now so we can format the files.
The script shouldn't need to update `rustfmt` every time it gets run. Additionally, only pass `--check` when in CI so this script can be used for invoking the formatter locally.
We have a lot of syntax contained within macro bodies, which `rustfmt` doesn't touch. Add a hack that replaces relevant macro invocations with functions, formats, then resets.
Run `ci/style.sh` with the changes introduced in [1]. [1]: rust-lang#4107
Start with the commit for formatting macro bodies in [1]. [1]: rust-lang#4107
1782543
to
6269954
Compare
Currently this only matches `$body` if every line ends with a semicolon. Make this simpler by just using the `block` matcher. Additionally, allow a trailing comma. (backport <rust-lang#4107>) (cherry picked from commit 0ac42fd)
Apparently we already violate this in a few places, it just doesn't show up because whitespace doesn't line up with what we expect (lack of formatting). Just disable it for now so we can format the files. (backport <rust-lang#4107>) (cherry picked from commit 0189456)
The script shouldn't need to update `rustfmt` every time it gets run. Additionally, only pass `--check` when in CI so this script can be used for invoking the formatter locally. (backport <rust-lang#4107>) (cherry picked from commit 64ed860)
We have a lot of syntax contained within macro bodies, which `rustfmt` doesn't touch. Add a hack that replaces relevant macro invocations with functions, formats, then resets. (backport <rust-lang#4107>) (cherry picked from commit 6ab46bb)
Run `ci/style.sh` with the changes introduced in [1]. [1]: rust-lang#4107 (backport <rust-lang#4107>) This is the `libc-0.2` version of 49cb0ff ("Apply formatting to macro bodies"), though not a direct cherry pick.
Start with the commit for formatting macro bodies in [1]. [1]: rust-lang#4107 (backport <rust-lang#4107>) This is the `libc-0.2` version of 6269954 ("Introduce a git-blame-ignore-revs file") with the ignored rev changed to what is applicable for this branch.
We have a lot of syntax contained within macro bodies, which
rustfmt
doesn't touch. Add a hack that replaces relevant macro invocations with functions, formats, then resets.