Skip to content

Instantly share code, notes, and snippets.

@bddap
Created July 26, 2019 23:02
Show Gist options
  • Save bddap/b3434c4178d65e836cca4f7b95284d61 to your computer and use it in GitHub Desktop.
Save bddap/b3434c4178d65e836cca4f7b95284d61 to your computer and use it in GitHub Desktop.
Auto formatter config based on https://wiki.parity.io/Substrate-Style-Guide
# This file encodes the formatting decisions expressed in https://wiki.parity.io/Substrate-Style-Guide
## Indent using tabs.
hard_tabs = true
## Lines should be longer than 100 characters long only in exceptional circumstances and certainly
## no longer than 120.
# max_width = 100 # default setting
## For this purpose, tabs are considered 4 characters wide.
# tab_spaces = 4 # default setting
## Indent levels should be greater than 5 only in exceptional circumstances and certainly no
## greater than 8. If they are greater than 5, then consider using let or auxiliary functions
## in order to strip out complex inline expressions.
# If this is to be enforced, it must be enforced manually for now.
## Never have spaces on a line prior to a non-whitespace character
# Ensured by "hard_tabs = true" option above
## Follow-on lines are only ever a single indent from the original line. Indent level should follow
## open parens/brackets, but should be collapsed to the smallest number of levels actually used.
# indent_style = "Block" # default setting
## Where is indented, and its items are indented one further.
# Not completely supported. The style guide calls for:
#
# fn foo<T>()
# where
# T: Bar
# {
# }
#
# but rustfmt does:
#
# fn foo<T>()
# where
# T: Bar
# {
# }
## Argument lists or function invocations that are too long to fit on one line are indented
## similarly to code blocks, and once one param is indented in such a way, all others should
## be, too. Run-on parameter lists are also acceptable for single-line run-ons of basic function
## calls.
# this is default behaviour
## Always end last item of a multi-line comma-delimited set with , when legal.
# this is default behaviour
## Avoid trailing ;s where unneeded.
# In most cases, rustfmt follows this rule, with the exception of explicit return.
#
# if true {
# return 1
# }
#
# is transformed into
#
# if true {
# return 1;
# }
## Match arms may be either blocks or have a trailing , but not both.
# this is default behaviour
## Blocks should not be used unnecessarily.
# this is default behaviour
# Order of imports is not specified in the Substrate Style Guide. This option is set to false to
# match the current state of the codebase. reorder_imports can be enabled later
reorder_imports = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment