3 Rustfmt is designed to be very configurable. You can create a TOML file called `rustfmt.toml` or `.rustfmt.toml`, place it in the project or any other parent directory and it will apply the options in that file.
5 A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
10 reorder_imported_names = true
13 # Configuration Options
15 Below you find a detailed visual guide on all the supported configuration options of rustfmt:
17 ## `array_horizontal_layout_threshold`
19 How many elements array must have before rustfmt uses horizontal layout.
20 Use this option to prevent a huge array from being vertically formatted.
22 - **Default value**: `0`
23 - **Possible values**: any positive integer
25 **Note:** A value of `0` results in [`array_layout`](#array_layout) being applied regardless of a line's width.
30 // Each element will be placed on its own line.
46 // Each element will be placed on the same line as much as possible.
57 - **Default value**: `"Block"`
58 - **Possible values**: `"Block"`, `"Visual"`
77 let lorem = vec!["ipsum",
88 Maximum width of an array literal before falling back to vertical formatting
90 - **Default value**: `60`
91 - **Possible values**: any positive integer
93 **Note:** A value of `0` results in [`array_layout`](#array_layout) being applied regardless of a line's width.
95 #### Lines shorter than `array_width`:
97 let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"];
100 #### Lines longer than `array_width`:
101 See [`array_layout`](#array_layout).
103 ## `attributes_on_same_line_as_field`
105 Try to put attributes on the same line as fields
107 - **Default value**: `true`
108 - **Possible values**: `true`, `false`
114 #[serde(rename = "Ipsum")] ipsum: usize,
115 #[serde(rename = "Dolor")] dolor: usize,
116 #[serde(rename = "Amet")] amet: usize,
124 #[serde(rename = "Ipsum")]
126 #[serde(rename = "Dolor")]
128 #[serde(rename = "Amet")]
133 ## `attributes_on_same_line_as_variant`
135 Try to put attributes on the same line as variants
137 - **Default value**: `true`
138 - **Possible values**: `true`, `false`
144 #[serde(skip_serializing)] Ipsum,
145 #[serde(skip_serializing)] Dolor,
146 #[serde(skip_serializing)] Amet,
154 #[serde(skip_serializing)]
156 #[serde(skip_serializing)]
158 #[serde(skip_serializing)]
167 - **Default value**: `"Block"`
168 - **Possible values**: `"Block"`, `"Visual"`
185 let lorem = ipsum.dolor()
193 See also [`chain_one_line_max`](#chain_one_line_max).
195 ## `chain_one_line_max`
197 Maximum length of a chain to fit on a single line
199 - **Default value**: `60`
200 - **Possible values**: any positive integer
202 #### Lines shorter than `chain_one_line_max`:
204 let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
207 #### Lines longer than `chain_one_line_max`:
208 See [`chain_indent`](#chain_indent).
210 ## `chain_split_single_child`
212 Split a chain with a single child if its length exceeds [`chain_one_line_max`](#chain_one_line_max).
214 - **Default value**: `false`
215 - **Possible values**: `false`, `true`
220 let files = fs::read_dir("tests/coverage/source").expect("Couldn't read source dir");
226 let files = fs::read_dir("tests/coverage/source")
227 .expect("Couldn't read source dir");
230 See also [`chain_one_line_max`](#chain_one_line_max).
232 ## `closure_block_indent_threshold`
234 How many lines a closure must have before it is block indented. -1 means never use block indent.
236 - **Default value**: `7`
237 - **Possible values**: `-1`, or any positive integer
239 #### Closures shorter than `closure_block_indent_threshold`:
250 #### Closures longer than `closure_block_indent_threshold`:
258 println!("consectetur");
259 println!("adipiscing");
264 **Note**: This option only takes effect when `fn_call_style` is set to `"Visual"`.
266 ## `combine_control_expr`
268 Combine control expressions with function calls.
270 - **Default value**: `true`
271 - **Possible values**: `true`, `false`
285 foo!(if let Some(..) = x {
298 foo!(while let Some(..) = x {
324 Maximum length of comments. No effect unless`wrap_comments = true`.
326 - **Default value**: `80`
327 - **Possible values**: any positive integer
329 **Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
331 #### Comments shorter than `comment_width`:
333 // Lorem ipsum dolor sit amet, consectetur adipiscing elit.
336 #### Comments longer than `comment_width`:
338 // Lorem ipsum dolor sit amet,
339 // consectetur adipiscing elit.
342 See also [`wrap_comments`](#wrap_comments).
344 ## `condense_wildcard_suffixes`
346 Replace strings of _ wildcards by a single .. in tuple patterns
348 - **Default value**: `false`
349 - **Possible values**: `true`, `false`
354 let (lorem, ipsum, _, _) = (1, 2, 3, 4);
360 let (lorem, ipsum, ..) = (1, 2, 3, 4);
365 Indent style for control flow statements
367 - **Default value**: `"Rfc"`
368 - **Possible values**: `"Rfc"`, `"Legacy"`
391 See also: [`control_brace_style`](#control_brace_style).
393 ## `control_brace_style`
395 Brace style for control flow constructs
397 - **Default value**: `"AlwaysSameLine"`
398 - **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
400 #### `"AlwaysNextLine"`:
413 #### `"AlwaysSameLine"`:
423 #### `"ClosingNextLine"`:
434 ## `disable_all_formatting`
436 Don't reformat anything
438 - **Default value**: `false`
439 - **Possible values**: `true`, `false`
441 ## `error_on_line_overflow`
443 Error if unable to get all lines within max_width
445 - **Default value**: `true`
446 - **Possible values**: `true`, `false`
448 See also [`max_width`](#max_width).
452 Argument density in functions
454 - **Default value**: `"Tall"`
455 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
461 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
463 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
468 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
469 adipiscing: Adipiscing, elit: Elit,
473 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
474 adipiscing: Adipiscing, elit: Elit,
481 #### `"CompressedIfEmpty"`:
485 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
487 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
492 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
493 adipiscing: Adipiscing, elit: Elit,
501 consectetur: onsectetur,
502 adipiscing: Adipiscing,
514 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
516 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
525 consectetur: onsectetur,
526 adipiscing: Adipiscing,
535 consectetur: onsectetur,
536 adipiscing: Adipiscing,
548 fn lorem(ipsum: Ipsum,
553 fn lorem(ipsum: Ipsum,
560 fn lorem(ipsum: Ipsum,
564 consectetur: onsectetur,
565 adipiscing: Adipiscing,
568 fn lorem(ipsum: Ipsum,
572 consectetur: onsectetur,
573 adipiscing: Adipiscing,
582 Layout of function arguments and tuple structs
584 - **Default value**: `"Block"`
585 - **Possible values**: `"Block"`, `"Visual"`
592 fn lorem(ipsum: usize) {}
612 fn lorem(ipsum: usize) {}
614 fn lorem(ipsum: usize,
625 ## `fn_args_paren_newline`
627 If function argument parenthesis goes on a newline
629 - **Default value**: `false`
630 - **Possible values**: `true`, `false`
640 ) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit {
654 ) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit {
661 Brace style for functions
663 - **Default value**: `"SameLineWhere"`
664 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
666 #### `"AlwaysNextLine"`:
674 fn lorem(ipsum: usize)
679 fn lorem<T>(ipsum: T)
681 T: Add + Sub + Mul + Div,
687 #### `"PreferSameLine"`:
694 fn lorem(ipsum: usize) {
698 fn lorem<T>(ipsum: T)
700 T: Add + Sub + Mul + Div, {
705 #### `"SameLineWhere"`:
712 fn lorem(ipsum: usize) {
716 fn lorem<T>(ipsum: T)
718 T: Add + Sub + Mul + Div,
726 Indentation for function calls, etc.
728 - **Default value**: `"Block"`
729 - **Possible values**: `"Block"`, `"Visual"`
761 Maximum width of the args of a function call before falling back to vertical formatting
763 - **Default value**: `60`
764 - **Possible values**: any positive integer
766 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
768 #### Function call shorter than `fn_call_width`:
770 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
773 #### Function call longer than `fn_call_width`:
775 See [`fn_call_style`](#fn_call_style).
777 ## `fn_empty_single_line`
779 Put empty-body functions on a single line
781 - **Default value**: `true`
782 - **Possible values**: `true`, `false`
797 See also [`control_brace_style`](#control_brace_style).
799 ## `fn_return_indent`
801 Location of return type in function declaration
803 - **Default value**: `"WithArgs"`
804 - **Possible values**: `"WithArgs"`, `"WithWhereClause"`
809 fn lorem(ipsum: Ipsum,
813 consectetur: Consectetur,
814 adipiscing: Adipiscing)
823 #### `"WithWhereClause"`:
826 fn lorem(ipsum: Ipsum,
830 consectetur: Consectetur,
831 adipiscing: Adipiscing)
840 **Note**: This option only takes effect when `fn_call_style` is set to `"Visual"`.
844 Put single-expression functions on a single line
846 - **Default value**: `false`
847 - **Possible values**: `true`, `false`
852 fn lorem() -> usize {
856 fn lorem() -> usize {
865 fn lorem() -> usize { 42 }
867 fn lorem() -> usize {
873 See also [`control_brace_style`](#control_brace_style).
875 ## `force_explicit_abi`
877 Always print the abi for extern items
879 - **Default value**: `true`
880 - **Possible values**: `true`, `false`
882 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
888 pub static lorem: c_int;
896 pub static lorem: c_int;
900 ## `force_format_strings`
902 Always format string literals
904 - **Default value**: `false`
905 - **Possible values**: `true`, `false`
907 See [`format_strings`](#format_strings).
909 See also [`max_width`](#max_width).
913 Format string literals where necessary
915 - **Default value**: `false`
916 - **Possible values**: `true`, `false`
921 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
928 "ipsum dolor sit amet consectetur \
929 adipiscing elit lorem ipsum dolor sit";
932 See also [`force_format_strings`](#force_format_strings), [`max_width`](#max_width).
936 Indentation of generics
938 - **Default value**: `"Block"`
939 - **Possible values**: `"Block"`, `"Visual"`
949 Adipiscing: Eq = usize,
950 Consectetur: Eq = usize,
957 adipiscing: Adipiscing,
958 consectetur: Consectetur,
968 fn lorem<Ipsum: Eq = usize,
972 Adipiscing: Eq = usize,
973 Consectetur: Eq = usize,
979 adipiscing: Adipiscing,
980 consectetur: Consectetur,
989 Use tab characters for indentation, spaces for alignment
991 - **Default value**: `false`
992 - **Possible values**: `true`, `false`
997 fn lorem() -> usize {
998 42 // spaces before 42
1005 fn lorem() -> usize {
1006 42 // tabs before 42
1010 See also: [`tab_spaces`](#tab_spaces).
1012 ## `impl_empty_single_line`
1014 Put empty-body implementations on a single line
1016 - **Default value**: `true`
1017 - **Possible values**: `true`, `false`
1032 See also [`item_brace_style`](#item_brace_style).
1034 ## `indent_match_arms`
1036 Indent match arms instead of keeping them at the same indentation level as the match keyword
1038 - **Default value**: `true`
1039 - **Possible values**: `true`, `false`
1063 See also: [`match_block_trailing_comma`](#match_block_trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1067 Indent style of imports
1069 - **Default Value**: `"Visual"`
1070 - **Possible values**: `"Block"`, `"Visual"`
1090 See also: [`imports_layout`](#imports_layout).
1094 Item layout inside a imports block
1096 - **Default value**: "Mixed"
1097 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1102 use foo::{xxx, yyy, zzz};
1104 use foo::{aaa, bbb, ccc,
1110 **Note**: This option forces to put everything on one line and may exceeds `max_width`.
1113 use foo::{xxx, yyy, zzz};
1115 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1118 #### `"HorizontalVertical"`
1121 use foo::{xxx, yyy, zzz};
1146 ## `item_brace_style`
1148 Brace style for structs and enums
1150 - **Default value**: `"SameLineWhere"`
1151 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
1153 #### `"AlwaysNextLine"`:
1168 #### `"PreferSameLine"`:
1181 #### `"SameLineWhere"`:
1195 ## `match_block_trailing_comma`
1197 Put a trailing comma after a block based match arm (non-block arms are not affected)
1199 - **Default value**: `false`
1200 - **Possible values**: `true`, `false`
1209 Lorem::Dolor => println!("dolor"),
1220 Lorem::Dolor => println!("dolor"),
1224 See also: [`indent_match_arms`](#indent_match_arms), [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1226 ## `match_pattern_separator_break_point`
1228 Put a match sub-patterns' separator (`|`) in front or back.
1230 - **Default value**: `"Back"`
1231 - **Possible values**: `"Back"`, `"Front"`
1255 | Variant::Tag6 => {}
1261 Maximum width of each line
1263 - **Default value**: `100`
1264 - **Possible values**: any positive integer
1266 See also [`error_on_line_overflow`](#error_on_line_overflow).
1270 Merge multiple derives into a single one.
1272 - **Default value**: `true`
1273 - **Possible values**: `true`, `false`
1278 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1285 #[derive(Eq, PartialEq)]
1287 #[derive(Copy, Clone)]
1291 ## `multiline_closure_forces_block`
1293 Force multiline closure bodies to be wrapped in a block
1295 - **Default value**: `false`
1296 - **Possible values**: `false`, `true`
1302 result.and_then(|maybe_value| {
1313 result.and_then(|maybe_value| match maybe_value {
1319 ## `multiline_match_arm_forces_block`
1321 Force multiline match arm bodies to be wrapped in a block
1323 - **Default value**: `false`
1324 - **Possible values**: `false`, `true`
1331 println!("Hello World");
1343 println!("Hello World");
1352 Unix or Windows line endings
1354 - **Default value**: `"Unix"`
1355 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1357 ## `normalize_comments`
1359 Convert /* */ comments to // comments where possible
1361 - **Default value**: `false`
1362 - **Possible values**: `true`, `false`
1368 fn dolor() -> usize {}
1371 fn adipiscing() -> usize {}
1378 fn dolor() -> usize {}
1381 fn adipiscing() -> usize {}
1384 ## `reorder_imported_names`
1386 Reorder lists of names in import statements alphabetically
1388 - **Default value**: `false`
1389 - **Possible values**: `true`, `false`
1394 use super::{lorem, ipsum, dolor, sit};
1400 use super::{dolor, ipsum, lorem, sit};
1403 See also [`reorder_imports`](#reorder_imports).
1405 ## `reorder_imports`
1407 Reorder import statements alphabetically
1409 - **Default value**: `false`
1410 - **Possible values**: `true`, `false`
1430 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1432 ## `reorder_imports_in_group`
1434 Reorder import statements in group
1436 - **Default value**: `false`
1437 - **Possible values**: `true`, `false`
1439 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1465 See also [`reorder_imports`](#reorder_imports).
1467 ## `single_line_if_else_max_width`
1469 Maximum line length for single line if-else expressions.
1471 - **Default value**: `50`
1472 - **Possible values**: any positive integer
1474 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1476 #### Lines shorter than `single_line_if_else_max_width`:
1478 let lorem = if ipsum { dolor } else { sit };
1481 #### Lines longer than `single_line_if_else_max_width`:
1483 let lorem = if ipsum {
1490 See also: [`control_brace_style`](#control_brace_style).
1494 Don't reformat out of line modules
1496 - **Default value**: `false`
1497 - **Possible values**: `true`, `false`
1499 ## `space_after_bound_colon`
1501 Leave a space after the colon in a trait or lifetime bound
1503 - **Default value**: `true`
1504 - **Possible values**: `true`, `false`
1509 fn lorem<T:Eq>(t: T) {
1517 fn lorem<T: Eq>(t: T) {
1522 See also: [`space_before_bound`](#space_before_bound).
1524 ## `struct_field_align_threshold`
1526 The maximum diff of width between struct fields to be aligned with each other.
1528 - **Default value** : 0
1529 - **Possible values**: any positive integer
1551 ## `space_after_struct_lit_field_colon`
1553 Leave a space after the colon in a struct literal field
1555 - **Default value**: `true`
1556 - **Possible values**: `true`, `false`
1576 See also: [`space_before_struct_lit_field_colon`](#space_before_struct_lit_field_colon).
1578 ## `space_after_type_annotation_colon`
1580 Leave a space after the colon in a type annotation
1582 - **Default value**: `true`
1583 - **Possible values**: `true`, `false`
1588 fn lorem<T: Eq>(t:T) {
1589 let ipsum:Dolor = sit;
1596 fn lorem<T: Eq>(t: T) {
1597 let ipsum: Dolor = sit;
1601 See also: [`space_before_type_annotation`](#space_before_type_annotation).
1603 ## `space_before_bound`
1605 Leave a space before the colon in a trait or lifetime bound
1607 - **Default value**: `false`
1608 - **Possible values**: `true`, `false`
1613 fn lorem<T: Eq>(t: T) {
1614 let ipsum: Dolor = sit;
1621 fn lorem<T : Eq>(t: T) {
1622 let ipsum: Dolor = sit;
1626 See also: [`space_after_bound_colon`](#space_after_bound_colon).
1628 ## `space_before_struct_lit_field_colon`
1630 Leave a space before the colon in a struct literal field
1632 - **Default value**: `false`
1633 - **Possible values**: `true`, `false`
1653 See also: [`space_after_struct_lit_field_colon`](#space_after_struct_lit_field_colon).
1655 ## `space_before_type_annotation`
1657 Leave a space before the colon in a type annotation
1659 - **Default value**: `false`
1660 - **Possible values**: `true`, `false`
1665 fn lorem<T: Eq>(t: T) {
1666 let ipsum: Dolor = sit;
1673 fn lorem<T: Eq>(t : T) {
1674 let ipsum : Dolor = sit;
1678 See also: [`space_after_type_annotation_colon`](#space_after_type_annotation_colon).
1680 ## `spaces_around_ranges`
1682 Put spaces around the .. and ... range operators
1684 - **Default value**: `false`
1685 - **Possible values**: `true`, `false`
1696 let lorem = 0 .. 10;
1699 ## `spaces_within_angle_brackets`
1701 Put spaces within non-empty generic arguments
1703 - **Default value**: `false`
1704 - **Possible values**: `true`, `false`
1709 fn lorem<T: Eq>(t: T) {
1717 fn lorem< T: Eq >(t: T) {
1722 See also: [`spaces_within_parens`](#spaces_within_parens), [`spaces_within_square_brackets`](#spaces_within_square_brackets).
1724 ## `spaces_within_parens`
1726 Put spaces within non-empty parentheses
1728 - **Default value**: `false`
1729 - **Possible values**: `true`, `false`
1734 fn lorem<T: Eq>(t: T) {
1735 let lorem = (ipsum, dolor);
1742 fn lorem<T: Eq>( t: T ) {
1743 let lorem = ( ipsum, dolor );
1747 See also: [`spaces_within_angle_brackets`](#spaces_within_angle_brackets), [`spaces_within_square_brackets`](#spaces_within_square_brackets).
1749 ## `spaces_within_square_brackets`
1751 Put spaces within non-empty square brackets
1753 - **Default value**: `false`
1754 - **Possible values**: `true`, `false`
1759 let lorem: [usize; 2] = [ipsum, dolor];
1765 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1768 See also: [`spaces_within_parens`](#spaces_within_parens), [`spaces_within_angle_brackets`](#spaces_within_angle_brackets).
1770 ## `struct_lit_multiline_style`
1772 Multiline style on literal structs
1774 - **Default value**: `"PreferSingle"`
1775 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1777 #### `"ForceMulti"`:
1786 #### `"PreferSingle"`:
1789 let lorem = Lorem { ipsum: dolor, sit: amet };
1792 See also: [`struct_lit_style`](#struct_lit_style), [`struct_lit_width`](#struct_lit_width).
1794 ## `struct_lit_style`
1796 Style of struct definition
1798 - **Default value**: `"Block"`
1799 - **Possible values**: `"Block"`, `"Visual"`
1813 let lorem = Lorem { ipsum: dolor,
1817 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1819 ## `struct_lit_width`
1821 Maximum width in the body of a struct lit before falling back to vertical formatting
1823 - **Default value**: `18`
1824 - **Possible values**: any positive integer
1826 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1828 #### Lines shorter than `struct_lit_width`:
1830 let lorem = Lorem { ipsum: dolor, sit: amet };
1833 #### Lines longer than `struct_lit_width`:
1834 See [`struct_lit_style`](#struct_lit_style).
1836 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1838 ## `struct_variant_width`
1840 Maximum width in the body of a struct variant before falling back to vertical formatting
1842 - **Default value**: `35`
1843 - **Possible values**: any positive integer
1845 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1847 #### Struct variants shorter than `struct_variant_width`:
1852 Sit { amet: Consectetur, adipiscing: Elit },
1856 #### Struct variants longer than `struct_variant_width`:
1870 Number of spaces per tab
1872 - **Default value**: `4`
1873 - **Possible values**: any positive integer
1879 let ipsum = dolor();
1881 "amet consectetur adipiscing elit."
1890 let ipsum = dolor();
1892 "amet consectetur adipiscing elit."
1897 See also: [`hard_tabs`](#hard_tabs).
1899 ## `take_source_hints`
1901 Retain some formatting characteristics from the source code
1903 - **Default value**: `false`
1904 - **Possible values**: `true`, `false`
1911 .dolor(|| { sit.amet().consectetur().adipiscing().elit(); });
1927 Note: This only applies if the call chain within the inner closure had already been formatted on separate lines before running rustfmt.
1931 How to handle trailing commas for lists
1933 - **Default value**: `"Vertical"`
1934 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1939 let Lorem { ipsum, dolor, sit, } = amet;
1953 let Lorem { ipsum, dolor, sit } = amet;
1967 let Lorem { ipsum, dolor, sit } = amet;
1978 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1980 ## `trailing_semicolon`
1982 Add trailing semicolon after break, continue and return
1984 - **Default value**: `true`
1985 - **Possible values**: `true`, `false`
2001 ## `type_punctuation_density`
2003 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
2005 - **Default value**: `"Wide"`
2006 - **Possible values**: `"Compressed"`, `"Wide"`
2008 #### `"Compressed"`:
2011 fn lorem<Ipsum: Dolor+Sit=Amet>() {
2019 fn lorem<Ipsum: Dolor + Sit = Amet>() {
2024 ## `use_try_shorthand`
2026 Replace uses of the try! macro by the ? shorthand
2028 - **Default value**: `false`
2029 - **Possible values**: `true`, `false`
2034 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
2040 let lorem = ipsum.map(|dolor| dolor.sit())?;
2045 Density of a where clause.
2047 - **Default value**: `"CompressedIfEmpty"`
2048 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
2050 #### `"Compressed"`:
2054 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2057 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2064 #### `"CompressedIfEmpty"`:
2068 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2071 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2084 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2088 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2097 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2103 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2106 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2114 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2116 See also: [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
2120 Element layout inside a where clause
2122 - **Default value**: `"Vertical"`
2123 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2125 #### `"Horizontal"`:
2128 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2129 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2134 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2135 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2141 #### `"HorizontalVertical"`:
2144 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2145 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2150 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2151 where Ipsum: IpsumDolorSitAmet,
2152 Dolor: DolorSitAmetConsectetur,
2153 Sit: SitAmetConsecteturAdipiscing,
2154 Amet: AmetConsecteturAdipiscingElit
2163 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2164 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2169 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2170 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2171 Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2180 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2181 where Ipsum: IpsumDolorSitAmet,
2182 Dolor: DolorSitAmetConsectetur
2187 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2188 where Ipsum: IpsumDolorSitAmet,
2189 Dolor: DolorSitAmetConsectetur,
2190 Sit: SitAmetConsecteturAdipiscing,
2191 Amet: AmetConsecteturAdipiscingElit
2197 **Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
2199 See also: [`where_density`](#where_density), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
2201 ## `where_pred_indent`
2203 Indentation style of a where predicate
2205 - **Default value**: `"Visual"`
2206 - **Possible values**: `"Block"`, `"Visual"`
2211 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2224 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2234 **Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
2236 See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_style`](#where_style).
2240 Overall strategy for where clauses
2242 - **Default value**: `"Rfc"`
2243 - **Possible values**: `"Rfc"`, `"Legacy"`
2248 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2262 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2272 See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent).
2276 Break comments to fit on the line
2278 - **Default value**: `false`
2279 - **Possible values**: `true`, `false`
2284 // Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
2290 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2291 // sed do eiusmod tempor incididunt ut labore et dolore
2292 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2293 // exercitation ullamco laboris nisi ut aliquip ex ea
2294 // commodo consequat.
2297 ## `wrap_match_arms`
2299 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2301 - **Default value**: `true`
2302 - **Possible values**: `true`, `false`
2309 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2310 false => println!("{}", sit),
2319 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2321 false => println!("{}", sit),
2325 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2329 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2331 - **Default value**: `"Overwrite"`
2332 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`