|
| 1 | +# Rustfmt configuration |
| 2 | +# Opinionated whitespace and tabs. The most important of these are imports and width settings. |
| 3 | +# Others may want to borrow or change these to their own liking. |
| 4 | +# https://rust-lang.github.io/rustfmt |
| 5 | + |
| 6 | +# version-related |
| 7 | +unstable_features=true |
| 8 | +use_try_shorthand=true # replace any `try!` (2015 Rust) with `?` |
| 9 | + |
| 10 | +# misc formatting |
| 11 | +condense_wildcard_suffixes =true # replace: (a,b,_,_)=(1, 2, 3, 4); -> (a,b,..)=(1, 2, 3, 4); |
| 12 | +format_code_in_doc_comments =true # format code blocks in doc comments |
| 13 | +format_macro_matchers =true # $a: ident -> $a:ident |
| 14 | +format_strings =true # break and insert newlines for long string literals |
| 15 | +match_block_trailing_comma =true # include comma in match blocks after '}' |
| 16 | +normalize_comments =true # convert /*..*/ to //.. where possible |
| 17 | +reorder_impl_items =true # move `type` and `const` declarations to top of impl block |
| 18 | +struct_field_align_threshold=20 # align struct arguments' types vertically |
| 19 | +use_field_init_shorthand =true # struct initialization short {x: x} -> {x} |
| 20 | + |
| 21 | +# reduce whitespace |
| 22 | +blank_lines_upper_bound=1 # default: 1. Sometimes useful to change to 0 to condense a file. |
| 23 | +brace_style ="PreferSameLine" # prefer starting `{` without inserting extra \n |
| 24 | +fn_single_line =true # if it's a short 1-liner, let it be a short 1-liner |
| 25 | +match_arm_blocks =false # remove unnecessary {} in match arms |
| 26 | +newline_style ="Unix" # not auto, we won the culture war. \n over \r\n |
| 27 | +overflow_delimited_expr=true # prefer ]); to ]\n); |
| 28 | +where_single_line =true # put where on a single line if possible |
| 29 | + |
| 30 | +# imports preferences |
| 31 | +group_imports ="StdExternalCrate" # create import groupings for std, external libs, and internal deps |
| 32 | +imports_granularity="Crate" # aggressively group imports |
| 33 | + |
| 34 | +# width settings: everything to 100 |
| 35 | +comment_width =100 # default: 80 |
| 36 | +inline_attribute_width=60 # inlines #[cfg(test)]\nmod test -> #[cfg(test)] mod test |
| 37 | +max_width =100 # default: 100 |
| 38 | +use_small_heuristics ="Max" # don't ever newline short of `max_width`. |
| 39 | +wrap_comments =true # wrap comments at `comment_width` |
| 40 | +# format_strings = true # wrap strings at `max_length` |
| 41 | + |
| 42 | +# tabs and spaces |
| 43 | +hard_tabs =false # (def: false) use spaces over tabs |
| 44 | +tab_spaces=2 # 2 > 4, it's just math. |
| 45 | + |
| 46 | +ignore=["tls"] |
0 commit comments