-
Notifications
You must be signed in to change notification settings - Fork 213
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
chore: Format imports using rustfmt #2812
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2812/docs/iroh/ Last updated: 2024-10-17T17:41:59Z |
FWIW, personally I like |
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.
I updated the pr to not depend on nightly.
Also pushed changes that are incoming on the nightly channel but are accepted by check.
Also changed the pr to Crate
, which a couple of us seem to prefer.. so obviously LGTM there.
Also did a couple tries of removing imports and asking rust-analyzer do add them back without further configuration and it behaves how we want. Also tested that cargo make format
produces no diff locally.
Happy we are improving our code quality and standards
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.
LGTM, let's merge this already before it gets out of date!
(can't approve my own PR)
Merging, as internal discussions point to (at least by majority) consensus |
## Description This enables a strict style in rustfmt to format imports statements. It needs rust nightly for rustfmt to be able to do this. To not make the `cargo fmt` from stable rust really noisy it does not add a rustfmt.toml file, instead it adds a `cargo-make` task to automate running this locally. This same task is used in CI to run the formatter. The `Crate`m formatting will be preserved by the default configuration of rust-analyzer, which makes external contributions easier as well, most folks shouldn't be running into this formatter. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions I guess we need buy-in from everyone on the team for this. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented. --------- Co-authored-by: Diva M <[email protected]> Co-authored-by: Divma <[email protected]>
Description
This enables a strict style in rustfmt to format imports statements. It needs rust nightly for rustfmt to be able to do this.
To not make the
cargo fmt
from stable rust really noisy it does not add a rustfmt.toml file, instead it adds acargo-make
task to automate running this locally. This same task is used in CI to run the formatter.The
Crate
m formatting will be preserved by the default configuration of rust-analyzer, which makes external contributions easier as well, most folks shouldn't be running into this formatter.Breaking Changes
Notes & open questions
I guess we need buy-in from everyone on the team for this.
Change checklist