|
| 1 | +# Max width of each line |
| 2 | +max_width = 100 |
| 3 | + |
| 4 | +# Rust community convention: spaces (4) or tab = false for spaces |
| 5 | +use_tabs = false |
| 6 | +tab_spaces = 4 |
| 7 | + |
| 8 | +indent_style = "Block" |
| 9 | + |
| 10 | +struct_field_align_threshold = 20 |
| 11 | + |
| 12 | +# Control how comments are formatted |
| 13 | +normalize_comments = true |
| 14 | +wrap_comments = true |
| 15 | +comment_width = 100 |
| 16 | + |
| 17 | +# Control formatting of method chains |
| 18 | +chain_split_threshold = 80 |
| 19 | +indent_method_chain = true |
| 20 | + |
| 21 | +# Imports formatting |
| 22 | +reorder_imports = true |
| 23 | +group_imports = "StdExternalCrate" # separate standard library from external crates |
| 24 | +merge_imports = true |
| 25 | + |
| 26 | +# Control trailing commas |
| 27 | +trailing_comma = "Always" |
| 28 | + |
| 29 | +# Control alignment of comments and attributes |
| 30 | +align_comments = true |
| 31 | +align_attributes = true |
| 32 | + |
| 33 | +# How to format single-line vs multi-line |
| 34 | +single_argument = "Always" # put each argument on its own line if multiline |
| 35 | +match_block_trailing_comma = true |
| 36 | + |
| 37 | +# Control visibility groups |
| 38 | +# (no explicit option in rustfmt to group visibilities, but keep consistent ordering manually) |
| 39 | + |
| 40 | +# Control where to place attributes |
| 41 | +reorder_modules = true |
| 42 | +format_macro_args = true |
| 43 | + |
| 44 | +# Use the 'visual' indent for nested indentations |
| 45 | +visual_indent_width = 4 |
| 46 | + |
| 47 | +# Overflow behaviour |
| 48 | +overflow_delimited_expr = "Auto" |
| 49 | + |
| 50 | +# Control blank lines |
| 51 | +blank_lines_upper_bound = 1 |
| 52 | +blank_lines_lower_bound = 0 |
| 53 | + |
| 54 | +# Use the newer rustfmt rule for where to put braces |
| 55 | +brace_style = "AlwaysNextLineWhereRequired" |
| 56 | + |
| 57 | +# Preserve width of chained method calls |
| 58 | +wrap_chained_methods = true |
0 commit comments