spin
spin copied to clipboard
chore(rustfmt): standardize the order of Rust imports
This commit updates the order of the Rust imports throughtout the project to be consistent with — specifically, standard library, external, and crate imports.
The group_imports=StdExternalCrate rustfmt setting only works for the nightly
toolchain, so this commit does not enforce it in CI (which would also require
all contributors to run the nightly toolchain to format).
To run the formatter using this setting:
cargo +nightly fmt --all -- --emit files --config group_imports=StdExternalCrate
Signed-off-by: Radu Matei [email protected]
What is the expectation here for maintenance, given no CI and the nightly toolchain requirement? Is this something that we will do as and when the spirit moves us, or is it on contributors to keep it straight day by day?
As you mentioned, because there is not way to enforce this without forcing contributors to use the nightly toolchain, I don't think it is reasonable to expect CI to break either, and given that we already have strict formatting rules for everything else, I would be ok with doing this as and when the spirit moves us.
We could add a Make target for running the nightly command above, if you think that helps.
Nah, "as and when" was the arrangement I assumed and I'm happy with it. Thanks!
I am a bit concenred that if we do not enforce this to CI and all developers, pr like this will generate lots of conflicts for local developing branches.
Yeah, that can definitely happen. But that is the case with any large PR.
My hope is that when such PRs generate conflicts, you could run the the local formatting command:
$ cargo +nightly fmt --all -- --emit files --config group_imports=StdExternalCrate
But I get your concern here, not sure what the best way to address this.
We can also do this incrementally as we are doing "major work" on individual crates/files. Until the config option is stable its going to drift over time anyway.
Closing this for now. Once the formatter is stable, we could revisit this.