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).
890 Put single-expression functions on a single line
892 - **Default value**: `false`
893 - **Possible values**: `true`, `false`
896 #### `false` (default):
899 fn lorem() -> usize {
903 fn lorem() -> usize {
912 fn lorem() -> usize { 42 }
914 fn lorem() -> usize {
920 See also [`control_brace_style`](#control_brace_style).
923 ## `where_single_line`
925 Forces the `where` clause to be laid out on a single line.
927 - **Default value**: `false`
928 - **Possible values**: `true`, `false`
931 #### `false` (default):
946 where Option<T>: Ipsum
952 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
955 ## `force_explicit_abi`
957 Always print the abi for extern items
959 - **Default value**: `true`
960 - **Possible values**: `true`, `false`
963 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
965 #### `true` (default):
969 pub static lorem: c_int;
977 pub static lorem: c_int;
983 Format string literals where necessary
985 - **Default value**: `false`
986 - **Possible values**: `true`, `false`
989 #### `false` (default):
994 "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";
1002 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \
1003 consectetur adipiscing";
1007 See also [`max_width`](#max_width).
1009 ## `format_macro_matchers`
1011 Format the metavariable matching patterns in macros.
1013 - **Default value**: `false`
1014 - **Possible values**: `true`, `false`
1017 #### `false` (default):
1021 ($a: ident : $b: ty) => {
1024 ($a: ident $b: ident $c: ident) => {
1034 ($a:ident : $b:ty) => {
1037 ($a:ident $b:ident $c:ident) => {
1043 See also [`format_macro_bodies`](#format_macro_bodies).
1046 ## `format_macro_bodies`
1048 Format the bodies of macros.
1050 - **Default value**: `true`
1051 - **Possible values**: `true`, `false`
1054 #### `true` (default):
1058 ($a: ident : $b: ty) => {
1061 ($a: ident $b: ident $c: ident) => {
1071 ($a: ident : $b: ty) => { $a(42): $b; };
1072 ($a: ident $b: ident $c: ident) => { $a=$b+$c; };
1076 See also [`format_macro_matchers`](#format_macro_matchers).
1081 Use tab characters for indentation, spaces for alignment
1083 - **Default value**: `false`
1084 - **Possible values**: `true`, `false`
1087 #### `false` (default):
1090 fn lorem() -> usize {
1091 42 // spaces before 42
1098 fn lorem() -> usize {
1099 42 // tabs before 42
1103 See also: [`tab_spaces`](#tab_spaces).
1108 Indent style of imports
1110 - **Default Value**: `"Block"`
1111 - **Possible values**: `"Block"`, `"Visual"`
1114 #### `"Block"` (default):
1118 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1119 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1126 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1127 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1130 See also: [`imports_layout`](#imports_layout).
1134 Item layout inside a imports block
1136 - **Default value**: "Mixed"
1137 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1140 #### `"Mixed"` (default):
1143 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1146 aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1147 eeeeeeeeeeeeeeeeee, ffffffffffffffffff,
1151 #### `"Horizontal"`:
1153 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1156 use foo::{xxx, yyy, zzz};
1158 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1161 #### `"HorizontalVertical"`:
1164 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1197 Merge multiple imports into a single nested import.
1199 - **Default value**: `false`
1200 - **Possible values**: `true`, `false`
1203 #### `false` (default):
1214 use foo::{a, b, c, d, e, f, g};
1218 ## `match_block_trailing_comma`
1220 Put a trailing comma after a block based match arm (non-block arms are not affected)
1222 - **Default value**: `false`
1223 - **Possible values**: `true`, `false`
1226 #### `false` (default):
1234 Lorem::Dolor => println!("dolor"),
1247 Lorem::Dolor => println!("dolor"),
1252 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1256 Maximum width of each line
1258 - **Default value**: `100`
1259 - **Possible values**: any positive integer
1262 See also [`error_on_line_overflow`](#error_on_line_overflow).
1266 Merge multiple derives into a single one.
1268 - **Default value**: `true`
1269 - **Possible values**: `true`, `false`
1272 #### `true` (default):
1275 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1282 #[derive(Eq, PartialEq)]
1284 #[derive(Copy, Clone)]
1288 ## `force_multiline_blocks`
1290 Force multiline closure and match arm bodies to be wrapped in a block
1292 - **Default value**: `false`
1293 - **Possible values**: `false`, `true`
1296 #### `false` (default):
1300 result.and_then(|maybe_value| match maybe_value {
1302 Some(value) => bar(),
1307 println!("Hello World");
1309 Some(dolor) => foo(),
1318 result.and_then(|maybe_value| {
1321 Some(value) => bar(),
1328 println!("Hello World");
1331 Some(dolor) => foo(),
1339 Unix or Windows line endings
1341 - **Default value**: `"Auto"`
1342 - **Possible values**: `"Auto"`, `"Native"`, `"Unix"`, `"Windows"`
1345 #### `Auto` (default):
1347 The newline style is detected automatically on a per-file basis. Files
1348 with mixed line endings will be converted to the first detected line
1353 Line endings will be converted to `\r\n` on Windows and `\n` on all
1358 Line endings will be converted to `\n`.
1362 Line endings will be converted to `\r\n`.
1364 ## `normalize_comments`
1366 Convert /* */ comments to // comments where possible
1368 - **Default value**: `false`
1369 - **Possible values**: `true`, `false`
1372 #### `false` (default):
1376 fn dolor() -> usize {}
1379 fn adipiscing() -> usize {}
1386 fn dolor() -> usize {}
1389 fn adipiscing() -> usize {}
1392 ## `remove_nested_parens`
1394 Remove nested parens.
1396 - **Default value**: `true`,
1397 - **Possible values**: `true`, `false`
1401 #### `true` (default):
1416 ## `reorder_imports`
1418 Reorder import and extern crate statements alphabetically in groups (a group is
1419 separated by a newline).
1421 - **Default value**: `true`
1422 - **Possible values**: `true`, `false`
1425 #### `true` (default):
1444 ## `reorder_modules`
1446 Reorder `mod` declarations alphabetically in group.
1448 - **Default value**: `true`
1449 - **Possible values**: `true`, `false`
1452 #### `true` (default)
1476 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1477 of the original source code.
1479 ## `reorder_impl_items`
1481 Reorder impl items. `type` and `const` are put first, then macros and methods.
1483 - **Default value**: `false`
1484 - **Possible values**: `true`, `false`
1487 #### `false` (default)
1492 impl Iterator for Dummy {
1493 fn next(&mut self) -> Option<Self::Item> {
1506 impl Iterator for Dummy {
1509 fn next(&mut self) -> Option<Self::Item> {
1517 Report `TODO` items in comments.
1519 - **Default value**: `"Never"`
1520 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1523 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1524 it contains a `#X` (with `X` being a number) in parentheses following the
1525 `TODO`, `"Unnumbered"` will ignore it.
1527 See also [`report_fixme`](#report_fixme).
1531 Report `FIXME` items in comments.
1533 - **Default value**: `"Never"`
1534 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1537 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1538 it contains a `#X` (with `X` being a number) in parentheses following the
1539 `FIXME`, `"Unnumbered"` will ignore it.
1541 See also [`report_todo`](#report_todo).
1546 Don't reformat out of line modules
1548 - **Default value**: `false`
1549 - **Possible values**: `true`, `false`
1552 ## `space_after_colon`
1554 Leave a space after the colon.
1556 - **Default value**: `true`
1557 - **Possible values**: `true`, `false`
1560 #### `true` (default):
1563 fn lorem<T: Eq>(t: T) {
1564 let lorem: Dolor = Lorem {
1574 fn lorem<T:Eq>(t:T) {
1575 let lorem:Dolor = Lorem {
1582 See also: [`space_before_colon`](#space_before_colon).
1584 ## `space_before_colon`
1586 Leave a space before the colon.
1588 - **Default value**: `false`
1589 - **Possible values**: `true`, `false`
1592 #### `false` (default):
1595 fn lorem<T: Eq>(t: T) {
1596 let lorem: Dolor = Lorem {
1606 fn lorem<T : Eq>(t : T) {
1607 let lorem : Dolor = Lorem {
1614 See also: [`space_after_colon`](#space_after_colon).
1616 ## `struct_field_align_threshold`
1618 The maximum diff of width between struct fields to be aligned with each other.
1620 - **Default value** : 0
1621 - **Possible values**: any positive integer
1644 ## `spaces_around_ranges`
1646 Put spaces around the .., ..=, and ... range operators
1648 - **Default value**: `false`
1649 - **Possible values**: `true`, `false`
1652 #### `false` (default):
1680 let lorem = 0 .. 10;
1681 let ipsum = 0 ..= 10;
1700 ## `struct_lit_single_line`
1702 Put small struct literals on a single line
1704 - **Default value**: `true`
1705 - **Possible values**: `true`, `false`
1708 #### `true` (default):
1712 let lorem = Lorem { foo: bar, baz: ofo };
1727 See also: [`indent_style`](#indent_style).
1732 Number of spaces per tab
1734 - **Default value**: `4`
1735 - **Possible values**: any positive integer
1742 let ipsum = dolor();
1744 "amet consectetur adipiscing elit amet",
1745 "consectetur adipiscing elit amet consectetur.",
1754 let ipsum = dolor();
1756 "amet consectetur adipiscing elit amet",
1757 "consectetur adipiscing elit amet consectetur.",
1762 See also: [`hard_tabs`](#hard_tabs).
1767 How to handle trailing commas for lists
1769 - **Default value**: `"Vertical"`
1770 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1773 #### `"Vertical"` (default):
1777 let Lorem { ipsum, dolor, sit } = amet;
1793 let Lorem { ipsum, dolor, sit, } = amet;
1809 let Lorem { ipsum, dolor, sit } = amet;
1821 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1823 ## `trailing_semicolon`
1825 Add trailing semicolon after break, continue and return
1827 - **Default value**: `true`
1828 - **Possible values**: `true`, `false`
1831 #### `true` (default):
1845 ## `type_punctuation_density`
1847 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1849 - **Default value**: `"Wide"`
1850 - **Possible values**: `"Compressed"`, `"Wide"`
1853 #### `"Wide"` (default):
1856 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1861 #### `"Compressed"`:
1864 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1869 ## `use_field_init_shorthand`
1871 Use field initialize shorthand if possible.
1873 - **Default value**: `false`
1874 - **Possible values**: `true`, `false`
1877 #### `false` (default):
1890 let a = Foo { x: x, y: y, z: z };
1907 let a = Foo { x, y, z };
1911 ## `use_try_shorthand`
1913 Replace uses of the try! macro by the ? shorthand
1915 - **Default value**: `false`
1916 - **Possible values**: `true`, `false`
1919 #### `false` (default):
1923 let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1931 let lorem = ipsum.map(|dolor| dolor.sit())?;
1938 Break comments to fit on the line
1940 - **Default value**: `false`
1941 - **Possible values**: `true`, `false`
1944 #### `false` (default):
1947 // 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.
1953 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
1954 // sed do eiusmod tempor incididunt ut labore et dolore
1955 // magna aliqua. Ut enim ad minim veniam, quis nostrud
1956 // exercitation ullamco laboris nisi ut aliquip ex ea
1957 // commodo consequat.
1960 ## `match_arm_blocks`
1962 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1964 - **Default value**: `true`
1965 - **Possible values**: `true`, `false`
1968 #### `true` (default):
1974 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1976 false => println!("{}", sit),
1987 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1988 false => println!("{}", sit),
1993 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1996 ## `blank_lines_upper_bound`
1998 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
1999 lines are found, they are trimmed down to match this integer.
2001 - **Default value**: `1`
2002 - **Possible values**: *unsigned integer*
2053 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2055 ## `blank_lines_lower_bound`
2057 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
2058 them, additional blank lines are inserted.
2060 - **Default value**: `0`
2061 - **Possible values**: *unsigned integer*
2065 Original Code (rustfmt will not change it with the default value of `0`):
2095 ## `required_version`
2097 Require a specific version of rustfmt. If you want to make sure that the
2098 specific version of rustfmt is used in your CI, use this option.
2100 - **Default value**: `CARGO_PKG_VERSION`
2101 - **Possible values**: any published version (e.g. `"0.3.8"`)
2104 ## `hide_parse_errors`
2106 Do not show parse errors if the parser failed to parse files.
2108 - **Default value**: `false`
2109 - **Possible values**: `true`, `false`
2114 Whether to use colored output or not.
2116 - **Default value**: `"Auto"`
2117 - **Possible values**: "Auto", "Always", "Never"
2120 ## `unstable_features`
2122 Enable unstable features on stable channel.
2124 - **Default value**: `false`
2125 - **Possible values**: `true`, `false`
2128 ## `license_template_path`
2130 Check whether beginnings of files match a license template.
2132 - **Default value**: `""``
2133 - **Possible values**: path to a license template file
2136 A license template is a plain text file which is matched literally against the
2137 beginning of each source file, except for `{}`-delimited blocks, which are
2138 matched as regular expressions. The following license template therefore
2139 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
2140 Copyright 2018 The Rust Project Developers.`, etc.:
2143 // Copyright {\d+} The Rust Project Developers.
2146 `\{`, `\}` and `\\` match literal braces / backslashes.
2150 Skip formatting the specified files and directories.
2152 - **Default value**: format every files
2153 - **Possible values**: See an example below
2158 If you want to ignore specific files, put the following to your config file:
2167 If you want to ignore every file under `examples/`, put the following to your config file:
2177 Specifies which edition is used by the parser.
2179 - **Default value**: `2015`
2180 - **Possible values**: `2015`, `2018`
2185 If you want to format code that requires edition 2018, add the following to your config file:
2191 ## `normalize_doc_attributes`
2193 Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.
2195 - **Default value**: `false`
2196 - **Possible values**: `true`, `false`
2199 #### `false` (default):
2202 #![doc = "Example documentation"]
2204 #[doc = "Example item documentation"]
2211 //! Example documentation
2213 /// Example item documentation
2223 Internal option, use `--backup`