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_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 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):
97 See also: [`control_brace_style`](#control_brace_style).
99 ### Function arguments
101 #### `"Block"` (default):
106 fn lorem(ipsum: usize) {}
126 fn lorem(ipsum: usize) {}
128 fn lorem(ipsum: usize,
141 #### `"Block"` (default):
175 #### `"Block"` (default):
183 Adipiscing: Eq = usize,
184 Consectetur: Eq = usize,
191 adipiscing: Adipiscing,
192 consectetur: Consectetur,
202 fn lorem<Ipsum: Eq = usize,
206 Adipiscing: Eq = usize,
207 Consectetur: Eq = usize,
213 adipiscing: Adipiscing,
214 consectetur: Consectetur,
223 #### `"Block"` (default):
238 let lorem = Lorem { ipsum: dolor,
243 See also: [`struct_lit_single_line`](#struct_lit_single_line), [`indent_style`](#indent_style).
247 #### `"Block"` (default):
250 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
264 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
274 ## `use_small_heuristics`
276 Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'.
278 - **Default value**: `Default`
279 - **Possible values**: `Default`, `Off`, `Max`
282 #### `Default` (default):
288 Sit { amet: Consectetur, adipiscing: Elit },
306 let lorem = Lorem { ipsum: dolor };
308 let lorem = if ipsum { dolor } else { sit };
325 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
332 let lorem = if ipsum {
346 Sit { amet: Consectetur, adipiscing: Elit },
350 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
352 let lorem = Lorem { ipsum: dolor, sit: amet };
354 let lorem = if ipsum { dolor } else { sit };
360 Where to put a binary operator when a binary expression goes multiline.
362 - **Default value**: `"Front"`
363 - **Possible values**: `"Front"`, `"Back"`
366 #### `"Front"` (default):
370 let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo
371 || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
373 let sum = 123456789012345678901234567890
374 + 123456789012345678901234567890
375 + 123456789012345678901234567890;
377 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
378 ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
386 let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo ||
387 barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
389 let sum = 123456789012345678901234567890 +
390 123456789012345678901234567890 +
391 123456789012345678901234567890;
393 let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..
394 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
398 ## `combine_control_expr`
400 Combine control expressions with function calls.
402 - **Default value**: `true`
403 - **Possible values**: `true`, `false`
406 #### `true` (default):
418 foo!(if let Some(..) = x {
431 foo!(while let Some(..) = x {
465 if let Some(..) = x {
482 while let Some(..) = x {
508 Maximum length of comments. No effect unless`wrap_comments = true`.
510 - **Default value**: `80`
511 - **Possible values**: any positive integer
514 **Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
516 #### `80` (default; comments shorter than `comment_width`):
518 // Lorem ipsum dolor sit amet, consectetur adipiscing elit.
521 #### `60` (comments longer than `comment_width`):
523 // Lorem ipsum dolor sit amet,
524 // consectetur adipiscing elit.
527 See also [`wrap_comments`](#wrap_comments).
529 ## `condense_wildcard_suffixes`
531 Replace strings of _ wildcards by a single .. in tuple patterns
533 - **Default value**: `false`
534 - **Possible values**: `true`, `false`
537 #### `false` (default):
541 let (lorem, ipsum, _, _) = (1, 2, 3, 4);
542 let (lorem, ipsum, ..) = (1, 2, 3, 4);
550 let (lorem, ipsum, ..) = (1, 2, 3, 4);
554 ## `control_brace_style`
556 Brace style for control flow constructs
558 - **Default value**: `"AlwaysSameLine"`
559 - **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
562 #### `"AlwaysSameLine"` (default):
574 #### `"AlwaysNextLine"`:
589 #### `"ClosingNextLine"`:
602 ## `disable_all_formatting`
604 Don't reformat anything
606 - **Default value**: `false`
607 - **Possible values**: `true`, `false`
610 ## `error_on_line_overflow`
612 Error if Rustfmt is unable to get all lines within `max_width`, except for comments and string
613 literals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug by
614 refactoring your code to avoid long/complex expressions, usually by extracting a local variable or
615 using a shorter name.
617 - **Default value**: `false`
618 - **Possible values**: `true`, `false`
621 See also [`max_width`](#max_width).
623 ## `error_on_unformatted`
625 Error if unable to get comments or string literals within `max_width`, or they are left with
626 trailing whitespaces.
628 - **Default value**: `false`
629 - **Possible values**: `true`, `false`
634 Argument density in functions
636 - **Default value**: `"Tall"`
637 - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
640 #### `"Tall"` (default):
644 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
646 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
655 consectetur: Consectetur,
656 adipiscing: Adipiscing,
665 consectetur: Consectetur,
666 adipiscing: Adipiscing,
678 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
680 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
685 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
686 adipiscing: Adipiscing, elit: Elit,
690 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
691 adipiscing: Adipiscing, elit: Elit,
723 consectetur: Consectetur,
724 adipiscing: Adipiscing,
733 consectetur: Consectetur,
734 adipiscing: Adipiscing,
745 Brace style for items
747 - **Default value**: `"SameLineWhere"`
748 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
753 #### `"SameLineWhere"` (default):
760 fn lorem(ipsum: usize) {
764 fn lorem<T>(ipsum: T)
766 T: Add + Sub + Mul + Div,
772 #### `"AlwaysNextLine"`:
780 fn lorem(ipsum: usize)
785 fn lorem<T>(ipsum: T)
787 T: Add + Sub + Mul + Div,
793 #### `"PreferSameLine"`:
800 fn lorem(ipsum: usize) {
804 fn lorem<T>(ipsum: T)
806 T: Add + Sub + Mul + Div, {
811 ### Structs and enums
813 #### `"SameLineWhere"` (default):
828 #### `"AlwaysNextLine"`:
844 #### `"PreferSameLine"`:
859 ## `empty_item_single_line`
861 Put empty-body functions and impls on a single line
863 - **Default value**: `true`
864 - **Possible values**: `true`, `false`
867 #### `true` (default):
885 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
888 ## `enum_discrim_align_threshold`
890 The maximum length of enum variant having discriminant, that gets vertically aligned with others.
891 Variants without discriminants would be ignored for the purpose of alignment.
893 Note that this is not how much whitespace is inserted, but instead the longest variant name that
894 doesn't get ignored when aligning.
896 - **Default value** : 0
897 - **Possible values**: any positive integer
906 RandomLongVariantGoesHere = 10,
911 VeryLongVariantNameHereA = 0,
912 VeryLongVariantNameHereBb = 1,
913 VeryLongVariantNameHereCcc = 2,
923 RandomLongVariantGoesHere = 10,
928 VeryLongVariantNameHereA = 0,
929 VeryLongVariantNameHereBb = 1,
930 VeryLongVariantNameHereCcc = 2,
937 Put single-expression functions on a single line
939 - **Default value**: `false`
940 - **Possible values**: `true`, `false`
943 #### `false` (default):
946 fn lorem() -> usize {
950 fn lorem() -> usize {
959 fn lorem() -> usize { 42 }
961 fn lorem() -> usize {
967 See also [`control_brace_style`](#control_brace_style).
970 ## `where_single_line`
972 Forces the `where` clause to be laid out on a single line.
974 - **Default value**: `false`
975 - **Possible values**: `true`, `false`
978 #### `false` (default):
993 where Option<T>: Ipsum
999 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
1002 ## `force_explicit_abi`
1004 Always print the abi for extern items
1006 - **Default value**: `true`
1007 - **Possible values**: `true`, `false`
1010 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
1012 #### `true` (default):
1016 pub static lorem: c_int;
1024 pub static lorem: c_int;
1030 Format string literals where necessary
1032 - **Default value**: `false`
1033 - **Possible values**: `true`, `false`
1036 #### `false` (default):
1041 "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";
1049 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \
1050 consectetur adipiscing";
1054 See also [`max_width`](#max_width).
1056 ## `format_macro_matchers`
1058 Format the metavariable matching patterns in macros.
1060 - **Default value**: `false`
1061 - **Possible values**: `true`, `false`
1064 #### `false` (default):
1068 ($a: ident : $b: ty) => {
1071 ($a: ident $b: ident $c: ident) => {
1081 ($a:ident : $b:ty) => {
1084 ($a:ident $b:ident $c:ident) => {
1090 See also [`format_macro_bodies`](#format_macro_bodies).
1093 ## `format_macro_bodies`
1095 Format the bodies of macros.
1097 - **Default value**: `true`
1098 - **Possible values**: `true`, `false`
1101 #### `true` (default):
1105 ($a: ident : $b: ty) => {
1108 ($a: ident $b: ident $c: ident) => {
1118 ($a: ident : $b: ty) => { $a(42): $b; };
1119 ($a: ident $b: ident $c: ident) => { $a=$b+$c; };
1123 See also [`format_macro_matchers`](#format_macro_matchers).
1128 Use tab characters for indentation, spaces for alignment
1130 - **Default value**: `false`
1131 - **Possible values**: `true`, `false`
1134 #### `false` (default):
1137 fn lorem() -> usize {
1138 42 // spaces before 42
1145 fn lorem() -> usize {
1146 42 // tabs before 42
1150 See also: [`tab_spaces`](#tab_spaces).
1155 Indent style of imports
1157 - **Default Value**: `"Block"`
1158 - **Possible values**: `"Block"`, `"Visual"`
1161 #### `"Block"` (default):
1165 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1166 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1173 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1174 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1177 See also: [`imports_layout`](#imports_layout).
1181 Item layout inside a imports block
1183 - **Default value**: "Mixed"
1184 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1187 #### `"Mixed"` (default):
1190 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1193 aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1194 eeeeeeeeeeeeeeeeee, ffffffffffffffffff,
1198 #### `"Horizontal"`:
1200 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1203 use foo::{xxx, yyy, zzz};
1205 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1208 #### `"HorizontalVertical"`:
1211 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1244 Merge multiple imports into a single nested import.
1246 - **Default value**: `false`
1247 - **Possible values**: `true`, `false`
1250 #### `false` (default):
1261 use foo::{a, b, c, d, e, f, g};
1265 ## `match_block_trailing_comma`
1267 Put a trailing comma after a block based match arm (non-block arms are not affected)
1269 - **Default value**: `false`
1270 - **Possible values**: `true`, `false`
1273 #### `false` (default):
1281 Lorem::Dolor => println!("dolor"),
1294 Lorem::Dolor => println!("dolor"),
1299 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1303 Maximum width of each line
1305 - **Default value**: `100`
1306 - **Possible values**: any positive integer
1309 See also [`error_on_line_overflow`](#error_on_line_overflow).
1313 Merge multiple derives into a single one.
1315 - **Default value**: `true`
1316 - **Possible values**: `true`, `false`
1319 #### `true` (default):
1322 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1329 #[derive(Eq, PartialEq)]
1331 #[derive(Copy, Clone)]
1335 ## `force_multiline_blocks`
1337 Force multiline closure and match arm bodies to be wrapped in a block
1339 - **Default value**: `false`
1340 - **Possible values**: `false`, `true`
1343 #### `false` (default):
1347 result.and_then(|maybe_value| match maybe_value {
1349 Some(value) => bar(),
1354 println!("Hello World");
1356 Some(dolor) => foo(),
1365 result.and_then(|maybe_value| {
1368 Some(value) => bar(),
1375 println!("Hello World");
1378 Some(dolor) => foo(),
1386 Unix or Windows line endings
1388 - **Default value**: `"Auto"`
1389 - **Possible values**: `"Auto"`, `"Native"`, `"Unix"`, `"Windows"`
1392 #### `Auto` (default):
1394 The newline style is detected automatically on a per-file basis. Files
1395 with mixed line endings will be converted to the first detected line
1400 Line endings will be converted to `\r\n` on Windows and `\n` on all
1405 Line endings will be converted to `\n`.
1409 Line endings will be converted to `\r\n`.
1411 ## `normalize_comments`
1413 Convert /* */ comments to // comments where possible
1415 - **Default value**: `false`
1416 - **Possible values**: `true`, `false`
1419 #### `false` (default):
1423 fn dolor() -> usize {}
1426 fn adipiscing() -> usize {}
1433 fn dolor() -> usize {}
1436 fn adipiscing() -> usize {}
1439 ## `remove_nested_parens`
1441 Remove nested parens.
1443 - **Default value**: `true`,
1444 - **Possible values**: `true`, `false`
1448 #### `true` (default):
1463 ## `reorder_imports`
1465 Reorder import and extern crate statements alphabetically in groups (a group is
1466 separated by a newline).
1468 - **Default value**: `true`
1469 - **Possible values**: `true`, `false`
1472 #### `true` (default):
1491 ## `reorder_modules`
1493 Reorder `mod` declarations alphabetically in group.
1495 - **Default value**: `true`
1496 - **Possible values**: `true`, `false`
1499 #### `true` (default)
1523 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1524 of the original source code.
1526 ## `reorder_impl_items`
1528 Reorder impl items. `type` and `const` are put first, then macros and methods.
1530 - **Default value**: `false`
1531 - **Possible values**: `true`, `false`
1534 #### `false` (default)
1539 impl Iterator for Dummy {
1540 fn next(&mut self) -> Option<Self::Item> {
1553 impl Iterator for Dummy {
1556 fn next(&mut self) -> Option<Self::Item> {
1564 Report `TODO` items in comments.
1566 - **Default value**: `"Never"`
1567 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1570 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1571 it contains a `#X` (with `X` being a number) in parentheses following the
1572 `TODO`, `"Unnumbered"` will ignore it.
1574 See also [`report_fixme`](#report_fixme).
1578 Report `FIXME` items in comments.
1580 - **Default value**: `"Never"`
1581 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1584 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1585 it contains a `#X` (with `X` being a number) in parentheses following the
1586 `FIXME`, `"Unnumbered"` will ignore it.
1588 See also [`report_todo`](#report_todo).
1593 Don't reformat out of line modules
1595 - **Default value**: `false`
1596 - **Possible values**: `true`, `false`
1599 ## `space_after_colon`
1601 Leave a space after the colon.
1603 - **Default value**: `true`
1604 - **Possible values**: `true`, `false`
1607 #### `true` (default):
1610 fn lorem<T: Eq>(t: T) {
1611 let lorem: Dolor = Lorem {
1621 fn lorem<T:Eq>(t:T) {
1622 let lorem:Dolor = Lorem {
1629 See also: [`space_before_colon`](#space_before_colon).
1631 ## `space_before_colon`
1633 Leave a space before the colon.
1635 - **Default value**: `false`
1636 - **Possible values**: `true`, `false`
1639 #### `false` (default):
1642 fn lorem<T: Eq>(t: T) {
1643 let lorem: Dolor = Lorem {
1653 fn lorem<T : Eq>(t : T) {
1654 let lorem : Dolor = Lorem {
1661 See also: [`space_after_colon`](#space_after_colon).
1663 ## `struct_field_align_threshold`
1665 The maximum diff of width between struct fields to be aligned with each other.
1667 - **Default value** : 0
1668 - **Possible values**: any positive integer
1691 ## `spaces_around_ranges`
1693 Put spaces around the .., ..=, and ... range operators
1695 - **Default value**: `false`
1696 - **Possible values**: `true`, `false`
1699 #### `false` (default):
1727 let lorem = 0 .. 10;
1728 let ipsum = 0 ..= 10;
1747 ## `struct_lit_single_line`
1749 Put small struct literals on a single line
1751 - **Default value**: `true`
1752 - **Possible values**: `true`, `false`
1755 #### `true` (default):
1759 let lorem = Lorem { foo: bar, baz: ofo };
1774 See also: [`indent_style`](#indent_style).
1779 Number of spaces per tab
1781 - **Default value**: `4`
1782 - **Possible values**: any positive integer
1789 let ipsum = dolor();
1791 "amet consectetur adipiscing elit amet",
1792 "consectetur adipiscing elit amet consectetur.",
1801 let ipsum = dolor();
1803 "amet consectetur adipiscing elit amet",
1804 "consectetur adipiscing elit amet consectetur.",
1809 See also: [`hard_tabs`](#hard_tabs).
1814 How to handle trailing commas for lists
1816 - **Default value**: `"Vertical"`
1817 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1820 #### `"Vertical"` (default):
1824 let Lorem { ipsum, dolor, sit } = amet;
1840 let Lorem { ipsum, dolor, sit, } = amet;
1856 let Lorem { ipsum, dolor, sit } = amet;
1868 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1870 ## `trailing_semicolon`
1872 Add trailing semicolon after break, continue and return
1874 - **Default value**: `true`
1875 - **Possible values**: `true`, `false`
1878 #### `true` (default):
1892 ## `type_punctuation_density`
1894 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1896 - **Default value**: `"Wide"`
1897 - **Possible values**: `"Compressed"`, `"Wide"`
1900 #### `"Wide"` (default):
1903 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1908 #### `"Compressed"`:
1911 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1916 ## `use_field_init_shorthand`
1918 Use field initialize shorthand if possible.
1920 - **Default value**: `false`
1921 - **Possible values**: `true`, `false`
1924 #### `false` (default):
1937 let a = Foo { x: x, y: y, z: z };
1954 let a = Foo { x, y, z };
1958 ## `use_try_shorthand`
1960 Replace uses of the try! macro by the ? shorthand
1962 - **Default value**: `false`
1963 - **Possible values**: `true`, `false`
1966 #### `false` (default):
1970 let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1978 let lorem = ipsum.map(|dolor| dolor.sit())?;
1985 Break comments to fit on the line
1987 - **Default value**: `false`
1988 - **Possible values**: `true`, `false`
1991 #### `false` (default):
1994 // 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.
2000 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2001 // sed do eiusmod tempor incididunt ut labore et dolore
2002 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2003 // exercitation ullamco laboris nisi ut aliquip ex ea
2004 // commodo consequat.
2007 ## `match_arm_blocks`
2009 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2011 - **Default value**: `true`
2012 - **Possible values**: `true`, `false`
2015 #### `true` (default):
2021 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2023 false => println!("{}", sit),
2034 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2035 false => println!("{}", sit),
2040 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
2043 ## `blank_lines_upper_bound`
2045 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
2046 lines are found, they are trimmed down to match this integer.
2048 - **Default value**: `1`
2049 - **Possible values**: *unsigned integer*
2100 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2102 ## `blank_lines_lower_bound`
2104 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
2105 them, additional blank lines are inserted.
2107 - **Default value**: `0`
2108 - **Possible values**: *unsigned integer*
2112 Original Code (rustfmt will not change it with the default value of `0`):
2142 ## `required_version`
2144 Require a specific version of rustfmt. If you want to make sure that the
2145 specific version of rustfmt is used in your CI, use this option.
2147 - **Default value**: `CARGO_PKG_VERSION`
2148 - **Possible values**: any published version (e.g. `"0.3.8"`)
2151 ## `hide_parse_errors`
2153 Do not show parse errors if the parser failed to parse files.
2155 - **Default value**: `false`
2156 - **Possible values**: `true`, `false`
2161 Whether to use colored output or not.
2163 - **Default value**: `"Auto"`
2164 - **Possible values**: "Auto", "Always", "Never"
2167 ## `unstable_features`
2169 Enable unstable features on stable channel.
2171 - **Default value**: `false`
2172 - **Possible values**: `true`, `false`
2175 ## `license_template_path`
2177 Check whether beginnings of files match a license template.
2179 - **Default value**: `""``
2180 - **Possible values**: path to a license template file
2183 A license template is a plain text file which is matched literally against the
2184 beginning of each source file, except for `{}`-delimited blocks, which are
2185 matched as regular expressions. The following license template therefore
2186 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
2187 Copyright 2018 The Rust Project Developers.`, etc.:
2190 // Copyright {\d+} The Rust Project Developers.
2193 `\{`, `\}` and `\\` match literal braces / backslashes.
2197 Skip formatting the specified files and directories.
2199 - **Default value**: format every files
2200 - **Possible values**: See an example below
2205 If you want to ignore specific files, put the following to your config file:
2214 If you want to ignore every file under `examples/`, put the following to your config file:
2224 Specifies which edition is used by the parser.
2226 - **Default value**: `2015`
2227 - **Possible values**: `2015`, `2018`
2232 If you want to format code that requires edition 2018, add the following to your config file:
2238 ## `normalize_doc_attributes`
2240 Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.
2242 - **Default value**: `false`
2243 - **Possible values**: `true`, `false`
2246 #### `false` (default):
2249 #![doc = "Example documentation"]
2251 #[doc = "Example item documentation"]
2258 //! Example documentation
2260 /// Example item documentation
2270 Internal option, use `--backup`