-
Notifications
You must be signed in to change notification settings - Fork 7
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
Adding formatting spec #8
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,20 @@ | ||||||||||
# Formatting | ||||||||||
|
||||||||||
All Rust projects should follow the same formatting standard. This standard is | ||||||||||
to be documented in a `rustfmt.toml` file in the top level of each project. | ||||||||||
See below for an example of the default values for the file. | ||||||||||
|
||||||||||
```toml | ||||||||||
fn_args_layout = "Tall" | ||||||||||
hard_tabs = false | ||||||||||
match_arm_leading_pipes = "Never" | ||||||||||
max_width = 100 | ||||||||||
merge_derives = true | ||||||||||
remove_nested_parens = true | ||||||||||
reorder_imports = true | ||||||||||
reorder_modules = true | ||||||||||
tab_spaces = 4 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This auto formats imports into a nice format for diffing (requires nightly fmt though):
Suggested change
|
||||||||||
use_field_init_shorthand = false | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a handy feature that helps prevent clippy warnings when enabled
Suggested change
|
||||||||||
use_small_heuristics = "Default" | ||||||||||
use_try_shorthand = false | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one also makes sense to enable, no reason to keep the
Suggested change
|
||||||||||
``` |
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.
Another nice one for organizing imports is group_imports