Auto-format code with "cargo fmt" and check in CI #615
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This auto-formats the entire repository with
cargo fmt
(rustfmt
) and checks it in CI, in line with the Rust Style Guide's recommendation (previously known as RFC 2436):This is using the formatter's default settings, as it's not clear what the existing style standards apply to this project, and that's at least fairly consistent with the rest of the Rust ecosystem.
These PRs are where it looks like a code formatter was run (not necessarily full
rustfmt
, but even trivial things like stripping trailing whitespace), leading to larger diffs in unrelated code:By using an auto-formatter, it means that it's much easier to write PRs that merge cleanly without noise, while also laying everything out consistently.
This PR is split into two commits:
7b3caa7 adds
cargo fmt --check
to CI (.github/workflows/rust.yml
), which you can see failing here: https://github.com/micolous/core-foundation-rs/actions/runs/5515554024/jobs/100559895797cee916 auto-formats the code, and was generated with:
With that, CI now passes: https://github.com/micolous/core-foundation-rs/actions/runs/5515564815
Because the fix-ups are a huge diff that'll be difficult to review (and would break if there are any other changes merged prior), you might want to cherry-pick the first commit and run
cargo fmt
yourself, or otherwise swap it around.