-
Notifications
You must be signed in to change notification settings - Fork 305
Introduce rustfmt
#499
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
Introduce rustfmt
#499
Conversation
b28092b to
135a304
Compare
|
WTF, the format change fail in CI is to a line that I cannot find in locally. |
|
(A bit off-topic) @tcharding What do you think about: rust-lang/rustfmt#5584 ? |
I like the idea, not sure why the lad is so unequivocally against it. I don't think it helps us though since "existing" is unformatted the "desired" would never be triggered. |
That's a good point. It only helps projects that are already formatted. |
135a304 to
5986121
Compare
As we did in `rust-bitcoin` introduced a `rustfmt` configuration file that is palatable to devs. Do not run formatter, that is done as a separate patch to assist review.
In preparation for running the formatter do minor refactorings and add a bunch of `rustfmt::skip` directives.
Run the command `cargo +nightly fmt` to fix formatting issues. The formatter got confused in one place, adding an incorrect indentation, this was manually fixed.
5986121 to
e0e575d
Compare
|
Please note the recently added deprecated "since" strings are so long that they now go over multiple lines, its ugly but I figured since we remove them in a release anyway I'd leave them as is. Can change if required. |
apoelstra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e0e575d
|
Will hold off on merging this for a bit since there are other PRs in flight and I think this'll conflict with everything. |
|
For me its better to just merge this one first please, I find these rustfmt PRs super boring to do where as I'm ok to rebase the others because they are much more interesting work. The only active PRs are my two I think. |
|
Hah, fair enough. Merging now. |
75f3886 Add cargo fmt to pre-commit githook (Tobin C. Harding) 0516dde Add formatting check to CI (Tobin C. Harding) c7807df Run the formatter (Tobin C. Harding) Pull request description: We recently introduced `rustfmt` to the codebase but I forgot to turn it on in CI. - Patch 1: Preparatory formatting fixes, introduced since we merged the [formatting PR](#499) - Patch 2: Enable formatting in CI - Patch 3: Add formatting to the pre-commit hook ACKs for top commit: apoelstra: ACK 75f3886 Tree-SHA512: 5ac4ab4015a9728ef890e0c4fe90afcb5e45ab7665da5a8ee289dc877c1ea5c6236e54b68b7122841597864b04606c8bfae7dec86c4b6be74d32437299057b5f
e0e575dde71a39de815bc6268e2d9f3c671366cc Run cargo fmt (Tobin C. Harding)
41449e455dfb14d11e9cccf0d13db08c2d008cfe Prepare codebase for formatting (Tobin C. Harding)
7e3c8935b621f3e76bd0e6e5f072258f5f64dffd Introduce rustfmt config file (Tobin C. Harding)
Pull request description:
(Includes the patch from #504, I pulled it out of this to merge faster)
Introduce `rustfmt` by doing:
- Copy the `rustfmt` config file from `rust-bitcoin`
- Prepare the codebase by adding `#[rustfmt::skip]` as needed and doing some manual format improvements.
- Run the formatter: `cargo +nightly fmt`
- Add formatting checks to CI and the pre-commit hook
Thanks in advance for doing the painful review on patch 3.
ACKs for top commit:
apoelstra:
ACK e0e575dde71a39de815bc6268e2d9f3c671366cc
Tree-SHA512: 1b6fdbaf81480c0446e660cc3f6ab7ac0697f272187f6fdfd6b95d894a418cde8cf1c423f1d18ebbe03ac5c43489630a35ad07912afaeb6107cfbe7338a9bed7
75f3886812a70aa7821d3de38bf2e8c94cfd9ef4 Add cargo fmt to pre-commit githook (Tobin C. Harding) 0516ddeb8d62e88b3943406969a7665a5f123999 Add formatting check to CI (Tobin C. Harding) c7807dff9c2e772179c97f396be60ef37b2d7ba2 Run the formatter (Tobin C. Harding) Pull request description: We recently introduced `rustfmt` to the codebase but I forgot to turn it on in CI. - Patch 1: Preparatory formatting fixes, introduced since we merged the [formatting PR](rust-bitcoin/rust-secp256k1#499) - Patch 2: Enable formatting in CI - Patch 3: Add formatting to the pre-commit hook ACKs for top commit: apoelstra: ACK 75f3886812a70aa7821d3de38bf2e8c94cfd9ef4 Tree-SHA512: 5ac4ab4015a9728ef890e0c4fe90afcb5e45ab7665da5a8ee289dc877c1ea5c6236e54b68b7122841597864b04606c8bfae7dec86c4b6be74d32437299057b5f
e0e575dde71a39de815bc6268e2d9f3c671366cc Run cargo fmt (Tobin C. Harding)
41449e455dfb14d11e9cccf0d13db08c2d008cfe Prepare codebase for formatting (Tobin C. Harding)
7e3c8935b621f3e76bd0e6e5f072258f5f64dffd Introduce rustfmt config file (Tobin C. Harding)
Pull request description:
(Includes the patch from #504, I pulled it out of this to merge faster)
Introduce `rustfmt` by doing:
- Copy the `rustfmt` config file from `rust-bitcoin`
- Prepare the codebase by adding `#[rustfmt::skip]` as needed and doing some manual format improvements.
- Run the formatter: `cargo +nightly fmt`
- Add formatting checks to CI and the pre-commit hook
Thanks in advance for doing the painful review on patch 3.
ACKs for top commit:
apoelstra:
ACK e0e575dde71a39de815bc6268e2d9f3c671366cc
Tree-SHA512: 1b6fdbaf81480c0446e660cc3f6ab7ac0697f272187f6fdfd6b95d894a418cde8cf1c423f1d18ebbe03ac5c43489630a35ad07912afaeb6107cfbe7338a9bed7
75f3886812a70aa7821d3de38bf2e8c94cfd9ef4 Add cargo fmt to pre-commit githook (Tobin C. Harding) 0516ddeb8d62e88b3943406969a7665a5f123999 Add formatting check to CI (Tobin C. Harding) c7807dff9c2e772179c97f396be60ef37b2d7ba2 Run the formatter (Tobin C. Harding) Pull request description: We recently introduced `rustfmt` to the codebase but I forgot to turn it on in CI. - Patch 1: Preparatory formatting fixes, introduced since we merged the [formatting PR](rust-bitcoin/rust-secp256k1#499) - Patch 2: Enable formatting in CI - Patch 3: Add formatting to the pre-commit hook ACKs for top commit: apoelstra: ACK 75f3886812a70aa7821d3de38bf2e8c94cfd9ef4 Tree-SHA512: 5ac4ab4015a9728ef890e0c4fe90afcb5e45ab7665da5a8ee289dc877c1ea5c6236e54b68b7122841597864b04606c8bfae7dec86c4b6be74d32437299057b5f
(Includes the patch from #504, I pulled it out of this to merge faster)
Introduce
rustfmtby doing:rustfmtconfig file fromrust-bitcoin#[rustfmt::skip]as needed and doing some manual format improvements.cargo +nightly fmtThanks in advance for doing the painful review on patch 3.