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 [`indent_style`](#indent_style) 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.
55 Indent on expressions or items.
57 - **Default value**: `"Block"`
58 - **Possible values**: `"Block"`, `"Visual"`
62 #### `"Block"` (default):
79 let lorem = vec!["ipsum",
90 #### `"Block"` (default):
111 See also: [`control_brace_style`](#control_brace_style).
113 ### Function arguments
115 #### `"Block"` (default):
120 fn lorem(ipsum: usize) {}
140 fn lorem(ipsum: usize) {}
142 fn lorem(ipsum: usize,
155 #### `"Block"` (default):
185 #### `"Block"` (default):
193 Adipiscing: Eq = usize,
194 Consectetur: Eq = usize,
201 adipiscing: Adipiscing,
202 consectetur: Consectetur,
212 fn lorem<Ipsum: Eq = usize,
216 Adipiscing: Eq = usize,
217 Consectetur: Eq = usize,
223 adipiscing: Adipiscing,
224 consectetur: Consectetur,
233 #### `"Block"` (default):
245 let lorem = Lorem { ipsum: dolor,
249 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style).
253 #### `"Block"` (default):
256 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
270 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
280 See also: [`where_density`](#where_density), [`where_layout`](#where_layout).
284 Maximum width of an array literal before falling back to vertical formatting
286 - **Default value**: `60`
287 - **Possible values**: any positive integer
289 **Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width.
291 #### Lines shorter than `array_width`:
293 let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"];
296 #### Lines longer than `array_width`:
297 See [`indent_style`](#indent_style).
299 ## `attributes_on_same_line_as_field`
301 Try to put attributes on the same line as fields
303 - **Default value**: `true`
304 - **Possible values**: `true`, `false`
306 #### `true` (default):
310 #[serde(rename = "Ipsum")] ipsum: usize,
311 #[serde(rename = "Dolor")] dolor: usize,
312 #[serde(rename = "Amet")] amet: usize,
320 #[serde(rename = "Ipsum")]
322 #[serde(rename = "Dolor")]
324 #[serde(rename = "Amet")]
329 ## `attributes_on_same_line_as_variant`
331 Try to put attributes on the same line as variants
333 - **Default value**: `true`
334 - **Possible values**: `true`, `false`
336 #### `true` (default):
340 #[serde(skip_serializing)] Ipsum,
341 #[serde(skip_serializing)] Dolor,
342 #[serde(skip_serializing)] Amet,
350 #[serde(skip_serializing)]
352 #[serde(skip_serializing)]
354 #[serde(skip_serializing)]
361 Where to put a binary operator when a binary expression goes multiline.
363 - **Default value**: `"Front"`
364 - **Possible values**: `"Front"`, `"Back"`
366 #### `"Front"` (default):
377 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
378 ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
392 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..
393 bbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
400 - **Default value**: `"Block"`
401 - **Possible values**: `"Block"`, `"Visual"`
403 #### `"Block"` (default):
418 let lorem = ipsum.dolor()
426 See also [`chain_width`](#chain_width).
430 Maximum length of a chain to fit on a single line
432 - **Default value**: `60`
433 - **Possible values**: any positive integer
435 #### Lines shorter than `chain_width`:
437 let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit();
440 #### Lines longer than `chain_width`:
441 See [`chain_indent`](#chain_indent).
443 ## `chain_split_single_child`
445 Split a chain with a single child if its length exceeds [`chain_width`](#chain_width).
447 - **Default value**: `false`
448 - **Possible values**: `false`, `true`
450 #### `false` (default):
453 let files = fs::read_dir("tests/coverage/source").expect("Couldn't read source dir");
459 let files = fs::read_dir("tests/coverage/source")
460 .expect("Couldn't read source dir");
463 See also [`chain_width`](#chain_width).
465 ## `combine_control_expr`
467 Combine control expressions with function calls.
469 - **Default value**: `true`
470 - **Possible values**: `true`, `false`
472 #### `true` (default):
484 foo!(if let Some(..) = x {
497 foo!(while let Some(..) = x {
531 if let Some(..) = x {
548 while let Some(..) = x {
574 Maximum length of comments. No effect unless`wrap_comments = true`.
576 - **Default value**: `80`
577 - **Possible values**: any positive integer
579 **Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
581 #### Comments shorter than `comment_width`:
583 // Lorem ipsum dolor sit amet, consectetur adipiscing elit.
586 #### Comments longer than `comment_width`:
588 // Lorem ipsum dolor sit amet,
589 // consectetur adipiscing elit.
592 See also [`wrap_comments`](#wrap_comments).
594 ## `condense_wildcard_suffixes`
596 Replace strings of _ wildcards by a single .. in tuple patterns
598 - **Default value**: `false`
599 - **Possible values**: `true`, `false`
601 #### `false` (default):
604 let (lorem, ipsum, _, _) = (1, 2, 3, 4);
610 let (lorem, ipsum, ..) = (1, 2, 3, 4);
613 ## `control_brace_style`
615 Brace style for control flow constructs
617 - **Default value**: `"AlwaysSameLine"`
618 - **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
620 #### `"AlwaysSameLine"` (default):
630 #### `"AlwaysNextLine"`:
643 #### `"ClosingNextLine"`:
654 ## `disable_all_formatting`
656 Don't reformat anything
658 - **Default value**: `false`
659 - **Possible values**: `true`, `false`
661 ## `error_on_line_overflow`
663 Error if unable to get all lines within `max_width`
665 - **Default value**: `true`
666 - **Possible values**: `true`, `false`
668 See also [`max_width`](#max_width).
670 ## `error_on_line_overflow_comments`
672 Error if unable to get all comment lines within `comment_width`.
674 - **Default value**: `true`
675 - **Possible values**: `true`, `false`
677 See also [`comment_width`](#comment_width).
681 Argument density in functions
683 - **Default value**: `"Tall"`
684 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
686 #### `"Tall"` (default):
690 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
692 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
701 consectetur: Consectetur,
702 adipiscing: Adipiscing,
711 consectetur: Consectetur,
712 adipiscing: Adipiscing,
724 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
726 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
731 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
732 adipiscing: Adipiscing, elit: Elit,
736 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
737 adipiscing: Adipiscing, elit: Elit,
744 #### `"CompressedIfEmpty"`:
748 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
750 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
755 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
756 adipiscing: Adipiscing, elit: Elit,
764 consectetur: Consectetur,
765 adipiscing: Adipiscing,
777 fn lorem(ipsum: Ipsum,
782 fn lorem(ipsum: Ipsum,
789 fn lorem(ipsum: Ipsum,
793 consectetur: Consectetur,
794 adipiscing: Adipiscing,
797 fn lorem(ipsum: Ipsum,
801 consectetur: Consectetur,
802 adipiscing: Adipiscing,
809 ## `fn_args_paren_newline`
811 If function argument parenthesis goes on a newline
813 - **Default value**: `false`
814 - **Possible values**: `true`, `false`
816 #### `false` (default):
824 ) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit {
838 ) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit {
845 Brace style for items
847 - **Default value**: `"SameLineWhere"`
848 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
852 #### `"SameLineWhere"` (default):
859 fn lorem(ipsum: usize) {
863 fn lorem<T>(ipsum: T)
865 T: Add + Sub + Mul + Div,
871 #### `"AlwaysNextLine"`:
879 fn lorem(ipsum: usize)
884 fn lorem<T>(ipsum: T)
886 T: Add + Sub + Mul + Div,
892 #### `"PreferSameLine"`:
899 fn lorem(ipsum: usize) {
903 fn lorem<T>(ipsum: T)
905 T: Add + Sub + Mul + Div, {
910 ### Structs and enums
912 #### `"SameLineWhere"` (default):
926 #### `"AlwaysNextLine"`:
941 #### `"PreferSameLine"`:
956 Maximum width of the args of a function call before falling back to vertical formatting
958 - **Default value**: `60`
959 - **Possible values**: any positive integer
961 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
963 #### Function call shorter than `fn_call_width`:
965 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
968 #### Function call longer than `fn_call_width`:
970 See [`indent_style`](#indent_style).
972 ## `fn_empty_single_line`
974 Put empty-body functions on a single line
976 - **Default value**: `true`
977 - **Possible values**: `true`, `false`
979 #### `true` (default):
992 See also [`control_brace_style`](#control_brace_style).
997 Put single-expression functions on a single line
999 - **Default value**: `false`
1000 - **Possible values**: `true`, `false`
1002 #### `false` (default):
1005 fn lorem() -> usize {
1009 fn lorem() -> usize {
1018 fn lorem() -> usize { 42 }
1020 fn lorem() -> usize {
1026 See also [`control_brace_style`](#control_brace_style).
1028 ## `force_explicit_abi`
1030 Always print the abi for extern items
1032 - **Default value**: `true`
1033 - **Possible values**: `true`, `false`
1035 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
1037 #### `true` (default):
1041 pub static lorem: c_int;
1049 pub static lorem: c_int;
1053 ## `force_format_strings`
1055 Always format string literals
1057 - **Default value**: `false`
1058 - **Possible values**: `true`, `false`
1060 See [`format_strings`](#format_strings).
1062 See also [`max_width`](#max_width).
1066 Format string literals where necessary
1068 - **Default value**: `false`
1069 - **Possible values**: `true`, `false`
1071 #### `false` (default):
1074 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
1081 "ipsum dolor sit amet consectetur \
1082 adipiscing elit lorem ipsum dolor sit";
1085 See also [`force_format_strings`](#force_format_strings), [`max_width`](#max_width).
1089 Use tab characters for indentation, spaces for alignment
1091 - **Default value**: `false`
1092 - **Possible values**: `true`, `false`
1094 #### `false` (default):
1097 fn lorem() -> usize {
1098 42 // spaces before 42
1105 fn lorem() -> usize {
1106 42 // tabs before 42
1110 See also: [`tab_spaces`](#tab_spaces).
1112 ## `impl_empty_single_line`
1114 Put empty-body implementations on a single line
1116 - **Default value**: `true`
1117 - **Possible values**: `true`, `false`
1119 #### `true` (default):
1132 See also [`brace_style`](#brace_style).
1134 ## `indent_match_arms`
1136 Indent match arms instead of keeping them at the same indentation level as the match keyword
1138 - **Default value**: `true`
1139 - **Possible values**: `true`, `false`
1141 #### `true` (default):
1163 See also: [`match_block_trailing_comma`](#match_block_trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1167 Indent style of imports
1169 - **Default Value**: `"Visual"`
1170 - **Possible values**: `"Block"`, `"Visual"`
1172 #### `"Visual"` (default):
1190 See also: [`imports_layout`](#imports_layout).
1194 Item layout inside a imports block
1196 - **Default value**: "Mixed"
1197 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1199 #### `"Mixed"` (default):
1202 use foo::{xxx, yyy, zzz};
1204 use foo::{aaa, bbb, ccc,
1208 #### `"Horizontal"`:
1210 **Note**: This option forces to put everything on one line and may exceeds `max_width`.
1213 use foo::{xxx, yyy, zzz};
1215 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1218 #### `"HorizontalVertical"`:
1221 use foo::{xxx, yyy, zzz};
1246 ## `match_arm_forces_newline`
1248 Consistently put match arms (block based or not) in a newline.
1250 - **Default value**: `false`
1251 - **Possible values**: `true`, `false`
1253 #### `false` (default):
1257 // a non-empty block
1264 X2 => println!("ok"),
1272 // a non-empty block
1286 See also: [`wrap_match_arms`](#wrap_match_arms).
1288 ## `match_block_trailing_comma`
1290 Put a trailing comma after a block based match arm (non-block arms are not affected)
1292 - **Default value**: `false`
1293 - **Possible values**: `true`, `false`
1295 #### `false` (default):
1302 Lorem::Dolor => println!("dolor"),
1313 Lorem::Dolor => println!("dolor"),
1317 See also: [`indent_match_arms`](#indent_match_arms), [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1319 ## `match_pattern_separator_break_point`
1321 Put a match sub-patterns' separator (`|`) in front or back.
1323 - **Default value**: `"Back"`
1324 - **Possible values**: `"Back"`, `"Front"`
1326 #### `"Back"` (default):
1348 | Variant::Tag6 => {}
1354 Maximum width of each line
1356 - **Default value**: `100`
1357 - **Possible values**: any positive integer
1359 See also [`error_on_line_overflow`](#error_on_line_overflow).
1363 Merge multiple derives into a single one.
1365 - **Default value**: `true`
1366 - **Possible values**: `true`, `false`
1368 #### `true` (default):
1371 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1378 #[derive(Eq, PartialEq)]
1380 #[derive(Copy, Clone)]
1384 ## `multiline_closure_forces_block`
1386 Force multiline closure bodies to be wrapped in a block
1388 - **Default value**: `false`
1389 - **Possible values**: `false`, `true`
1391 #### `false` (default):
1394 result.and_then(|maybe_value| match maybe_value {
1404 result.and_then(|maybe_value| {
1412 ## `multiline_match_arm_forces_block`
1414 Force multiline match arm bodies to be wrapped in a block
1416 - **Default value**: `false`
1417 - **Possible values**: `false`, `true`
1419 #### `false` (default):
1424 println!("Hello World");
1436 println!("Hello World");
1445 Unix or Windows line endings
1447 - **Default value**: `"Unix"`
1448 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1450 ## `normalize_comments`
1452 Convert /* */ comments to // comments where possible
1454 - **Default value**: `false`
1455 - **Possible values**: `true`, `false`
1457 #### `false` (default):
1461 fn dolor() -> usize {}
1464 fn adipiscing() -> usize {}
1471 fn dolor() -> usize {}
1474 fn adipiscing() -> usize {}
1477 ## `reorder_imported_names`
1479 Reorder lists of names in import statements alphabetically
1481 - **Default value**: `false`
1482 - **Possible values**: `true`, `false`
1484 #### `false` (default):
1487 use super::{lorem, ipsum, dolor, sit};
1493 use super::{dolor, ipsum, lorem, sit};
1496 See also [`reorder_imports`](#reorder_imports).
1498 ## `reorder_imports`
1500 Reorder import statements alphabetically
1502 - **Default value**: `false`
1503 - **Possible values**: `true`, `false`
1505 #### `false` (default):
1523 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1525 ## `reorder_imports_in_group`
1527 Reorder import statements in group
1529 - **Default value**: `false`
1530 - **Possible values**: `true`, `false`
1532 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1534 #### `false` (default):
1558 See also [`reorder_imports`](#reorder_imports).
1560 ## `reorder_extern_crates`
1562 Reorder `extern crate` statements alphabetically
1564 - **Default value**: `true`
1565 - **Possible values**: `true`, `false`
1567 #### `true` (default):
1585 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1587 ## `reorder_extern_crates_in_group`
1589 Reorder `extern crate` statements in group
1591 - **Default value**: `true`
1592 - **Possible values**: `true`, `false`
1594 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1596 #### `true` (default):
1620 See also [`reorder_extern_crates`](#reorder_extern_crates).
1624 Report `TODO` items in comments.
1626 - **Default value**: `"Never"`
1627 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1629 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1630 it contains a `#X` (with `X` being a number) in parentheses following the
1631 `TODO`, `"Unnumbered"` will ignore it.
1633 See also [`report_fixme`](#report_fixme).
1637 Report `FIXME` items in comments.
1639 - **Default value**: `"Never"`
1640 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1642 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1643 it contains a `#X` (with `X` being a number) in parentheses following the
1644 `FIXME`, `"Unnumbered"` will ignore it.
1646 See also [`report_todo`](#report_todo).
1648 ## `single_line_if_else_max_width`
1650 Maximum line length for single line if-else expressions.
1652 - **Default value**: `50`
1653 - **Possible values**: any positive integer
1655 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1657 #### Lines shorter than `single_line_if_else_max_width`:
1659 let lorem = if ipsum { dolor } else { sit };
1662 #### Lines longer than `single_line_if_else_max_width`:
1664 let lorem = if ipsum {
1671 See also: [`control_brace_style`](#control_brace_style).
1675 Don't reformat out of line modules
1677 - **Default value**: `false`
1678 - **Possible values**: `true`, `false`
1680 ## `space_after_colon`
1682 Leave a space after the colon.
1684 - **Default value**: `true`
1685 - **Possible values**: `true`, `false`
1687 #### `true` (default):
1690 fn lorem<T: Eq>(t: T) {
1691 let lorem: Dolor = Lorem {
1701 fn lorem<T:Eq>(t:T) {
1702 let lorem:Dolor = Lorem {
1709 See also: [`space_before_colon`](#space_before_colon).
1711 ## `space_before_colon`
1713 Leave a space before the colon.
1715 - **Default value**: `false`
1716 - **Possible values**: `true`, `false`
1718 #### `false` (default):
1721 fn lorem<T: Eq>(t: T) {
1722 let lorem: Dolor = Lorem {
1732 fn lorem<T : Eq>(t : T) {
1733 let lorem : Dolor = Lorem {
1740 See also: [`space_after_colon`](#space_after_colon).
1742 ## `struct_field_align_threshold`
1744 The maximum diff of width between struct fields to be aligned with each other.
1746 - **Default value** : 0
1747 - **Possible values**: any positive integer
1771 ## `spaces_around_ranges`
1773 Put spaces around the .. and ... range operators
1775 - **Default value**: `false`
1776 - **Possible values**: `true`, `false`
1778 #### `false` (default):
1787 let lorem = 0 .. 10;
1790 ## `spaces_within_parens_and_brackets`
1792 Put spaces within non-empty generic arguments
1794 - **Default value**: `false`
1795 - **Possible values**: `true`, `false`
1797 #### `false` (default):
1800 fn lorem<T: Eq>(t: T) {
1808 fn lorem< T: Eq >(t: T) {
1813 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1815 ## `spaces_within_parens_and_brackets`
1817 Put spaces within non-empty parentheses
1819 - **Default value**: `false`
1820 - **Possible values**: `true`, `false`
1822 #### `false` (default):
1825 fn lorem<T: Eq>(t: T) {
1826 let lorem = (ipsum, dolor);
1833 fn lorem<T: Eq>( t: T ) {
1834 let lorem = ( ipsum, dolor );
1838 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1840 ## `spaces_within_parens_and_brackets`
1842 Put spaces within non-empty square brackets
1844 - **Default value**: `false`
1845 - **Possible values**: `true`, `false`
1847 #### `false` (default):
1850 let lorem: [usize; 2] = [ipsum, dolor];
1856 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1859 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1861 ## `struct_lit_multiline_style`
1863 Multiline style on literal structs
1865 - **Default value**: `"PreferSingle"`
1866 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1868 #### `"PreferSingle"` (default):
1871 let lorem = Lorem { ipsum: dolor, sit: amet };
1874 #### `"ForceMulti"`:
1883 See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width).
1885 ## `struct_lit_width`
1887 Maximum width in the body of a struct lit before falling back to vertical formatting
1889 - **Default value**: `18`
1890 - **Possible values**: any positive integer
1892 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1894 #### Lines shorter than `struct_lit_width`:
1896 let lorem = Lorem { ipsum: dolor, sit: amet };
1899 #### Lines longer than `struct_lit_width`:
1900 See [`indent_style`](#indent_style).
1902 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style).
1904 ## `struct_variant_width`
1906 Maximum width in the body of a struct variant before falling back to vertical formatting
1908 - **Default value**: `35`
1909 - **Possible values**: any positive integer
1911 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1913 #### Struct variants shorter than `struct_variant_width`:
1918 Sit { amet: Consectetur, adipiscing: Elit },
1922 #### Struct variants longer than `struct_variant_width`:
1936 Number of spaces per tab
1938 - **Default value**: `4`
1939 - **Possible values**: any positive integer
1945 let ipsum = dolor();
1947 "amet consectetur adipiscing elit."
1956 let ipsum = dolor();
1958 "amet consectetur adipiscing elit."
1963 See also: [`hard_tabs`](#hard_tabs).
1968 How to handle trailing commas for lists
1970 - **Default value**: `"Vertical"`
1971 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1973 #### `"Vertical"` (default):
1976 let Lorem { ipsum, dolor, sit } = amet;
1990 let Lorem { ipsum, dolor, sit, } = amet;
2004 let Lorem { ipsum, dolor, sit } = amet;
2015 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
2017 ## `trailing_semicolon`
2019 Add trailing semicolon after break, continue and return
2021 - **Default value**: `true`
2022 - **Possible values**: `true`, `false`
2024 #### `true` (default):
2038 ## `type_punctuation_density`
2040 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
2042 - **Default value**: `"Wide"`
2043 - **Possible values**: `"Compressed"`, `"Wide"`
2045 #### `"Wide"` (default):
2048 fn lorem<Ipsum: Dolor + Sit = Amet>() {
2053 #### `"Compressed"`:
2056 fn lorem<Ipsum: Dolor+Sit=Amet>() {
2061 ## `use_try_shorthand`
2063 Replace uses of the try! macro by the ? shorthand
2065 - **Default value**: `false`
2066 - **Possible values**: `true`, `false`
2068 #### `false` (default):
2071 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
2077 let lorem = ipsum.map(|dolor| dolor.sit())?;
2082 Density of a where clause.
2084 - **Default value**: `"Vertical"`
2085 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
2087 #### `"Vertical"` (default):
2091 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2095 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2104 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2106 #### `"CompressedIfEmpty"`:
2110 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2113 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2122 #### `"Compressed"`:
2126 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2129 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2140 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2144 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2153 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2155 See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style).
2159 Element layout inside a where clause
2161 - **Default value**: `"Vertical"`
2162 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2164 #### `"Vertical"` (default):
2167 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2168 where Ipsum: IpsumDolorSitAmet,
2169 Dolor: DolorSitAmetConsectetur
2174 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2175 where Ipsum: IpsumDolorSitAmet,
2176 Dolor: DolorSitAmetConsectetur,
2177 Sit: SitAmetConsecteturAdipiscing,
2178 Amet: AmetConsecteturAdipiscingElit
2184 #### `"Horizontal"`:
2187 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2188 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2193 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2194 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2200 #### `"HorizontalVertical"`:
2203 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2204 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2209 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2210 where Ipsum: IpsumDolorSitAmet,
2211 Dolor: DolorSitAmetConsectetur,
2212 Sit: SitAmetConsecteturAdipiscing,
2213 Amet: AmetConsecteturAdipiscingElit
2222 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2223 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2228 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2229 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2230 Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2236 See also: [`where_density`](#where_density), [`indent_style`](#indent_style).
2240 Break comments to fit on the line
2242 - **Default value**: `false`
2243 - **Possible values**: `true`, `false`
2245 #### `false` (default):
2248 // 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.
2254 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2255 // sed do eiusmod tempor incididunt ut labore et dolore
2256 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2257 // exercitation ullamco laboris nisi ut aliquip ex ea
2258 // commodo consequat.
2261 ## `wrap_match_arms`
2263 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2265 - **Default value**: `true`
2266 - **Possible values**: `true`, `false`
2268 #### `true` (default):
2273 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2275 false => println!("{}", sit),
2284 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2285 false => println!("{}", sit),
2289 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2293 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2295 - **Default value**: `"Overwrite"`
2296 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`