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).
1268 ## `multiline_closure_forces_block`
1270 Force multiline closure bodies to be wrapped in a block
1272 - **Default value**: `false`
1273 - **Possible values**: `false`, `true`
1278 result.and_then(|maybe_value| match maybe_value {
1287 result.and_then(|maybe_value| {
1295 ## `multiline_match_arm_forces_block`
1297 Force multiline match arm bodies to be wrapped in a block
1299 - **Default value**: `false`
1300 - **Possible values**: `false`, `true`
1307 println!("Hello World");
1319 println!("Hello World");
1328 Unix or Windows line endings
1330 - **Default value**: `"Unix"`
1331 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1333 ## `normalize_comments`
1335 Convert /* */ comments to // comments where possible
1337 - **Default value**: `false`
1338 - **Possible values**: `true`, `false`
1344 fn dolor() -> usize {}
1347 fn adipiscing() -> usize {}
1354 fn dolor() -> usize {}
1357 fn adipiscing() -> usize {}
1360 ## `reorder_imported_names`
1362 Reorder lists of names in import statements alphabetically
1364 - **Default value**: `false`
1365 - **Possible values**: `true`, `false`
1370 use super::{lorem, ipsum, dolor, sit};
1376 use super::{dolor, ipsum, lorem, sit};
1379 See also [`reorder_imports`](#reorder_imports).
1381 ## `reorder_imports`
1383 Reorder import statements alphabetically
1385 - **Default value**: `false`
1386 - **Possible values**: `true`, `false`
1406 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1408 ## `reorder_imports_in_group`
1410 Reorder import statements in group
1412 - **Default value**: `false`
1413 - **Possible values**: `true`, `false`
1415 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1441 See also [`reorder_imports`](#reorder_imports).
1443 ## `single_line_if_else_max_width`
1445 Maximum line length for single line if-else expressions.
1447 - **Default value**: `50`
1448 - **Possible values**: any positive integer
1450 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1452 #### Lines shorter than `single_line_if_else_max_width`:
1454 let lorem = if ipsum { dolor } else { sit };
1457 #### Lines longer than `single_line_if_else_max_width`:
1459 let lorem = if ipsum {
1466 See also: [`control_brace_style`](#control_brace_style).
1470 Don't reformat out of line modules
1472 - **Default value**: `false`
1473 - **Possible values**: `true`, `false`
1475 ## `space_after_bound_colon`
1477 Leave a space after the colon in a trait or lifetime bound
1479 - **Default value**: `true`
1480 - **Possible values**: `true`, `false`
1485 fn lorem<T:Eq>(t: T) {
1493 fn lorem<T: Eq>(t: T) {
1498 See also: [`space_before_bound`](#space_before_bound).
1500 ## `struct_field_align_threshold`
1502 The maximum diff of width between struct fields to be aligned with each other.
1504 - **Default value** : 0
1505 - **Possible values**: any positive integer
1527 ## `space_after_struct_lit_field_colon`
1529 Leave a space after the colon in a struct literal field
1531 - **Default value**: `true`
1532 - **Possible values**: `true`, `false`
1552 See also: [`space_before_struct_lit_field_colon`](#space_before_struct_lit_field_colon).
1554 ## `space_after_type_annotation_colon`
1556 Leave a space after the colon in a type annotation
1558 - **Default value**: `true`
1559 - **Possible values**: `true`, `false`
1564 fn lorem<T: Eq>(t:T) {
1565 let ipsum:Dolor = sit;
1572 fn lorem<T: Eq>(t: T) {
1573 let ipsum: Dolor = sit;
1577 See also: [`space_before_type_annotation`](#space_before_type_annotation).
1579 ## `space_before_bound`
1581 Leave a space before the colon in a trait or lifetime bound
1583 - **Default value**: `false`
1584 - **Possible values**: `true`, `false`
1589 fn lorem<T: Eq>(t: T) {
1590 let ipsum: Dolor = sit;
1597 fn lorem<T : Eq>(t: T) {
1598 let ipsum: Dolor = sit;
1602 See also: [`space_after_bound_colon`](#space_after_bound_colon).
1604 ## `space_before_struct_lit_field_colon`
1606 Leave a space before the colon in a struct literal field
1608 - **Default value**: `false`
1609 - **Possible values**: `true`, `false`
1629 See also: [`space_after_struct_lit_field_colon`](#space_after_struct_lit_field_colon).
1631 ## `space_before_type_annotation`
1633 Leave a space before the colon in a type annotation
1635 - **Default value**: `false`
1636 - **Possible values**: `true`, `false`
1641 fn lorem<T: Eq>(t: T) {
1642 let ipsum: Dolor = sit;
1649 fn lorem<T: Eq>(t : T) {
1650 let ipsum : Dolor = sit;
1654 See also: [`space_after_type_annotation_colon`](#space_after_type_annotation_colon).
1656 ## `spaces_around_ranges`
1658 Put spaces around the .. and ... range operators
1660 - **Default value**: `false`
1661 - **Possible values**: `true`, `false`
1672 let lorem = 0 .. 10;
1675 ## `spaces_within_angle_brackets`
1677 Put spaces within non-empty generic arguments
1679 - **Default value**: `false`
1680 - **Possible values**: `true`, `false`
1685 fn lorem<T: Eq>(t: T) {
1693 fn lorem< T: Eq >(t: T) {
1698 See also: [`spaces_within_parens`](#spaces_within_parens), [`spaces_within_square_brackets`](#spaces_within_square_brackets).
1700 ## `spaces_within_parens`
1702 Put spaces within non-empty parentheses
1704 - **Default value**: `false`
1705 - **Possible values**: `true`, `false`
1710 fn lorem<T: Eq>(t: T) {
1711 let lorem = (ipsum, dolor);
1718 fn lorem<T: Eq>( t: T ) {
1719 let lorem = ( ipsum, dolor );
1723 See also: [`spaces_within_angle_brackets`](#spaces_within_angle_brackets), [`spaces_within_square_brackets`](#spaces_within_square_brackets).
1725 ## `spaces_within_square_brackets`
1727 Put spaces within non-empty square brackets
1729 - **Default value**: `false`
1730 - **Possible values**: `true`, `false`
1735 let lorem: [usize; 2] = [ipsum, dolor];
1741 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1744 See also: [`spaces_within_parens`](#spaces_within_parens), [`spaces_within_angle_brackets`](#spaces_within_angle_brackets).
1746 ## `struct_lit_multiline_style`
1748 Multiline style on literal structs
1750 - **Default value**: `"PreferSingle"`
1751 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1753 #### `"ForceMulti"`:
1762 #### `"PreferSingle"`:
1765 let lorem = Lorem { ipsum: dolor, sit: amet };
1768 See also: [`struct_lit_style`](#struct_lit_style), [`struct_lit_width`](#struct_lit_width).
1770 ## `struct_lit_style`
1772 Style of struct definition
1774 - **Default value**: `"Block"`
1775 - **Possible values**: `"Block"`, `"Visual"`
1789 let lorem = Lorem { ipsum: dolor,
1793 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1795 ## `struct_lit_width`
1797 Maximum width in the body of a struct lit before falling back to vertical formatting
1799 - **Default value**: `18`
1800 - **Possible values**: any positive integer
1802 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1804 #### Lines shorter than `struct_lit_width`:
1806 let lorem = Lorem { ipsum: dolor, sit: amet };
1809 #### Lines longer than `struct_lit_width`:
1810 See [`struct_lit_style`](#struct_lit_style).
1812 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1814 ## `struct_variant_width`
1816 Maximum width in the body of a struct variant before falling back to vertical formatting
1818 - **Default value**: `35`
1819 - **Possible values**: any positive integer
1821 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1823 #### Struct variants shorter than `struct_variant_width`:
1828 Sit { amet: Consectetur, adipiscing: Elit },
1832 #### Struct variants longer than `struct_variant_width`:
1846 Number of spaces per tab
1848 - **Default value**: `4`
1849 - **Possible values**: any positive integer
1855 let ipsum = dolor();
1857 "amet consectetur adipiscing elit."
1866 let ipsum = dolor();
1868 "amet consectetur adipiscing elit."
1873 See also: [`hard_tabs`](#hard_tabs).
1875 ## `take_source_hints`
1877 Retain some formatting characteristics from the source code
1879 - **Default value**: `false`
1880 - **Possible values**: `true`, `false`
1887 .dolor(|| { sit.amet().consectetur().adipiscing().elit(); });
1903 Note: This only applies if the call chain within the inner closure had already been formatted on separate lines before running rustfmt.
1907 How to handle trailing commas for lists
1909 - **Default value**: `"Vertical"`
1910 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1915 let Lorem { ipsum, dolor, sit, } = amet;
1929 let Lorem { ipsum, dolor, sit } = amet;
1943 let Lorem { ipsum, dolor, sit } = amet;
1954 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1956 ## `trailing_semicolon`
1958 Add trailing semicolon after break, continue and return
1960 - **Default value**: `true`
1961 - **Possible values**: `true`, `false`
1977 ## `type_punctuation_density`
1979 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1981 - **Default value**: `"Wide"`
1982 - **Possible values**: `"Compressed"`, `"Wide"`
1984 #### `"Compressed"`:
1987 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1995 fn lorem<Ipsum: Dolor + Sit = Amet>() {
2000 ## `use_try_shorthand`
2002 Replace uses of the try! macro by the ? shorthand
2004 - **Default value**: `false`
2005 - **Possible values**: `true`, `false`
2010 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
2016 let lorem = ipsum.map(|dolor| dolor.sit())?;
2021 Density of a where clause.
2023 - **Default value**: `"CompressedIfEmpty"`
2024 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
2026 #### `"Compressed"`:
2030 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2033 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2040 #### `"CompressedIfEmpty"`:
2044 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2047 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2060 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2064 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2073 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2079 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2082 fn ipsum<Dolor>(dolor: Dolor) -> Sit
2090 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2092 See also: [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
2096 Element layout inside a where clause
2098 - **Default value**: `"Vertical"`
2099 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2101 #### `"Horizontal"`:
2104 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2105 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2110 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2111 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2117 #### `"HorizontalVertical"`:
2120 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2121 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2126 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2127 where Ipsum: IpsumDolorSitAmet,
2128 Dolor: DolorSitAmetConsectetur,
2129 Sit: SitAmetConsecteturAdipiscing,
2130 Amet: AmetConsecteturAdipiscingElit
2139 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2140 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2145 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2146 where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2147 Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2156 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2157 where Ipsum: IpsumDolorSitAmet,
2158 Dolor: DolorSitAmetConsectetur
2163 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2164 where Ipsum: IpsumDolorSitAmet,
2165 Dolor: DolorSitAmetConsectetur,
2166 Sit: SitAmetConsecteturAdipiscing,
2167 Amet: AmetConsecteturAdipiscingElit
2173 **Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
2175 See also: [`where_density`](#where_density), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
2177 ## `where_pred_indent`
2179 Indentation style of a where predicate
2181 - **Default value**: `"Visual"`
2182 - **Possible values**: `"Block"`, `"Visual"`
2187 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2200 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2210 **Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
2212 See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_style`](#where_style).
2216 Overall strategy for where clauses
2218 - **Default value**: `"Rfc"`
2219 - **Possible values**: `"Rfc"`, `"Legacy"`
2224 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2238 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2248 See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent).
2252 Break comments to fit on the line
2254 - **Default value**: `false`
2255 - **Possible values**: `true`, `false`
2260 // 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.
2266 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2267 // sed do eiusmod tempor incididunt ut labore et dolore
2268 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2269 // exercitation ullamco laboris nisi ut aliquip ex ea
2270 // commodo consequat.
2273 ## `wrap_match_arms`
2275 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2277 - **Default value**: `true`
2278 - **Possible values**: `true`, `false`
2285 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2286 false => println!("{}", sit),
2295 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2297 false => println!("{}", sit),
2301 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2305 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2307 - **Default value**: `"Overwrite"`
2308 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`