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. If none of these directories contain such a file, both your home directory and a directory called `rustfmt` in your [global config directory](https://docs.rs/dirs/1.0.4/dirs/fn.config_dir.html) (e.g. `.config/rustfmt/`) are checked as well.
5 A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
9 reorder_imports = false
12 Each configuration option is either stable or unstable.
13 Stable options can be used directly, while unstable options are opt-in.
14 To enable unstable options, set `unstable_features = true` in `rustfmt.toml` or pass `--unstable-features` to rustfmt.
16 # Configuration Options
18 Below you find a detailed visual guide on all the supported configuration options of rustfmt:
23 Where to put a binary operator when a binary expression goes multiline.
25 - **Default value**: `"Front"`
26 - **Possible values**: `"Front"`, `"Back"`
27 - **Stable**: No (tracking issue: #3368)
29 #### `"Front"` (default):
33 let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo
34 || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
36 let sum = 123456789012345678901234567890
37 + 123456789012345678901234567890
38 + 123456789012345678901234567890;
40 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
41 ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
49 let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo ||
50 barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
52 let sum = 123456789012345678901234567890 +
53 123456789012345678901234567890 +
54 123456789012345678901234567890;
56 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..
57 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
61 ## `blank_lines_lower_bound`
63 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
64 them, additional blank lines are inserted.
66 - **Default value**: `0`
67 - **Possible values**: *unsigned integer*
68 - **Stable**: No (tracking issue: #3382)
71 Original Code (rustfmt will not change it with the default value of `0`):
101 ## `blank_lines_upper_bound`
103 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
104 lines are found, they are trimmed down to match this integer.
106 - **Default value**: `1`
107 - **Possible values**: any non-negative integer
108 - **Stable**: No (tracking issue: #3381)
158 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
162 Brace style for items
164 - **Default value**: `"SameLineWhere"`
165 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
166 - **Stable**: No (tracking issue: #3376)
170 #### `"SameLineWhere"` (default):
177 fn lorem(ipsum: usize) {
181 fn lorem<T>(ipsum: T)
183 T: Add + Sub + Mul + Div,
189 #### `"AlwaysNextLine"`:
197 fn lorem(ipsum: usize)
202 fn lorem<T>(ipsum: T)
204 T: Add + Sub + Mul + Div,
210 #### `"PreferSameLine"`:
217 fn lorem(ipsum: usize) {
221 fn lorem<T>(ipsum: T)
223 T: Add + Sub + Mul + Div, {
228 ### Structs and enums
230 #### `"SameLineWhere"` (default):
245 #### `"AlwaysNextLine"`:
261 #### `"PreferSameLine"`:
278 Whether to use colored output or not.
280 - **Default value**: `"Auto"`
281 - **Possible values**: "Auto", "Always", "Never"
282 - **Stable**: No (tracking issue: #3385)
284 ## `combine_control_expr`
286 Combine control expressions with function calls.
288 - **Default value**: `true`
289 - **Possible values**: `true`, `false`
290 - **Stable**: No (tracking issue: #3369)
292 #### `true` (default):
304 foo!(if let Some(..) = x {
317 foo!(while let Some(..) = x {
351 if let Some(..) = x {
368 while let Some(..) = x {
394 Maximum length of comments. No effect unless`wrap_comments = true`.
396 - **Default value**: `80`
397 - **Possible values**: any positive integer
398 - **Stable**: No (tracking issue: #3349)
400 **Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
402 #### `80` (default; comments shorter than `comment_width`):
404 // Lorem ipsum dolor sit amet, consectetur adipiscing elit.
407 #### `60` (comments longer than `comment_width`):
409 // Lorem ipsum dolor sit amet,
410 // consectetur adipiscing elit.
413 See also [`wrap_comments`](#wrap_comments).
415 ## `condense_wildcard_suffixes`
417 Replace strings of _ wildcards by a single .. in tuple patterns
419 - **Default value**: `false`
420 - **Possible values**: `true`, `false`
421 - **Stable**: No (tracking issue: #3384)
423 #### `false` (default):
427 let (lorem, ipsum, _, _) = (1, 2, 3, 4);
428 let (lorem, ipsum, ..) = (1, 2, 3, 4);
436 let (lorem, ipsum, ..) = (1, 2, 3, 4);
440 ## `control_brace_style`
442 Brace style for control flow constructs
444 - **Default value**: `"AlwaysSameLine"`
445 - **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
446 - **Stable**: No (tracking issue: #3377)
448 #### `"AlwaysSameLine"` (default):
460 #### `"AlwaysNextLine"`:
475 #### `"ClosingNextLine"`:
488 ## `disable_all_formatting`
490 Don't reformat anything
492 - **Default value**: `false`
493 - **Possible values**: `true`, `false`
494 - **Stable**: No (tracking issue: #3388)
498 Specifies which edition is used by the parser.
500 - **Default value**: `2015`
501 - **Possible values**: `2015`, `2018`
504 Rustfmt is able to pick up the edition used by reading the `Cargo.toml` file if executed
505 through the Cargo's formatting tool `cargo fmt`. Otherwise, the edition needs to be specified
512 ## `empty_item_single_line`
514 Put empty-body functions and impls on a single line
516 - **Default value**: `true`
517 - **Possible values**: `true`, `false`
518 - **Stable**: No (tracking issue: #3356)
520 #### `true` (default):
538 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
541 ## `enum_discrim_align_threshold`
543 The maximum length of enum variant having discriminant, that gets vertically aligned with others.
544 Variants without discriminants would be ignored for the purpose of alignment.
546 Note that this is not how much whitespace is inserted, but instead the longest variant name that
547 doesn't get ignored when aligning.
549 - **Default value** : 0
550 - **Possible values**: any positive integer
551 - **Stable**: No (tracking issue: #3372)
559 RandomLongVariantGoesHere = 10,
564 VeryLongVariantNameHereA = 0,
565 VeryLongVariantNameHereBb = 1,
566 VeryLongVariantNameHereCcc = 2,
576 RandomLongVariantGoesHere = 10,
581 VeryLongVariantNameHereA = 0,
582 VeryLongVariantNameHereBb = 1,
583 VeryLongVariantNameHereCcc = 2,
588 ## `error_on_line_overflow`
590 Error if Rustfmt is unable to get all lines within `max_width`, except for comments and string
591 literals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug by
592 refactoring your code to avoid long/complex expressions, usually by extracting a local variable or
593 using a shorter name.
595 - **Default value**: `false`
596 - **Possible values**: `true`, `false`
597 - **Stable**: No (tracking issue: #3391)
599 See also [`max_width`](#max_width).
601 ## `error_on_unformatted`
603 Error if unable to get comments or string literals within `max_width`, or they are left with
604 trailing whitespaces.
606 - **Default value**: `false`
607 - **Possible values**: `true`, `false`
608 - **Stable**: No (tracking issue: #3392)
612 Control the layout of arguments in a function
614 - **Default value**: `"Tall"`
615 - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
618 #### `"Tall"` (default):
622 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
624 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
633 consectetur: Consectetur,
634 adipiscing: Adipiscing,
643 consectetur: Consectetur,
644 adipiscing: Adipiscing,
656 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
658 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
663 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
664 adipiscing: Adipiscing, elit: Elit,
668 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
669 adipiscing: Adipiscing, elit: Elit,
701 consectetur: Consectetur,
702 adipiscing: Adipiscing,
711 consectetur: Consectetur,
712 adipiscing: Adipiscing,
723 Put single-expression functions on a single line
725 - **Default value**: `false`
726 - **Possible values**: `true`, `false`
727 - **Stable**: No (tracking issue: #3358)
729 #### `false` (default):
732 fn lorem() -> usize {
736 fn lorem() -> usize {
745 fn lorem() -> usize { 42 }
747 fn lorem() -> usize {
753 See also [`control_brace_style`](#control_brace_style).
756 ## `force_explicit_abi`
758 Always print the abi for extern items
760 - **Default value**: `true`
761 - **Possible values**: `true`, `false`
764 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
766 #### `true` (default):
770 pub static lorem: c_int;
778 pub static lorem: c_int;
782 ## `force_multiline_blocks`
784 Force multiline closure and match arm bodies to be wrapped in a block
786 - **Default value**: `false`
787 - **Possible values**: `false`, `true`
788 - **Stable**: No (tracking issue: #3374)
790 #### `false` (default):
794 result.and_then(|maybe_value| match maybe_value {
796 Some(value) => bar(),
801 println!("Hello World");
803 Some(dolor) => foo(),
812 result.and_then(|maybe_value| {
815 Some(value) => bar(),
822 println!("Hello World");
825 Some(dolor) => foo(),
831 ## `format_code_in_doc_comments`
833 Format code snippet included in doc comments.
835 - **Default value**: `false`
836 - **Possible values**: `true`, `false`
837 - **Stable**: No (tracking issue: #3348)
839 #### `false` (default):
842 /// Adds one to the number given.
853 /// # fn add_one(x: i32) -> i32 {
857 fn add_one(x: i32) -> i32 {
865 /// Adds one to the number given.
872 /// assert_eq!(6, add_one(5));
873 /// # fn add_one(x: i32) -> i32 {
877 fn add_one(x: i32) -> i32 {
882 ## `format_macro_matchers`
884 Format the metavariable matching patterns in macros.
886 - **Default value**: `false`
887 - **Possible values**: `true`, `false`
888 - **Stable**: No (tracking issue: #3354)
890 #### `false` (default):
894 ($a: ident : $b: ty) => {
897 ($a: ident $b: ident $c: ident) => {
907 ($a:ident : $b:ty) => {
910 ($a:ident $b:ident $c:ident) => {
916 See also [`format_macro_bodies`](#format_macro_bodies).
919 ## `format_macro_bodies`
921 Format the bodies of macros.
923 - **Default value**: `true`
924 - **Possible values**: `true`, `false`
925 - **Stable**: No (tracking issue: #3355)
927 #### `true` (default):
931 ($a: ident : $b: ty) => {
934 ($a: ident $b: ident $c: ident) => {
944 ($a: ident : $b: ty) => { $a(42): $b; };
945 ($a: ident $b: ident $c: ident) => { $a=$b+$c; };
949 See also [`format_macro_matchers`](#format_macro_matchers).
954 Format string literals where necessary
956 - **Default value**: `false`
957 - **Possible values**: `true`, `false`
958 - **Stable**: No (tracking issue: #3353)
960 #### `false` (default):
964 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";
972 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \
973 consectetur adipiscing";
977 See also [`max_width`](#max_width).
981 Use tab characters for indentation, spaces for alignment
983 - **Default value**: `false`
984 - **Possible values**: `true`, `false`
987 #### `false` (default):
990 fn lorem() -> usize {
991 42 // spaces before 42
998 fn lorem() -> usize {
1003 See also: [`tab_spaces`](#tab_spaces).
1006 ## `hide_parse_errors`
1008 Do not show parse errors if the parser failed to parse files.
1010 - **Default value**: `false`
1011 - **Possible values**: `true`, `false`
1012 - **Stable**: No (tracking issue: #3390)
1016 Skip formatting files and directories that match the specified pattern.
1017 The pattern format is the same as [.gitignore](https://git-scm.com/docs/gitignore#_pattern_format). Be sure to use Unix/forwardslash `/` style paths. This path style will work on all platforms. Windows style paths with backslashes `\` are not supported.
1019 - **Default value**: format every file
1020 - **Possible values**: See an example below
1021 - **Stable**: No (tracking issue: #3395)
1025 If you want to ignore specific files, put the following to your config file:
1034 If you want to ignore every file under `examples/`, put the following to your config file:
1042 If you want to ignore every file under the directory where you put your rustfmt.toml:
1050 Indent style of imports
1052 - **Default Value**: `"Block"`
1053 - **Possible values**: `"Block"`, `"Visual"`
1054 - **Stable**: No (tracking issue: #3360)
1056 #### `"Block"` (default):
1060 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1061 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1068 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1069 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1072 See also: [`imports_layout`](#imports_layout).
1076 Item layout inside a imports block
1078 - **Default value**: "Mixed"
1079 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1080 - **Stable**: No (tracking issue: #3361)
1082 #### `"Mixed"` (default):
1085 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1088 aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1089 eeeeeeeeeeeeeeeeee, ffffffffffffffffff,
1093 #### `"Horizontal"`:
1095 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1098 use foo::{xxx, yyy, zzz};
1100 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1103 #### `"HorizontalVertical"`:
1106 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1139 Indent on expressions or items.
1141 - **Default value**: `"Block"`
1142 - **Possible values**: `"Block"`, `"Visual"`
1143 - **Stable**: No (tracking issue: #3346)
1147 #### `"Block"` (default):
1167 let lorem = vec!["ipsum",
1179 #### `"Block"` (default):
1187 && dolor_consectetur
1189 && lorem_consectetur
1204 && dolor_consectetur
1206 && lorem_consectetur
1213 See also: [`control_brace_style`](#control_brace_style).
1215 ### Function arguments
1217 #### `"Block"` (default):
1222 fn lorem(ipsum: usize) {}
1242 fn lorem(ipsum: usize) {}
1244 fn lorem(ipsum: usize,
1257 #### `"Block"` (default):
1291 #### `"Block"` (default):
1299 Adipiscing: Eq = usize,
1300 Consectetur: Eq = usize,
1307 adipiscing: Adipiscing,
1308 consectetur: Consectetur,
1318 fn lorem<Ipsum: Eq = usize,
1322 Adipiscing: Eq = usize,
1323 Consectetur: Eq = usize,
1329 adipiscing: Adipiscing,
1330 consectetur: Consectetur,
1339 #### `"Block"` (default):
1354 let lorem = Lorem { ipsum: dolor,
1359 See also: [`struct_lit_single_line`](#struct_lit_single_line), [`indent_style`](#indent_style).
1361 ### Where predicates
1363 #### `"Block"` (default):
1366 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
1380 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
1390 ## `inline_attribute_width`
1392 Write an item and its attribute on the same line if their combined width is below a threshold
1394 - **Default value**: 0
1395 - **Possible values**: any positive integer
1396 - **Stable**: No (tracking issue: #3343)
1402 #[cfg(feature = "alloc")]
1408 #[cfg(feature = "alloc")] use core::slice;
1411 ## `license_template_path`
1413 Check whether beginnings of files match a license template.
1415 - **Default value**: `""`
1416 - **Possible values**: path to a license template file
1417 - **Stable**: No (tracking issue: #3352)
1419 A license template is a plain text file which is matched literally against the
1420 beginning of each source file, except for `{}`-delimited blocks, which are
1421 matched as regular expressions. The following license template therefore
1422 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
1423 Copyright 2018 The Rust Project Developers.`, etc.:
1426 // Copyright {\d+} The Rust Project Developers.
1429 `\{`, `\}` and `\\` match literal braces / backslashes.
1431 ## `match_arm_blocks`
1433 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1435 - **Default value**: `true`
1436 - **Possible values**: `true`, `false`
1437 - **Stable**: No (tracking issue: #3373)
1439 #### `true` (default):
1445 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1447 false => println!("{}", sit),
1458 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1459 false => println!("{}", sit),
1464 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1466 ## `match_block_trailing_comma`
1468 Put a trailing comma after a block based match arm (non-block arms are not affected)
1470 - **Default value**: `false`
1471 - **Possible values**: `true`, `false`
1472 - **Stable**: No (tracking issue: #3380)
1474 #### `false` (default):
1482 Lorem::Dolor => println!("dolor"),
1495 Lorem::Dolor => println!("dolor"),
1500 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1504 Maximum width of each line
1506 - **Default value**: `100`
1507 - **Possible values**: any positive integer
1510 See also [`error_on_line_overflow`](#error_on_line_overflow).
1514 Merge multiple derives into a single one.
1516 - **Default value**: `true`
1517 - **Possible values**: `true`, `false`
1520 #### `true` (default):
1523 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1530 #[derive(Eq, PartialEq)]
1532 #[derive(Copy, Clone)]
1538 Merge multiple imports into a single nested import.
1540 - **Default value**: `false`
1541 - **Possible values**: `true`, `false`
1542 - **Stable**: No (tracking issue: #3362)
1544 #### `false` (default):
1555 use foo::{a, b, c, d, e, f, g};
1561 Unix or Windows line endings
1563 - **Default value**: `"Auto"`
1564 - **Possible values**: `"Auto"`, `"Native"`, `"Unix"`, `"Windows"`
1567 #### `Auto` (default):
1569 The newline style is detected automatically on a per-file basis. Files
1570 with mixed line endings will be converted to the first detected line
1575 Line endings will be converted to `\r\n` on Windows and `\n` on all
1580 Line endings will be converted to `\n`.
1584 Line endings will be converted to `\r\n`.
1586 ## `normalize_comments`
1588 Convert /* */ comments to // comments where possible
1590 - **Default value**: `false`
1591 - **Possible values**: `true`, `false`
1592 - **Stable**: No (tracking issue: #3350)
1594 #### `false` (default):
1598 fn dolor() -> usize {}
1601 fn adipiscing() -> usize {}
1608 fn dolor() -> usize {}
1611 fn adipiscing() -> usize {}
1614 ## `normalize_doc_attributes`
1616 Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.
1618 - **Default value**: `false`
1619 - **Possible values**: `true`, `false`
1620 - **Stable**: No (tracking issue: #3351)
1622 #### `false` (default):
1625 #![doc = "Example documentation"]
1627 #[doc = "Example item documentation"]
1634 //! Example documentation
1636 /// Example item documentation
1640 ## `overflow_delimited_expr`
1642 When structs, slices, arrays, and block/array-like macros are used as the last
1643 argument in an expression list, allow them to overflow (like blocks/closures)
1644 instead of being indented on a new line.
1646 - **Default value**: `false`
1647 - **Possible values**: `true`, `false`
1648 - **Stable**: No (tracking issue: #3370)
1650 #### `false` (default):
1723 ## `remove_nested_parens`
1725 Remove nested parens.
1727 - **Default value**: `true`,
1728 - **Possible values**: `true`, `false`
1732 #### `true` (default):
1747 ## `reorder_impl_items`
1749 Reorder impl items. `type` and `const` are put first, then macros and methods.
1751 - **Default value**: `false`
1752 - **Possible values**: `true`, `false`
1753 - **Stable**: No (tracking issue: #3363)
1755 #### `false` (default)
1760 impl Iterator for Dummy {
1761 fn next(&mut self) -> Option<Self::Item> {
1774 impl Iterator for Dummy {
1777 fn next(&mut self) -> Option<Self::Item> {
1783 ## `reorder_imports`
1785 Reorder import and extern crate statements alphabetically in groups (a group is
1786 separated by a newline).
1788 - **Default value**: `true`
1789 - **Possible values**: `true`, `false`
1792 #### `true` (default):
1811 ## `reorder_modules`
1813 Reorder `mod` declarations alphabetically in group.
1815 - **Default value**: `true`
1816 - **Possible values**: `true`, `false`
1819 #### `true` (default)
1843 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantics
1844 of the original source code.
1848 Report `FIXME` items in comments.
1850 - **Default value**: `"Never"`
1851 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1852 - **Stable**: No (tracking issue: #3394)
1854 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1855 it contains a `#X` (with `X` being a number) in parentheses following the
1856 `FIXME`, `"Unnumbered"` will ignore it.
1858 See also [`report_todo`](#report_todo).
1863 Report `TODO` items in comments.
1865 - **Default value**: `"Never"`
1866 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1867 - **Stable**: No (tracking issue: #3393)
1869 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1870 it contains a `#X` (with `X` being a number) in parentheses following the
1871 `TODO`, `"Unnumbered"` will ignore it.
1873 See also [`report_fixme`](#report_fixme).
1875 ## `required_version`
1877 Require a specific version of rustfmt. If you want to make sure that the
1878 specific version of rustfmt is used in your CI, use this option.
1880 - **Default value**: `CARGO_PKG_VERSION`
1881 - **Possible values**: any published version (e.g. `"0.3.8"`)
1882 - **Stable**: No (tracking issue: #3386)
1886 Don't reformat out of line modules
1888 - **Default value**: `false`
1889 - **Possible values**: `true`, `false`
1890 - **Stable**: No (tracking issue: #3389)
1892 ## `space_after_colon`
1894 Leave a space after the colon.
1896 - **Default value**: `true`
1897 - **Possible values**: `true`, `false`
1898 - **Stable**: No (tracking issue: #3366)
1900 #### `true` (default):
1903 fn lorem<T: Eq>(t: T) {
1904 let lorem: Dolor = Lorem {
1914 fn lorem<T:Eq>(t:T) {
1915 let lorem:Dolor = Lorem {
1922 See also: [`space_before_colon`](#space_before_colon).
1924 ## `space_before_colon`
1926 Leave a space before the colon.
1928 - **Default value**: `false`
1929 - **Possible values**: `true`, `false`
1930 - **Stable**: No (tracking issue: #3365)
1932 #### `false` (default):
1935 fn lorem<T: Eq>(t: T) {
1936 let lorem: Dolor = Lorem {
1946 fn lorem<T : Eq>(t : T) {
1947 let lorem : Dolor = Lorem {
1954 See also: [`space_after_colon`](#space_after_colon).
1956 ## `spaces_around_ranges`
1958 Put spaces around the .., ..=, and ... range operators
1960 - **Default value**: `false`
1961 - **Possible values**: `true`, `false`
1962 - **Stable**: No (tracking issue: #3367)
1964 #### `false` (default):
1992 let lorem = 0 .. 10;
1993 let ipsum = 0 ..= 10;
2012 ## `struct_field_align_threshold`
2014 The maximum diff of width between struct fields to be aligned with each other.
2016 - **Default value** : 0
2017 - **Possible values**: any non-negative integer
2018 - **Stable**: No (tracking issue: #3371)
2040 ## `struct_lit_single_line`
2042 Put small struct literals on a single line
2044 - **Default value**: `true`
2045 - **Possible values**: `true`, `false`
2046 - **Stable**: No (tracking issue: #3357)
2048 #### `true` (default):
2052 let lorem = Lorem { foo: bar, baz: ofo };
2067 See also: [`indent_style`](#indent_style).
2072 Number of spaces per tab
2074 - **Default value**: `4`
2075 - **Possible values**: any positive integer
2082 let ipsum = dolor();
2084 "amet consectetur adipiscing elit amet",
2085 "consectetur adipiscing elit amet consectetur.",
2094 let ipsum = dolor();
2096 "amet consectetur adipiscing elit amet",
2097 "consectetur adipiscing elit amet consectetur.",
2102 See also: [`hard_tabs`](#hard_tabs).
2107 How to handle trailing commas for lists
2109 - **Default value**: `"Vertical"`
2110 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
2111 - **Stable**: No (tracking issue: #3379)
2113 #### `"Vertical"` (default):
2117 let Lorem { ipsum, dolor, sit } = amet;
2133 let Lorem { ipsum, dolor, sit, } = amet;
2149 let Lorem { ipsum, dolor, sit } = amet;
2161 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
2163 ## `trailing_semicolon`
2165 Add trailing semicolon after break, continue and return
2167 - **Default value**: `true`
2168 - **Possible values**: `true`, `false`
2169 - **Stable**: No (tracking issue: #3378)
2171 #### `true` (default):
2185 ## `type_punctuation_density`
2187 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
2189 - **Default value**: `"Wide"`
2190 - **Possible values**: `"Compressed"`, `"Wide"`
2191 - **Stable**: No (tracking issue: #3364)
2193 #### `"Wide"` (default):
2196 fn lorem<Ipsum: Dolor + Sit = Amet>() {
2201 #### `"Compressed"`:
2204 fn lorem<Ipsum: Dolor+Sit=Amet>() {
2209 ## `unstable_features`
2211 Enable unstable features on the unstable channel.
2213 - **Default value**: `false`
2214 - **Possible values**: `true`, `false`
2215 - **Stable**: No (tracking issue: #3387)
2217 ## `use_field_init_shorthand`
2219 Use field initialize shorthand if possible.
2221 - **Default value**: `false`
2222 - **Possible values**: `true`, `false`
2225 #### `false` (default):
2238 let a = Foo { x: x, y: y, z: z };
2255 let a = Foo { x, y, z };
2259 ## `use_small_heuristics`
2261 Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'.
2263 - **Default value**: `"Default"`
2264 - **Possible values**: `"Default"`, `"Off"`, `"Max"`
2267 #### `Default` (default):
2273 Sit { amet: Consectetur, adipiscing: Elit },
2291 let lorem = Lorem { ipsum: dolor };
2293 let lorem = if ipsum { dolor } else { sit };
2310 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
2317 let lorem = if ipsum {
2331 Sit { amet: Consectetur, adipiscing: Elit },
2335 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
2337 let lorem = Lorem { ipsum: dolor, sit: amet };
2339 let lorem = if ipsum { dolor } else { sit };
2343 ## `use_try_shorthand`
2345 Replace uses of the try! macro by the ? shorthand
2347 - **Default value**: `false`
2348 - **Possible values**: `true`, `false`
2351 #### `false` (default):
2355 let lorem = try!(ipsum.map(|dolor| dolor.sit()));
2363 let lorem = ipsum.map(|dolor| dolor.sit())?;
2369 Which version of the formatting rules to use. `Version::One` is backwards-compatible
2370 with Rustfmt 1.0. Other versions are only backwards compatible within a major
2373 - **Default value**: `One`
2374 - **Possible values**: `One`, `Two`
2375 - **Stable**: No (tracking issue: #3383)
2383 ## `where_single_line`
2385 Forces the `where` clause to be laid out on a single line.
2387 - **Default value**: `false`
2388 - **Possible values**: `true`, `false`
2389 - **Stable**: No (tracking issue: #3359)
2391 #### `false` (default):
2406 where Option<T>: Ipsum
2412 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
2417 Break comments to fit on the line
2419 - **Default value**: `false`
2420 - **Possible values**: `true`, `false`
2421 - **Stable**: No (tracking issue: #3347)
2423 #### `false` (default):
2426 // 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.
2432 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2433 // sed do eiusmod tempor incididunt ut labore et dolore
2434 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2435 // exercitation ullamco laboris nisi ut aliquip ex ea
2436 // commodo consequat.
2447 Internal option, use `--backup`
2449 ## `print_misformatted_file_names`
2451 Internal option, use `-l` or `--files-with-diff`