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:
9 reorder_imported_names = true
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 Indent on expressions or items.
25 - **Default value**: `"Block"`
26 - **Possible values**: `"Block"`, `"Visual"`
31 #### `"Block"` (default):
51 let lorem = vec!["ipsum",
63 #### `"Block"` (default):
67 if lorem_ipsum && dolor_sit && amet_consectetur && lorem_sit && dolor_consectetur && amet_ipsum
79 if lorem_ipsum && dolor_sit && amet_consectetur && lorem_sit && dolor_consectetur && amet_ipsum
87 See also: [`control_brace_style`](#control_brace_style).
89 ### Function arguments
91 #### `"Block"` (default):
96 fn lorem(ipsum: usize) {}
116 fn lorem(ipsum: usize) {}
118 fn lorem(ipsum: usize,
131 #### `"Block"` (default):
165 #### `"Block"` (default):
173 Adipiscing: Eq = usize,
174 Consectetur: Eq = usize,
181 adipiscing: Adipiscing,
182 consectetur: Consectetur,
192 fn lorem<Ipsum: Eq = usize,
196 Adipiscing: Eq = usize,
197 Consectetur: Eq = usize,
203 adipiscing: Adipiscing,
204 consectetur: Consectetur,
213 #### `"Block"` (default):
228 let lorem = Lorem { ipsum: dolor,
233 See also: [`struct_lit_single_line`](#struct_lit_single_line), [`indent_style`](#indent_style).
237 #### `"Block"` (default):
240 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
254 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
264 ## `use_small_heuristics`
266 Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'.
268 - **Default value**: `true`
269 - **Possible values**: `true`, `false`
272 #### `true` (default):
278 Sit { amet: Consectetur, adipiscing: Elit },
296 let lorem = Lorem { ipsum: dolor };
298 let lorem = if ipsum { dolor } else { sit };
315 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
322 let lorem = if ipsum {
332 Where to put a binary operator when a binary expression goes multiline.
334 - **Default value**: `"Front"`
335 - **Possible values**: `"Front"`, `"Back"`
338 #### `"Front"` (default):
342 let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo
343 || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
345 let sum = 123456789012345678901234567890 + 123456789012345678901234567890
346 + 123456789012345678901234567890;
348 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
349 ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
357 let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo ||
358 barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
360 let sum = 123456789012345678901234567890 + 123456789012345678901234567890 +
361 123456789012345678901234567890;
363 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..
364 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
368 ## `combine_control_expr`
370 Combine control expressions with function calls.
372 - **Default value**: `true`
373 - **Possible values**: `true`, `false`
376 #### `true` (default):
388 foo!(if let Some(..) = x {
401 foo!(while let Some(..) = x {
435 if let Some(..) = x {
452 while let Some(..) = x {
478 Maximum length of comments. No effect unless`wrap_comments = true`.
480 - **Default value**: `80`
481 - **Possible values**: any positive integer
484 **Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
486 #### `80` (default; comments shorter than `comment_width`):
488 // Lorem ipsum dolor sit amet, consectetur adipiscing elit.
491 #### `60` (comments longer than `comment_width`):
493 // Lorem ipsum dolor sit amet,
494 // consectetur adipiscing elit.
497 See also [`wrap_comments`](#wrap_comments).
499 ## `condense_wildcard_suffixes`
501 Replace strings of _ wildcards by a single .. in tuple patterns
503 - **Default value**: `false`
504 - **Possible values**: `true`, `false`
507 #### `false` (default):
511 let (lorem, ipsum, _, _) = (1, 2, 3, 4);
512 let (lorem, ipsum, ..) = (1, 2, 3, 4);
520 let (lorem, ipsum, ..) = (1, 2, 3, 4);
524 ## `control_brace_style`
526 Brace style for control flow constructs
528 - **Default value**: `"AlwaysSameLine"`
529 - **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
532 #### `"AlwaysSameLine"` (default):
544 #### `"AlwaysNextLine"`:
559 #### `"ClosingNextLine"`:
572 ## `disable_all_formatting`
574 Don't reformat anything
576 - **Default value**: `false`
577 - **Possible values**: `true`, `false`
580 ## `error_on_line_overflow`
582 Error if unable to get all lines within `max_width`, except for comments and string literals.
584 - **Default value**: `true`
585 - **Possible values**: `true`, `false`
588 See also [`max_width`](#max_width).
590 ## `error_on_unformatted`
592 Error if unable to get comments or string literals within `max_width`, or they are left with
593 trailing whitespaces.
595 - **Default value**: `false`
596 - **Possible values**: `true`, `false`
601 Argument density in functions
603 - **Default value**: `"Tall"`
604 - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
607 #### `"Tall"` (default):
611 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
613 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
622 consectetur: Consectetur,
623 adipiscing: Adipiscing,
632 consectetur: Consectetur,
633 adipiscing: Adipiscing,
645 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
647 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
652 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
653 adipiscing: Adipiscing, elit: Elit,
657 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
658 adipiscing: Adipiscing, elit: Elit,
690 consectetur: Consectetur,
691 adipiscing: Adipiscing,
700 consectetur: Consectetur,
701 adipiscing: Adipiscing,
712 Brace style for items
714 - **Default value**: `"SameLineWhere"`
715 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
720 #### `"SameLineWhere"` (default):
727 fn lorem(ipsum: usize) {
731 fn lorem<T>(ipsum: T)
733 T: Add + Sub + Mul + Div,
739 #### `"AlwaysNextLine"`:
747 fn lorem(ipsum: usize)
752 fn lorem<T>(ipsum: T)
754 T: Add + Sub + Mul + Div,
760 #### `"PreferSameLine"`:
767 fn lorem(ipsum: usize) {
771 fn lorem<T>(ipsum: T)
773 T: Add + Sub + Mul + Div, {
778 ### Structs and enums
780 #### `"SameLineWhere"` (default):
795 #### `"AlwaysNextLine"`:
811 #### `"PreferSameLine"`:
826 ## `empty_item_single_line`
828 Put empty-body functions and impls on a single line
830 - **Default value**: `true`
831 - **Possible values**: `true`, `false`
834 #### `true` (default):
852 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
857 Put single-expression functions on a single line
859 - **Default value**: `false`
860 - **Possible values**: `true`, `false`
863 #### `false` (default):
866 fn lorem() -> usize {
870 fn lorem() -> usize {
879 fn lorem() -> usize { 42 }
881 fn lorem() -> usize {
887 See also [`control_brace_style`](#control_brace_style).
890 ## `where_single_line`
892 To force single line where layout
894 - **Default value**: `false`
895 - **Possible values**: `true`, `false`
898 #### `false` (default):
913 where Option<T>: Ipsum
919 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
922 ## `force_explicit_abi`
924 Always print the abi for extern items
926 - **Default value**: `true`
927 - **Possible values**: `true`, `false`
930 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
932 #### `true` (default):
936 pub static lorem: c_int;
944 pub static lorem: c_int;
950 Format string literals where necessary
952 - **Default value**: `false`
953 - **Possible values**: `true`, `false`
956 #### `false` (default):
961 "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";
969 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \
970 consectetur adipiscing";
974 See also [`max_width`](#max_width).
978 Use tab characters for indentation, spaces for alignment
980 - **Default value**: `false`
981 - **Possible values**: `true`, `false`
984 #### `false` (default):
987 fn lorem() -> usize {
988 42 // spaces before 42
995 fn lorem() -> usize {
1000 See also: [`tab_spaces`](#tab_spaces).
1005 Indent style of imports
1007 - **Default Value**: `"Visual"`
1008 - **Possible values**: `"Block"`, `"Visual"`
1011 #### `"Visual"` (default):
1014 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1015 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1022 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1023 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1027 See also: [`imports_layout`](#imports_layout).
1031 Item layout inside a imports block
1033 - **Default value**: "Mixed"
1034 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1037 #### `"Mixed"` (default):
1040 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1042 use foo::{aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1043 eeeeeeeeeeeeeeeeee, ffffffffffffffffff};
1046 #### `"Horizontal"`:
1048 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1051 use foo::{xxx, yyy, zzz};
1053 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1056 #### `"HorizontalVertical"`:
1059 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1061 use foo::{aaaaaaaaaaaaaaaaaa,
1066 ffffffffffffffffff};
1085 ## `match_block_trailing_comma`
1087 Put a trailing comma after a block based match arm (non-block arms are not affected)
1089 - **Default value**: `false`
1090 - **Possible values**: `true`, `false`
1093 #### `false` (default):
1101 Lorem::Dolor => println!("dolor"),
1114 Lorem::Dolor => println!("dolor"),
1119 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1123 Maximum width of each line
1125 - **Default value**: `100`
1126 - **Possible values**: any positive integer
1129 See also [`error_on_line_overflow`](#error_on_line_overflow).
1133 Merge multiple derives into a single one.
1135 - **Default value**: `true`
1136 - **Possible values**: `true`, `false`
1139 #### `true` (default):
1142 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1149 #[derive(Eq, PartialEq)]
1151 #[derive(Copy, Clone)]
1155 ## `force_multiline_blocks`
1157 Force multiline closure and match arm bodies to be wrapped in a block
1159 - **Default value**: `false`
1160 - **Possible values**: `false`, `true`
1163 #### `false` (default):
1167 result.and_then(|maybe_value| match maybe_value {
1169 Some(value) => bar(),
1174 println!("Hello World");
1176 Some(dolor) => foo(),
1185 result.and_then(|maybe_value| {
1188 Some(value) => bar(),
1195 println!("Hello World");
1198 Some(dolor) => foo(),
1206 Unix or Windows line endings
1208 - **Default value**: `"Unix"`
1209 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1212 ## `normalize_comments`
1214 Convert /* */ comments to // comments where possible
1216 - **Default value**: `false`
1217 - **Possible values**: `true`, `false`
1220 #### `false` (default):
1224 fn dolor() -> usize {}
1227 fn adipiscing() -> usize {}
1234 fn dolor() -> usize {}
1237 fn adipiscing() -> usize {}
1240 ## `reorder_imported_names`
1242 Reorder lists of names in import statements alphabetically
1244 - **Default value**: `false`
1245 - **Possible values**: `true`, `false`
1248 #### `false` (default):
1251 use super::{lorem, ipsum, dolor, sit};
1257 use super::{dolor, ipsum, lorem, sit};
1260 See also [`reorder_imports`](#reorder_imports).
1262 ## `reorder_imports`
1264 Reorder import statements alphabetically
1266 - **Default value**: `false`
1267 - **Possible values**: `true`, `false`
1270 #### `false` (default):
1288 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1290 ## `reorder_imports_in_group`
1292 Reorder import statements in group
1294 - **Default value**: `false`
1295 - **Possible values**: `true`, `false`
1298 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1300 #### `true` (default):
1324 See also [`reorder_imports`](#reorder_imports).
1326 ## `reorder_extern_crates`
1328 Reorder `extern crate` statements alphabetically
1330 - **Default value**: `true`
1331 - **Possible values**: `true`, `false`
1334 #### `true` (default):
1353 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1355 ## `reorder_extern_crates_in_group`
1357 Reorder `extern crate` statements in group
1359 - **Default value**: `true`
1360 - **Possible values**: `true`, `false`
1363 #### `false` (default):
1365 This value has no influence beyond the effect of the [`reorder_extern_crates`](#reorder_extern_crates) option. Set [`reorder_extern_crates`](#reorder_extern_crates) to `false` if you do not want `extern crate` groups to be collapsed and ordered.
1369 **Note:** This only takes effect when [`reorder_extern_crates`](#reorder_extern_crates) is set to `true`.
1381 ## `reorder_modules`
1383 Reorder `mod` declarations alphabetically in group.
1385 - **Default value**: `true`
1386 - **Possible values**: `true`, `false`
1389 #### `true` (default)
1413 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1414 of the original source code.
1418 Report `TODO` items in comments.
1420 - **Default value**: `"Never"`
1421 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1424 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1425 it contains a `#X` (with `X` being a number) in parentheses following the
1426 `TODO`, `"Unnumbered"` will ignore it.
1428 See also [`report_fixme`](#report_fixme).
1432 Report `FIXME` items in comments.
1434 - **Default value**: `"Never"`
1435 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1438 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1439 it contains a `#X` (with `X` being a number) in parentheses following the
1440 `FIXME`, `"Unnumbered"` will ignore it.
1442 See also [`report_todo`](#report_todo).
1447 Don't reformat out of line modules
1449 - **Default value**: `false`
1450 - **Possible values**: `true`, `false`
1453 ## `space_after_colon`
1455 Leave a space after the colon.
1457 - **Default value**: `true`
1458 - **Possible values**: `true`, `false`
1461 #### `true` (default):
1464 fn lorem<T: Eq>(t: T) {
1465 let lorem: Dolor = Lorem {
1475 fn lorem<T:Eq>(t:T) {
1476 let lorem:Dolor = Lorem {
1483 See also: [`space_before_colon`](#space_before_colon).
1485 ## `space_before_colon`
1487 Leave a space before the colon.
1489 - **Default value**: `false`
1490 - **Possible values**: `true`, `false`
1493 #### `false` (default):
1496 fn lorem<T: Eq>(t: T) {
1497 let lorem: Dolor = Lorem {
1507 fn lorem<T : Eq>(t : T) {
1508 let lorem : Dolor = Lorem {
1515 See also: [`space_after_colon`](#space_after_colon).
1517 ## `struct_field_align_threshold`
1519 The maximum diff of width between struct fields to be aligned with each other.
1521 - **Default value** : 0
1522 - **Possible values**: any positive integer
1545 ## `spaces_around_ranges`
1547 Put spaces around the .., ..=, and ... range operators
1549 - **Default value**: `false`
1550 - **Possible values**: `true`, `false`
1553 #### `false` (default):
1581 let lorem = 0 .. 10;
1582 let ipsum = 0 ..= 10;
1601 ## `spaces_within_parens_and_brackets`
1603 Put spaces within non-empty generic arguments, parentheses, and square brackets
1605 - **Default value**: `false`
1606 - **Possible values**: `true`, `false`
1609 #### `false` (default):
1612 // generic arguments
1613 fn lorem<T: Eq>(t: T) {
1617 // non-empty parentheses
1618 fn lorem<T: Eq>(t: T) {
1619 let lorem = (ipsum, dolor);
1622 // non-empty square brackets
1623 fn lorem<T: Eq>(t: T) {
1624 let lorem: [usize; 2] = [ipsum, dolor];
1631 // generic arguments
1632 fn lorem< T: Eq >( t: T ) {
1636 // non-empty parentheses
1637 fn lorem< T: Eq >( t: T ) {
1638 let lorem = ( ipsum, dolor );
1641 // non-empty square brackets
1642 fn lorem< T: Eq >( t: T ) {
1643 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1647 ## `struct_lit_single_line`
1649 Put small struct literals on a single line
1651 - **Default value**: `true`
1652 - **Possible values**: `true`, `false`
1655 #### `true` (default):
1659 let lorem = Lorem { foo: bar, baz: ofo };
1674 See also: [`indent_style`](#indent_style).
1679 Number of spaces per tab
1681 - **Default value**: `4`
1682 - **Possible values**: any positive integer
1689 let ipsum = dolor();
1691 "amet consectetur adipiscing elit amet consectetur adipiscing elit amet consectetur.",
1700 let ipsum = dolor();
1702 "amet consectetur adipiscing elit amet consectetur adipiscing elit amet consectetur.",
1707 See also: [`hard_tabs`](#hard_tabs).
1712 How to handle trailing commas for lists
1714 - **Default value**: `"Vertical"`
1715 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1718 #### `"Vertical"` (default):
1722 let Lorem { ipsum, dolor, sit } = amet;
1738 let Lorem { ipsum, dolor, sit, } = amet;
1754 let Lorem { ipsum, dolor, sit } = amet;
1766 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1768 ## `trailing_semicolon`
1770 Add trailing semicolon after break, continue and return
1772 - **Default value**: `true`
1773 - **Possible values**: `true`, `false`
1776 #### `true` (default):
1790 ## `type_punctuation_density`
1792 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1794 - **Default value**: `"Wide"`
1795 - **Possible values**: `"Compressed"`, `"Wide"`
1798 #### `"Wide"` (default):
1801 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1806 #### `"Compressed"`:
1809 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1814 ## `use_field_init_shorthand`
1816 Use field initialize shorthand if possible.
1818 - **Default value**: `false`
1819 - **Possible values**: `true`, `false`
1822 #### `false` (default):
1835 let a = Foo { x: x, y: y, z: z };
1852 let a = Foo { x, y, z };
1856 ## `use_try_shorthand`
1858 Replace uses of the try! macro by the ? shorthand
1860 - **Default value**: `false`
1861 - **Possible values**: `true`, `false`
1864 #### `false` (default):
1868 let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1876 let lorem = ipsum.map(|dolor| dolor.sit())?;
1883 Break comments to fit on the line
1885 - **Default value**: `false`
1886 - **Possible values**: `true`, `false`
1889 #### `false` (default):
1892 // 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.
1898 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
1899 // sed do eiusmod tempor incididunt ut labore et dolore
1900 // magna aliqua. Ut enim ad minim veniam, quis nostrud
1901 // exercitation ullamco laboris nisi ut aliquip ex ea
1902 // commodo consequat.
1905 ## `match_arm_blocks`
1907 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1909 - **Default value**: `true`
1910 - **Possible values**: `true`, `false`
1913 #### `true` (default):
1919 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1921 false => println!("{}", sit),
1932 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1933 false => println!("{}", sit),
1938 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1942 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
1944 - **Default value**: `"Overwrite"`
1945 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
1948 ## `blank_lines_upper_bound`
1950 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
1951 lines are found, they are trimmed down to match this integer.
1953 - **Default value**: `1`
1954 - **Possible values**: *unsigned integer*
2005 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2007 ## `blank_lines_lower_bound`
2009 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
2010 them, additional blank lines are inserted.
2012 - **Default value**: `0`
2013 - **Possible values**: *unsigned integer*
2017 Original Code (rustfmt will not change it with the default value of `0`):
2046 ## `remove_blank_lines_at_start_or_end_of_block`
2048 Remove blank lines at the start or the end of a block.
2050 - **Default value**: `true`
2051 - **Possible values**: `true`, `false`
2059 let mut str = String::new();
2060 str.push_str("hello, ");
2061 str.push_str("world!");
2064 println!("{}", msg);
2075 let mut str = String::new();
2076 str.push_str("hello, ");
2077 str.push_str("world!");
2081 println!("{}", msg);
2086 ## `required_version`
2088 Require a specific version of rustfmt. If you want to make sure that the
2089 specific version of rustfmt is used in your CI, use this option.
2091 - **Default value**: `CARGO_PKG_VERSION`
2092 - **Possible values**: any published version (e.g. `"0.3.8"`)
2095 ## `hide_parse_errors`
2097 Do not show parse errors if the parser failed to parse files.
2099 - **Default value**: `false`
2100 - **Possible values**: `true`, `false`
2105 Whether to use colored output or not.
2107 - **Default value**: `"Auto"`
2108 - **Possible values**: "Auto", "Always", "Never"
2111 ## `unstable_features`
2113 Enable unstable features on stable channel.
2115 - **Default value**: `false`
2116 - **Possible values**: `true`, `false`
2119 ## `license_template_path`
2121 Check whether beginnings of files match a license template.
2123 - **Default value**: `""``
2124 - **Possible values**: path to a license template file
2127 A license template is a plain text file which is matched literally against the
2128 beginning of each source file, except for `{}`-delimited blocks, which are
2129 matched as regular expressions. The following license template therefore
2130 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
2131 Copyright 2018 The Rust Project Developers.`, etc.:
2134 // Copyright {\d+} The Rust Project Developers.
2137 `\{`, `\}` and `\\` match literal braces / backslashes.
2141 Skip formatting the specified files and directories.
2143 - **Default value**: format every files
2144 - **Possible values**: See an example below
2149 If you want to ignore specific files, put the following to your config file:
2158 If you want to ignore every file under `examples/`, put the following to your config file: