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).
1288 Maximum width of each line
1290 - **Default value**: `100`
1291 - **Possible values**: any positive integer
1293 See also [`error_on_line_overflow`](#error_on_line_overflow).
1297 Merge multiple derives into a single one.
1299 - **Default value**: `true`
1300 - **Possible values**: `true`, `false`
1302 #### `true` (default):
1305 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1312 #[derive(Eq, PartialEq)]
1314 #[derive(Copy, Clone)]
1318 ## `multiline_closure_forces_block`
1320 Force multiline closure bodies to be wrapped in a block
1322 - **Default value**: `false`
1323 - **Possible values**: `false`, `true`
1325 #### `false` (default):
1328 result.and_then(|maybe_value| match maybe_value {
1338 result.and_then(|maybe_value| {
1346 ## `multiline_match_arm_forces_block`
1348 Force multiline match arm bodies to be wrapped in a block
1350 - **Default value**: `false`
1351 - **Possible values**: `false`, `true`
1353 #### `false` (default):
1358 println!("Hello World");
1370 println!("Hello World");
1379 Unix or Windows line endings
1381 - **Default value**: `"Unix"`
1382 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1384 ## `normalize_comments`
1386 Convert /* */ comments to // comments where possible
1388 - **Default value**: `false`
1389 - **Possible values**: `true`, `false`
1391 #### `false` (default):
1395 fn dolor() -> usize {}
1398 fn adipiscing() -> usize {}
1405 fn dolor() -> usize {}
1408 fn adipiscing() -> usize {}
1411 ## `reorder_imported_names`
1413 Reorder lists of names in import statements alphabetically
1415 - **Default value**: `false`
1416 - **Possible values**: `true`, `false`
1418 #### `false` (default):
1421 use super::{lorem, ipsum, dolor, sit};
1427 use super::{dolor, ipsum, lorem, sit};
1430 See also [`reorder_imports`](#reorder_imports).
1432 ## `reorder_imports`
1434 Reorder import statements alphabetically
1436 - **Default value**: `false`
1437 - **Possible values**: `true`, `false`
1439 #### `false` (default):
1457 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1459 ## `reorder_imports_in_group`
1461 Reorder import statements in group
1463 - **Default value**: `false`
1464 - **Possible values**: `true`, `false`
1466 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1468 #### `false` (default):
1492 See also [`reorder_imports`](#reorder_imports).
1494 ## `reorder_extern_crates`
1496 Reorder `extern crate` statements alphabetically
1498 - **Default value**: `true`
1499 - **Possible values**: `true`, `false`
1501 #### `true` (default):
1519 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1521 ## `reorder_extern_crates_in_group`
1523 Reorder `extern crate` statements in group
1525 - **Default value**: `true`
1526 - **Possible values**: `true`, `false`
1528 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1530 #### `true` (default):
1554 See also [`reorder_extern_crates`](#reorder_extern_crates).
1558 Report `TODO` items in comments.
1560 - **Default value**: `"Never"`
1561 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1563 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1564 it contains a `#X` (with `X` being a number) in parentheses following the
1565 `TODO`, `"Unnumbered"` will ignore it.
1567 See also [`report_fixme`](#report_fixme).
1571 Report `FIXME` items in comments.
1573 - **Default value**: `"Never"`
1574 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1576 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1577 it contains a `#X` (with `X` being a number) in parentheses following the
1578 `FIXME`, `"Unnumbered"` will ignore it.
1580 See also [`report_todo`](#report_todo).
1582 ## `single_line_if_else_max_width`
1584 Maximum line length for single line if-else expressions.
1586 - **Default value**: `50`
1587 - **Possible values**: any positive integer
1589 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1591 #### Lines shorter than `single_line_if_else_max_width`:
1593 let lorem = if ipsum { dolor } else { sit };
1596 #### Lines longer than `single_line_if_else_max_width`:
1598 let lorem = if ipsum {
1605 See also: [`control_brace_style`](#control_brace_style).
1609 Don't reformat out of line modules
1611 - **Default value**: `false`
1612 - **Possible values**: `true`, `false`
1614 ## `space_after_colon`
1616 Leave a space after the colon.
1618 - **Default value**: `true`
1619 - **Possible values**: `true`, `false`
1621 #### `true` (default):
1624 fn lorem<T: Eq>(t: T) {
1625 let lorem: Dolor = Lorem {
1635 fn lorem<T:Eq>(t:T) {
1636 let lorem:Dolor = Lorem {
1643 See also: [`space_before_colon`](#space_before_colon).
1645 ## `space_before_colon`
1647 Leave a space before the colon.
1649 - **Default value**: `false`
1650 - **Possible values**: `true`, `false`
1652 #### `false` (default):
1655 fn lorem<T: Eq>(t: T) {
1656 let lorem: Dolor = Lorem {
1666 fn lorem<T : Eq>(t : T) {
1667 let lorem : Dolor = Lorem {
1674 See also: [`space_after_colon`](#space_after_colon).
1676 ## `struct_field_align_threshold`
1678 The maximum diff of width between struct fields to be aligned with each other.
1680 - **Default value** : 0
1681 - **Possible values**: any positive integer
1705 ## `spaces_around_ranges`
1707 Put spaces around the .. and ... range operators
1709 - **Default value**: `false`
1710 - **Possible values**: `true`, `false`
1712 #### `false` (default):
1721 let lorem = 0 .. 10;
1724 ## `spaces_within_parens_and_brackets`
1726 Put spaces within non-empty generic arguments
1728 - **Default value**: `false`
1729 - **Possible values**: `true`, `false`
1731 #### `false` (default):
1734 fn lorem<T: Eq>(t: T) {
1742 fn lorem< T: Eq >(t: T) {
1747 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1749 ## `spaces_within_parens_and_brackets`
1751 Put spaces within non-empty parentheses
1753 - **Default value**: `false`
1754 - **Possible values**: `true`, `false`
1756 #### `false` (default):
1759 fn lorem<T: Eq>(t: T) {
1760 let lorem = (ipsum, dolor);
1767 fn lorem<T: Eq>( t: T ) {
1768 let lorem = ( ipsum, dolor );
1772 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1774 ## `spaces_within_parens_and_brackets`
1776 Put spaces within non-empty square brackets
1778 - **Default value**: `false`
1779 - **Possible values**: `true`, `false`
1781 #### `false` (default):
1784 let lorem: [usize; 2] = [ipsum, dolor];
1790 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1793 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1795 ## `struct_lit_multiline_style`
1797 Multiline style on literal structs
1799 - **Default value**: `"PreferSingle"`
1800 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1802 #### `"PreferSingle"` (default):
1805 let lorem = Lorem { ipsum: dolor, sit: amet };
1808 #### `"ForceMulti"`:
1817 See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width).
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 [`indent_style`](#indent_style).
1836 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_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).
1902 How to handle trailing commas for lists
1904 - **Default value**: `"Vertical"`
1905 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1907 #### `"Vertical"` (default):
1910 let Lorem { ipsum, dolor, sit } = amet;
1924 let Lorem { ipsum, dolor, sit, } = amet;
1938 let Lorem { ipsum, dolor, sit } = amet;
1949 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1951 ## `trailing_semicolon`
1953 Add trailing semicolon after break, continue and return
1955 - **Default value**: `true`
1956 - **Possible values**: `true`, `false`
1958 #### `true` (default):
1972 ## `type_punctuation_density`
1974 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1976 - **Default value**: `"Wide"`
1977 - **Possible values**: `"Compressed"`, `"Wide"`
1979 #### `"Wide"` (default):
1982 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1987 #### `"Compressed"`:
1990 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1995 ## `use_try_shorthand`
1997 Replace uses of the try! macro by the ? shorthand
1999 - **Default value**: `false`
2000 - **Possible values**: `true`, `false`
2002 #### `false` (default):
2005 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
2011 let lorem = ipsum.map(|dolor| dolor.sit())?;
2016 Density of a where clause.
2018 - **Default value**: `"Vertical"`
2019 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
2021 #### `"Vertical"` (default):
2025 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2029 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2038 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2040 #### `"CompressedIfEmpty"`:
2044 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2047 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2056 #### `"Compressed"`:
2060 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2063 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2074 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2078 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2087 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2089 See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style).
2093 Element layout inside a where clause
2095 - **Default value**: `"Vertical"`
2096 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2098 #### `"Vertical"` (default):
2101 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2102 where Ipsum: IpsumDolorSitAmet,
2103 Dolor: DolorSitAmetConsectetur
2108 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2109 where Ipsum: IpsumDolorSitAmet,
2110 Dolor: DolorSitAmetConsectetur,
2111 Sit: SitAmetConsecteturAdipiscing,
2112 Amet: AmetConsecteturAdipiscingElit
2118 #### `"Horizontal"`:
2121 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2122 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2127 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2128 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2134 #### `"HorizontalVertical"`:
2137 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2138 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2143 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2144 where Ipsum: IpsumDolorSitAmet,
2145 Dolor: DolorSitAmetConsectetur,
2146 Sit: SitAmetConsecteturAdipiscing,
2147 Amet: AmetConsecteturAdipiscingElit
2156 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2157 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2162 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2163 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2164 Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2170 See also: [`where_density`](#where_density), [`indent_style`](#indent_style).
2174 Break comments to fit on the line
2176 - **Default value**: `false`
2177 - **Possible values**: `true`, `false`
2179 #### `false` (default):
2182 // 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.
2188 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2189 // sed do eiusmod tempor incididunt ut labore et dolore
2190 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2191 // exercitation ullamco laboris nisi ut aliquip ex ea
2192 // commodo consequat.
2195 ## `wrap_match_arms`
2197 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2199 - **Default value**: `true`
2200 - **Possible values**: `true`, `false`
2202 #### `true` (default):
2207 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2209 false => println!("{}", sit),
2218 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2219 false => println!("{}", sit),
2223 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2227 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2229 - **Default value**: `"Overwrite"`
2230 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`