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,
812 Brace style for items
814 - **Default value**: `"SameLineWhere"`
815 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
819 #### `"SameLineWhere"` (default):
826 fn lorem(ipsum: usize) {
830 fn lorem<T>(ipsum: T)
832 T: Add + Sub + Mul + Div,
838 #### `"AlwaysNextLine"`:
846 fn lorem(ipsum: usize)
851 fn lorem<T>(ipsum: T)
853 T: Add + Sub + Mul + Div,
859 #### `"PreferSameLine"`:
866 fn lorem(ipsum: usize) {
870 fn lorem<T>(ipsum: T)
872 T: Add + Sub + Mul + Div, {
877 ### Structs and enums
879 #### `"SameLineWhere"` (default):
893 #### `"AlwaysNextLine"`:
908 #### `"PreferSameLine"`:
923 Maximum width of the args of a function call before falling back to vertical formatting
925 - **Default value**: `60`
926 - **Possible values**: any positive integer
928 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
930 #### Function call shorter than `fn_call_width`:
932 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
935 #### Function call longer than `fn_call_width`:
937 See [`indent_style`](#indent_style).
939 ## `fn_empty_single_line`
941 Put empty-body functions on a single line
943 - **Default value**: `true`
944 - **Possible values**: `true`, `false`
946 #### `true` (default):
959 See also [`control_brace_style`](#control_brace_style).
964 Put single-expression functions on a single line
966 - **Default value**: `false`
967 - **Possible values**: `true`, `false`
969 #### `false` (default):
972 fn lorem() -> usize {
976 fn lorem() -> usize {
985 fn lorem() -> usize { 42 }
987 fn lorem() -> usize {
993 See also [`control_brace_style`](#control_brace_style).
995 ## `force_explicit_abi`
997 Always print the abi for extern items
999 - **Default value**: `true`
1000 - **Possible values**: `true`, `false`
1002 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
1004 #### `true` (default):
1008 pub static lorem: c_int;
1016 pub static lorem: c_int;
1020 ## `force_format_strings`
1022 Always format string literals
1024 - **Default value**: `false`
1025 - **Possible values**: `true`, `false`
1027 See [`format_strings`](#format_strings).
1029 See also [`max_width`](#max_width).
1033 Format string literals where necessary
1035 - **Default value**: `false`
1036 - **Possible values**: `true`, `false`
1038 #### `false` (default):
1041 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
1048 "ipsum dolor sit amet consectetur \
1049 adipiscing elit lorem ipsum dolor sit";
1052 See also [`force_format_strings`](#force_format_strings), [`max_width`](#max_width).
1056 Use tab characters for indentation, spaces for alignment
1058 - **Default value**: `false`
1059 - **Possible values**: `true`, `false`
1061 #### `false` (default):
1064 fn lorem() -> usize {
1065 42 // spaces before 42
1072 fn lorem() -> usize {
1073 42 // tabs before 42
1077 See also: [`tab_spaces`](#tab_spaces).
1079 ## `impl_empty_single_line`
1081 Put empty-body implementations on a single line
1083 - **Default value**: `true`
1084 - **Possible values**: `true`, `false`
1086 #### `true` (default):
1099 See also [`brace_style`](#brace_style).
1101 ## `indent_match_arms`
1103 Indent match arms instead of keeping them at the same indentation level as the match keyword
1105 - **Default value**: `true`
1106 - **Possible values**: `true`, `false`
1108 #### `true` (default):
1130 See also: [`match_block_trailing_comma`](#match_block_trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1134 Indent style of imports
1136 - **Default Value**: `"Visual"`
1137 - **Possible values**: `"Block"`, `"Visual"`
1139 #### `"Visual"` (default):
1157 See also: [`imports_layout`](#imports_layout).
1161 Item layout inside a imports block
1163 - **Default value**: "Mixed"
1164 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1166 #### `"Mixed"` (default):
1169 use foo::{xxx, yyy, zzz};
1171 use foo::{aaa, bbb, ccc,
1175 #### `"Horizontal"`:
1177 **Note**: This option forces to put everything on one line and may exceeds `max_width`.
1180 use foo::{xxx, yyy, zzz};
1182 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1185 #### `"HorizontalVertical"`:
1188 use foo::{xxx, yyy, zzz};
1213 ## `match_arm_forces_newline`
1215 Consistently put match arms (block based or not) in a newline.
1217 - **Default value**: `false`
1218 - **Possible values**: `true`, `false`
1220 #### `false` (default):
1224 // a non-empty block
1231 X2 => println!("ok"),
1239 // a non-empty block
1253 See also: [`wrap_match_arms`](#wrap_match_arms).
1255 ## `match_block_trailing_comma`
1257 Put a trailing comma after a block based match arm (non-block arms are not affected)
1259 - **Default value**: `false`
1260 - **Possible values**: `true`, `false`
1262 #### `false` (default):
1269 Lorem::Dolor => println!("dolor"),
1280 Lorem::Dolor => println!("dolor"),
1284 See also: [`indent_match_arms`](#indent_match_arms), [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1286 ## `match_pattern_separator_break_point`
1288 Put a match sub-patterns' separator (`|`) in front or back.
1290 - **Default value**: `"Back"`
1291 - **Possible values**: `"Back"`, `"Front"`
1293 #### `"Back"` (default):
1315 | Variant::Tag6 => {}
1321 Maximum width of each line
1323 - **Default value**: `100`
1324 - **Possible values**: any positive integer
1326 See also [`error_on_line_overflow`](#error_on_line_overflow).
1330 Merge multiple derives into a single one.
1332 - **Default value**: `true`
1333 - **Possible values**: `true`, `false`
1335 #### `true` (default):
1338 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1345 #[derive(Eq, PartialEq)]
1347 #[derive(Copy, Clone)]
1351 ## `multiline_closure_forces_block`
1353 Force multiline closure bodies to be wrapped in a block
1355 - **Default value**: `false`
1356 - **Possible values**: `false`, `true`
1358 #### `false` (default):
1361 result.and_then(|maybe_value| match maybe_value {
1371 result.and_then(|maybe_value| {
1379 ## `multiline_match_arm_forces_block`
1381 Force multiline match arm bodies to be wrapped in a block
1383 - **Default value**: `false`
1384 - **Possible values**: `false`, `true`
1386 #### `false` (default):
1391 println!("Hello World");
1403 println!("Hello World");
1412 Unix or Windows line endings
1414 - **Default value**: `"Unix"`
1415 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1417 ## `normalize_comments`
1419 Convert /* */ comments to // comments where possible
1421 - **Default value**: `false`
1422 - **Possible values**: `true`, `false`
1424 #### `false` (default):
1428 fn dolor() -> usize {}
1431 fn adipiscing() -> usize {}
1438 fn dolor() -> usize {}
1441 fn adipiscing() -> usize {}
1444 ## `reorder_imported_names`
1446 Reorder lists of names in import statements alphabetically
1448 - **Default value**: `false`
1449 - **Possible values**: `true`, `false`
1451 #### `false` (default):
1454 use super::{lorem, ipsum, dolor, sit};
1460 use super::{dolor, ipsum, lorem, sit};
1463 See also [`reorder_imports`](#reorder_imports).
1465 ## `reorder_imports`
1467 Reorder import statements alphabetically
1469 - **Default value**: `false`
1470 - **Possible values**: `true`, `false`
1472 #### `false` (default):
1490 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1492 ## `reorder_imports_in_group`
1494 Reorder import statements in group
1496 - **Default value**: `false`
1497 - **Possible values**: `true`, `false`
1499 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1501 #### `false` (default):
1525 See also [`reorder_imports`](#reorder_imports).
1527 ## `reorder_extern_crates`
1529 Reorder `extern crate` statements alphabetically
1531 - **Default value**: `true`
1532 - **Possible values**: `true`, `false`
1534 #### `true` (default):
1552 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1554 ## `reorder_extern_crates_in_group`
1556 Reorder `extern crate` statements in group
1558 - **Default value**: `true`
1559 - **Possible values**: `true`, `false`
1561 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1563 #### `true` (default):
1587 See also [`reorder_extern_crates`](#reorder_extern_crates).
1591 Report `TODO` items in comments.
1593 - **Default value**: `"Never"`
1594 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1596 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1597 it contains a `#X` (with `X` being a number) in parentheses following the
1598 `TODO`, `"Unnumbered"` will ignore it.
1600 See also [`report_fixme`](#report_fixme).
1604 Report `FIXME` items in comments.
1606 - **Default value**: `"Never"`
1607 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1609 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1610 it contains a `#X` (with `X` being a number) in parentheses following the
1611 `FIXME`, `"Unnumbered"` will ignore it.
1613 See also [`report_todo`](#report_todo).
1615 ## `single_line_if_else_max_width`
1617 Maximum line length for single line if-else expressions.
1619 - **Default value**: `50`
1620 - **Possible values**: any positive integer
1622 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1624 #### Lines shorter than `single_line_if_else_max_width`:
1626 let lorem = if ipsum { dolor } else { sit };
1629 #### Lines longer than `single_line_if_else_max_width`:
1631 let lorem = if ipsum {
1638 See also: [`control_brace_style`](#control_brace_style).
1642 Don't reformat out of line modules
1644 - **Default value**: `false`
1645 - **Possible values**: `true`, `false`
1647 ## `space_after_colon`
1649 Leave a space after the colon.
1651 - **Default value**: `true`
1652 - **Possible values**: `true`, `false`
1654 #### `true` (default):
1657 fn lorem<T: Eq>(t: T) {
1658 let lorem: Dolor = Lorem {
1668 fn lorem<T:Eq>(t:T) {
1669 let lorem:Dolor = Lorem {
1676 See also: [`space_before_colon`](#space_before_colon).
1678 ## `space_before_colon`
1680 Leave a space before the colon.
1682 - **Default value**: `false`
1683 - **Possible values**: `true`, `false`
1685 #### `false` (default):
1688 fn lorem<T: Eq>(t: T) {
1689 let lorem: Dolor = Lorem {
1699 fn lorem<T : Eq>(t : T) {
1700 let lorem : Dolor = Lorem {
1707 See also: [`space_after_colon`](#space_after_colon).
1709 ## `struct_field_align_threshold`
1711 The maximum diff of width between struct fields to be aligned with each other.
1713 - **Default value** : 0
1714 - **Possible values**: any positive integer
1738 ## `spaces_around_ranges`
1740 Put spaces around the .. and ... range operators
1742 - **Default value**: `false`
1743 - **Possible values**: `true`, `false`
1745 #### `false` (default):
1754 let lorem = 0 .. 10;
1757 ## `spaces_within_parens_and_brackets`
1759 Put spaces within non-empty generic arguments
1761 - **Default value**: `false`
1762 - **Possible values**: `true`, `false`
1764 #### `false` (default):
1767 fn lorem<T: Eq>(t: T) {
1775 fn lorem< T: Eq >(t: T) {
1780 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1782 ## `spaces_within_parens_and_brackets`
1784 Put spaces within non-empty parentheses
1786 - **Default value**: `false`
1787 - **Possible values**: `true`, `false`
1789 #### `false` (default):
1792 fn lorem<T: Eq>(t: T) {
1793 let lorem = (ipsum, dolor);
1800 fn lorem<T: Eq>( t: T ) {
1801 let lorem = ( ipsum, dolor );
1805 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1807 ## `spaces_within_parens_and_brackets`
1809 Put spaces within non-empty square brackets
1811 - **Default value**: `false`
1812 - **Possible values**: `true`, `false`
1814 #### `false` (default):
1817 let lorem: [usize; 2] = [ipsum, dolor];
1823 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1826 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1828 ## `struct_lit_multiline_style`
1830 Multiline style on literal structs
1832 - **Default value**: `"PreferSingle"`
1833 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1835 #### `"PreferSingle"` (default):
1838 let lorem = Lorem { ipsum: dolor, sit: amet };
1841 #### `"ForceMulti"`:
1850 See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width).
1852 ## `struct_lit_width`
1854 Maximum width in the body of a struct lit before falling back to vertical formatting
1856 - **Default value**: `18`
1857 - **Possible values**: any positive integer
1859 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1861 #### Lines shorter than `struct_lit_width`:
1863 let lorem = Lorem { ipsum: dolor, sit: amet };
1866 #### Lines longer than `struct_lit_width`:
1867 See [`indent_style`](#indent_style).
1869 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style).
1871 ## `struct_variant_width`
1873 Maximum width in the body of a struct variant before falling back to vertical formatting
1875 - **Default value**: `35`
1876 - **Possible values**: any positive integer
1878 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1880 #### Struct variants shorter than `struct_variant_width`:
1885 Sit { amet: Consectetur, adipiscing: Elit },
1889 #### Struct variants longer than `struct_variant_width`:
1903 Number of spaces per tab
1905 - **Default value**: `4`
1906 - **Possible values**: any positive integer
1912 let ipsum = dolor();
1914 "amet consectetur adipiscing elit."
1923 let ipsum = dolor();
1925 "amet consectetur adipiscing elit."
1930 See also: [`hard_tabs`](#hard_tabs).
1935 How to handle trailing commas for lists
1937 - **Default value**: `"Vertical"`
1938 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1940 #### `"Vertical"` (default):
1943 let Lorem { ipsum, dolor, sit } = amet;
1957 let Lorem { ipsum, dolor, sit, } = amet;
1971 let Lorem { ipsum, dolor, sit } = amet;
1982 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1984 ## `trailing_semicolon`
1986 Add trailing semicolon after break, continue and return
1988 - **Default value**: `true`
1989 - **Possible values**: `true`, `false`
1991 #### `true` (default):
2005 ## `type_punctuation_density`
2007 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
2009 - **Default value**: `"Wide"`
2010 - **Possible values**: `"Compressed"`, `"Wide"`
2012 #### `"Wide"` (default):
2015 fn lorem<Ipsum: Dolor + Sit = Amet>() {
2020 #### `"Compressed"`:
2023 fn lorem<Ipsum: Dolor+Sit=Amet>() {
2028 ## `use_try_shorthand`
2030 Replace uses of the try! macro by the ? shorthand
2032 - **Default value**: `false`
2033 - **Possible values**: `true`, `false`
2035 #### `false` (default):
2038 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
2044 let lorem = ipsum.map(|dolor| dolor.sit())?;
2049 Density of a where clause.
2051 - **Default value**: `"Vertical"`
2052 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
2054 #### `"Vertical"` (default):
2058 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2062 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2071 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2073 #### `"CompressedIfEmpty"`:
2077 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2080 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2089 #### `"Compressed"`:
2093 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2096 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2107 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2111 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2120 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2122 See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style).
2126 Element layout inside a where clause
2128 - **Default value**: `"Vertical"`
2129 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2131 #### `"Vertical"` (default):
2134 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2135 where Ipsum: IpsumDolorSitAmet,
2136 Dolor: DolorSitAmetConsectetur
2141 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2142 where Ipsum: IpsumDolorSitAmet,
2143 Dolor: DolorSitAmetConsectetur,
2144 Sit: SitAmetConsecteturAdipiscing,
2145 Amet: AmetConsecteturAdipiscingElit
2151 #### `"Horizontal"`:
2154 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2155 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2160 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2161 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2167 #### `"HorizontalVertical"`:
2170 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2171 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2176 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2177 where Ipsum: IpsumDolorSitAmet,
2178 Dolor: DolorSitAmetConsectetur,
2179 Sit: SitAmetConsecteturAdipiscing,
2180 Amet: AmetConsecteturAdipiscingElit
2189 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2190 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2195 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2196 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2197 Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2203 See also: [`where_density`](#where_density), [`indent_style`](#indent_style).
2207 Break comments to fit on the line
2209 - **Default value**: `false`
2210 - **Possible values**: `true`, `false`
2212 #### `false` (default):
2215 // 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.
2221 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2222 // sed do eiusmod tempor incididunt ut labore et dolore
2223 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2224 // exercitation ullamco laboris nisi ut aliquip ex ea
2225 // commodo consequat.
2228 ## `wrap_match_arms`
2230 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2232 - **Default value**: `true`
2233 - **Possible values**: `true`, `false`
2235 #### `true` (default):
2240 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2242 false => println!("{}", sit),
2251 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2252 false => println!("{}", sit),
2256 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2260 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2262 - **Default value**: `"Overwrite"`
2263 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`