Skip to content
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

Use nightly rustfmt #3056

Open
divergentdave opened this issue Apr 23, 2024 · 2 comments
Open

Use nightly rustfmt #3056

divergentdave opened this issue Apr 23, 2024 · 2 comments

Comments

@divergentdave
Copy link
Contributor

We could automate and standardize a few more style choices if we used a nightly build of rustfmt, and set up a configuration file with the following options.

  • format_strings = true (unstable): I made some one-off changes using this previously, to wrap very long string literals. At the time this un-stuck about half of the chains that couldn't be formatted. (the rest were due to long turbofishes)
  • group_imports (unstable): Our initial convention in this repository was to group all imports together, which maps to "One". Personally I would prefer "StdExternalCrate", which creates three groups of imports separated by blank lines in that order. This is closer to what rust-analyzer's auto-import assist does, though that creates up to five groups, splitting out self and super.
  • imports_granularity = "Crate" (unstable): Combines multiple import statements from the same crate into one.
@inahga
Copy link
Contributor

inahga commented Apr 25, 2024

SGTM. For local development looks like it' reasonably possible to use a stable compiler while still using nightly rustfmt rust-lang/vscode-rust#438.

@inahga
Copy link
Contributor

inahga commented Apr 25, 2024

wrap_comments may also be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants