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

Add default settings for rustfmt and run on applications #1090

Open
wants to merge 1 commit into
base: theseus_main
Choose a base branch
from

Conversation

jklott
Copy link
Contributor

@jklott jklott commented Jan 5, 2024

This is addressing Issue #529

As development on Theseus continues the importance of a "no-thinking-required" format increases. This is where rustfmt comes in. Based off previous discussion we will not use the default rustfmt but would use a customized version for the project using the rustfmt.toml file. Some concerns on the formatting is how it will handle vertical line spacing, chaining, and others.

This PR does 2 things:

  1. It sets up defined values in the rustfmt.toml file which are easily customizable.
  2. It runs cargo fmt on applications directory to demonstrate what these values will create.

Some changes to the formatting based off the new default values include:

  1. #[macro_use] is placed on its own line
  2. Alphabetical sorting for crates
  3. Removing of unused tabs
  4. Some => match on same line
  5. if statement one liners removed
  6. multi-line chaining enforced
  7. Remove of extra whitespace after ;
  8. Group together crate packages
    And more not listed

Because of how customizable rustfmt.toml is it should be not too difficult to modify the settings further to have rustfmt leave do more or less when run. If this PR is approved then more folders can have cargo fmt run on them handling each case by case until they are all no longer being ignored.

Signed-off-by: Jacob Lott <41162160+jklott@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant