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 Rustfmt is unable to get all lines within `max_width`, except for comments and string
583 literals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug by
584 refactoring your code to avoid long/complex expressions, usually by extracting a local variable or
585 using a shorter name.
587 - **Default value**: `false`
588 - **Possible values**: `true`, `false`
591 See also [`max_width`](#max_width).
593 ## `error_on_unformatted`
595 Error if unable to get comments or string literals within `max_width`, or they are left with
596 trailing whitespaces.
598 - **Default value**: `false`
599 - **Possible values**: `true`, `false`
604 Argument density in functions
606 - **Default value**: `"Tall"`
607 - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
610 #### `"Tall"` (default):
614 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
616 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
625 consectetur: Consectetur,
626 adipiscing: Adipiscing,
635 consectetur: Consectetur,
636 adipiscing: Adipiscing,
648 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
650 fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
655 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
656 adipiscing: Adipiscing, elit: Elit,
660 ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
661 adipiscing: Adipiscing, elit: Elit,
693 consectetur: Consectetur,
694 adipiscing: Adipiscing,
703 consectetur: Consectetur,
704 adipiscing: Adipiscing,
715 Brace style for items
717 - **Default value**: `"SameLineWhere"`
718 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
723 #### `"SameLineWhere"` (default):
730 fn lorem(ipsum: usize) {
734 fn lorem<T>(ipsum: T)
736 T: Add + Sub + Mul + Div,
742 #### `"AlwaysNextLine"`:
750 fn lorem(ipsum: usize)
755 fn lorem<T>(ipsum: T)
757 T: Add + Sub + Mul + Div,
763 #### `"PreferSameLine"`:
770 fn lorem(ipsum: usize) {
774 fn lorem<T>(ipsum: T)
776 T: Add + Sub + Mul + Div, {
781 ### Structs and enums
783 #### `"SameLineWhere"` (default):
798 #### `"AlwaysNextLine"`:
814 #### `"PreferSameLine"`:
829 ## `empty_item_single_line`
831 Put empty-body functions and impls on a single line
833 - **Default value**: `true`
834 - **Possible values**: `true`, `false`
837 #### `true` (default):
855 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
860 Put single-expression functions on a single line
862 - **Default value**: `false`
863 - **Possible values**: `true`, `false`
866 #### `false` (default):
869 fn lorem() -> usize {
873 fn lorem() -> usize {
882 fn lorem() -> usize { 42 }
884 fn lorem() -> usize {
890 See also [`control_brace_style`](#control_brace_style).
893 ## `where_single_line`
895 Forces the `where` clause to be laid out on a single line.
897 - **Default value**: `false`
898 - **Possible values**: `true`, `false`
901 #### `false` (default):
916 where Option<T>: Ipsum
922 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
925 ## `force_explicit_abi`
927 Always print the abi for extern items
929 - **Default value**: `true`
930 - **Possible values**: `true`, `false`
933 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
935 #### `true` (default):
939 pub static lorem: c_int;
947 pub static lorem: c_int;
953 Format string literals where necessary
955 - **Default value**: `false`
956 - **Possible values**: `true`, `false`
959 #### `false` (default):
964 "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).
1008 Indent style of imports
1010 - **Default Value**: `"Visual"`
1011 - **Possible values**: `"Block"`, `"Visual"`
1014 #### `"Visual"` (default):
1017 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1018 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1025 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1026 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1030 See also: [`imports_layout`](#imports_layout).
1034 Item layout inside a imports block
1036 - **Default value**: "Mixed"
1037 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1040 #### `"Mixed"` (default):
1043 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1045 use foo::{aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1046 eeeeeeeeeeeeeeeeee, ffffffffffffffffff};
1049 #### `"Horizontal"`:
1051 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1054 use foo::{xxx, yyy, zzz};
1056 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1059 #### `"HorizontalVertical"`:
1062 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1064 use foo::{aaaaaaaaaaaaaaaaaa,
1069 ffffffffffffffffff};
1089 Merge multiple imports into a single nested import.
1091 - **Default value**: `false`
1092 - **Possible values**: `true`, `false`
1095 #### `false` (default):
1106 use foo::{a, b, c, d, e, f, g};
1110 ## `match_block_trailing_comma`
1112 Put a trailing comma after a block based match arm (non-block arms are not affected)
1114 - **Default value**: `false`
1115 - **Possible values**: `true`, `false`
1118 #### `false` (default):
1126 Lorem::Dolor => println!("dolor"),
1139 Lorem::Dolor => println!("dolor"),
1144 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1148 Maximum width of each line
1150 - **Default value**: `100`
1151 - **Possible values**: any positive integer
1154 See also [`error_on_line_overflow`](#error_on_line_overflow).
1158 Merge multiple derives into a single one.
1160 - **Default value**: `true`
1161 - **Possible values**: `true`, `false`
1164 #### `true` (default):
1167 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1174 #[derive(Eq, PartialEq)]
1176 #[derive(Copy, Clone)]
1180 ## `force_multiline_blocks`
1182 Force multiline closure and match arm bodies to be wrapped in a block
1184 - **Default value**: `false`
1185 - **Possible values**: `false`, `true`
1188 #### `false` (default):
1192 result.and_then(|maybe_value| match maybe_value {
1194 Some(value) => bar(),
1199 println!("Hello World");
1201 Some(dolor) => foo(),
1210 result.and_then(|maybe_value| {
1213 Some(value) => bar(),
1220 println!("Hello World");
1223 Some(dolor) => foo(),
1231 Unix or Windows line endings
1233 - **Default value**: `"Unix"`
1234 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1237 ## `normalize_comments`
1239 Convert /* */ comments to // comments where possible
1241 - **Default value**: `false`
1242 - **Possible values**: `true`, `false`
1245 #### `false` (default):
1249 fn dolor() -> usize {}
1252 fn adipiscing() -> usize {}
1259 fn dolor() -> usize {}
1262 fn adipiscing() -> usize {}
1265 ## `reorder_imported_names`
1267 Reorder lists of names in import statements alphabetically
1269 - **Default value**: `false`
1270 - **Possible values**: `true`, `false`
1273 #### `false` (default):
1276 use super::{lorem, ipsum, dolor, sit};
1282 use super::{dolor, ipsum, lorem, sit};
1285 See also [`reorder_imports`](#reorder_imports).
1287 ## `reorder_imports`
1289 Reorder import statements alphabetically
1291 - **Default value**: `false`
1292 - **Possible values**: `true`, `false`
1295 #### `false` (default):
1313 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1315 ## `reorder_imports_in_group`
1317 Reorder import statements in group
1319 - **Default value**: `false`
1320 - **Possible values**: `true`, `false`
1323 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1325 #### `true` (default):
1349 See also [`reorder_imports`](#reorder_imports).
1351 ## `reorder_extern_crates`
1353 Reorder `extern crate` statements alphabetically
1355 - **Default value**: `true`
1356 - **Possible values**: `true`, `false`
1359 #### `true` (default):
1378 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1380 ## `reorder_extern_crates_in_group`
1382 Reorder `extern crate` statements in group
1384 - **Default value**: `true`
1385 - **Possible values**: `true`, `false`
1388 #### `false` (default):
1390 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.
1394 **Note:** This only takes effect when [`reorder_extern_crates`](#reorder_extern_crates) is set to `true`.
1406 ## `reorder_modules`
1408 Reorder `mod` declarations alphabetically in group.
1410 - **Default value**: `true`
1411 - **Possible values**: `true`, `false`
1414 #### `true` (default)
1438 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1439 of the original source code.
1441 ## `reorder_impl_items`
1443 Reorder impl items. `type` and `const` are put first, then macros and methods.
1445 - **Default value**: `false`
1446 - **Possible values**: `true`, `false`
1449 #### `false` (default)
1454 impl Iterator for Dummy {
1455 fn next(&mut self) -> Option<Self::Item> {
1468 impl Iterator for Dummy {
1471 fn next(&mut self) -> Option<Self::Item> {
1479 Report `TODO` items in comments.
1481 - **Default value**: `"Never"`
1482 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1485 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1486 it contains a `#X` (with `X` being a number) in parentheses following the
1487 `TODO`, `"Unnumbered"` will ignore it.
1489 See also [`report_fixme`](#report_fixme).
1493 Report `FIXME` items in comments.
1495 - **Default value**: `"Never"`
1496 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1499 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1500 it contains a `#X` (with `X` being a number) in parentheses following the
1501 `FIXME`, `"Unnumbered"` will ignore it.
1503 See also [`report_todo`](#report_todo).
1508 Don't reformat out of line modules
1510 - **Default value**: `false`
1511 - **Possible values**: `true`, `false`
1514 ## `space_after_colon`
1516 Leave a space after the colon.
1518 - **Default value**: `true`
1519 - **Possible values**: `true`, `false`
1522 #### `true` (default):
1525 fn lorem<T: Eq>(t: T) {
1526 let lorem: Dolor = Lorem {
1536 fn lorem<T:Eq>(t:T) {
1537 let lorem:Dolor = Lorem {
1544 See also: [`space_before_colon`](#space_before_colon).
1546 ## `space_before_colon`
1548 Leave a space before the colon.
1550 - **Default value**: `false`
1551 - **Possible values**: `true`, `false`
1554 #### `false` (default):
1557 fn lorem<T: Eq>(t: T) {
1558 let lorem: Dolor = Lorem {
1568 fn lorem<T : Eq>(t : T) {
1569 let lorem : Dolor = Lorem {
1576 See also: [`space_after_colon`](#space_after_colon).
1578 ## `struct_field_align_threshold`
1580 The maximum diff of width between struct fields to be aligned with each other.
1582 - **Default value** : 0
1583 - **Possible values**: any positive integer
1606 ## `spaces_around_ranges`
1608 Put spaces around the .., ..=, and ... range operators
1610 - **Default value**: `false`
1611 - **Possible values**: `true`, `false`
1614 #### `false` (default):
1642 let lorem = 0 .. 10;
1643 let ipsum = 0 ..= 10;
1662 ## `spaces_within_parens_and_brackets`
1664 Put spaces within non-empty generic arguments, parentheses, and square brackets
1666 - **Default value**: `false`
1667 - **Possible values**: `true`, `false`
1670 #### `false` (default):
1673 // generic arguments
1674 fn lorem<T: Eq>(t: T) {
1678 // non-empty parentheses
1679 fn lorem<T: Eq>(t: T) {
1680 let lorem = (ipsum, dolor);
1683 // non-empty square brackets
1684 fn lorem<T: Eq>(t: T) {
1685 let lorem: [usize; 2] = [ipsum, dolor];
1692 // generic arguments
1693 fn lorem< T: Eq >( t: T ) {
1697 // non-empty parentheses
1698 fn lorem< T: Eq >( t: T ) {
1699 let lorem = ( ipsum, dolor );
1702 // non-empty square brackets
1703 fn lorem< T: Eq >( t: T ) {
1704 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1708 ## `struct_lit_single_line`
1710 Put small struct literals on a single line
1712 - **Default value**: `true`
1713 - **Possible values**: `true`, `false`
1716 #### `true` (default):
1720 let lorem = Lorem { foo: bar, baz: ofo };
1735 See also: [`indent_style`](#indent_style).
1740 Number of spaces per tab
1742 - **Default value**: `4`
1743 - **Possible values**: any positive integer
1750 let ipsum = dolor();
1752 "amet consectetur adipiscing elit amet",
1753 "consectetur adipiscing elit amet consectetur.",
1762 let ipsum = dolor();
1764 "amet consectetur adipiscing elit amet",
1765 "consectetur adipiscing elit amet consectetur.",
1770 See also: [`hard_tabs`](#hard_tabs).
1775 How to handle trailing commas for lists
1777 - **Default value**: `"Vertical"`
1778 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1781 #### `"Vertical"` (default):
1785 let Lorem { ipsum, dolor, sit } = amet;
1801 let Lorem { ipsum, dolor, sit, } = amet;
1817 let Lorem { ipsum, dolor, sit } = amet;
1829 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1831 ## `trailing_semicolon`
1833 Add trailing semicolon after break, continue and return
1835 - **Default value**: `true`
1836 - **Possible values**: `true`, `false`
1839 #### `true` (default):
1853 ## `type_punctuation_density`
1855 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1857 - **Default value**: `"Wide"`
1858 - **Possible values**: `"Compressed"`, `"Wide"`
1861 #### `"Wide"` (default):
1864 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1869 #### `"Compressed"`:
1872 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1877 ## `use_field_init_shorthand`
1879 Use field initialize shorthand if possible.
1881 - **Default value**: `false`
1882 - **Possible values**: `true`, `false`
1885 #### `false` (default):
1898 let a = Foo { x: x, y: y, z: z };
1915 let a = Foo { x, y, z };
1919 ## `use_try_shorthand`
1921 Replace uses of the try! macro by the ? shorthand
1923 - **Default value**: `false`
1924 - **Possible values**: `true`, `false`
1927 #### `false` (default):
1931 let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1939 let lorem = ipsum.map(|dolor| dolor.sit())?;
1946 Break comments to fit on the line
1948 - **Default value**: `false`
1949 - **Possible values**: `true`, `false`
1952 #### `false` (default):
1955 // 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.
1961 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
1962 // sed do eiusmod tempor incididunt ut labore et dolore
1963 // magna aliqua. Ut enim ad minim veniam, quis nostrud
1964 // exercitation ullamco laboris nisi ut aliquip ex ea
1965 // commodo consequat.
1968 ## `match_arm_blocks`
1970 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1972 - **Default value**: `true`
1973 - **Possible values**: `true`, `false`
1976 #### `true` (default):
1982 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1984 false => println!("{}", sit),
1995 foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1996 false => println!("{}", sit),
2001 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
2005 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2007 - **Default value**: `"Overwrite"`
2008 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
2011 ## `blank_lines_upper_bound`
2013 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
2014 lines are found, they are trimmed down to match this integer.
2016 - **Default value**: `1`
2017 - **Possible values**: *unsigned integer*
2068 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2070 ## `blank_lines_lower_bound`
2072 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
2073 them, additional blank lines are inserted.
2075 - **Default value**: `0`
2076 - **Possible values**: *unsigned integer*
2080 Original Code (rustfmt will not change it with the default value of `0`):
2109 ## `remove_blank_lines_at_start_or_end_of_block`
2111 Remove blank lines at the start or the end of a block.
2113 - **Default value**: `true`
2114 - **Possible values**: `true`, `false`
2122 let mut str = String::new();
2123 str.push_str("hello, ");
2124 str.push_str("world!");
2127 println!("{}", msg);
2138 let mut str = String::new();
2139 str.push_str("hello, ");
2140 str.push_str("world!");
2144 println!("{}", msg);
2149 ## `required_version`
2151 Require a specific version of rustfmt. If you want to make sure that the
2152 specific version of rustfmt is used in your CI, use this option.
2154 - **Default value**: `CARGO_PKG_VERSION`
2155 - **Possible values**: any published version (e.g. `"0.3.8"`)
2158 ## `hide_parse_errors`
2160 Do not show parse errors if the parser failed to parse files.
2162 - **Default value**: `false`
2163 - **Possible values**: `true`, `false`
2168 Whether to use colored output or not.
2170 - **Default value**: `"Auto"`
2171 - **Possible values**: "Auto", "Always", "Never"
2174 ## `unstable_features`
2176 Enable unstable features on stable channel.
2178 - **Default value**: `false`
2179 - **Possible values**: `true`, `false`
2182 ## `license_template_path`
2184 Check whether beginnings of files match a license template.
2186 - **Default value**: `""``
2187 - **Possible values**: path to a license template file
2190 A license template is a plain text file which is matched literally against the
2191 beginning of each source file, except for `{}`-delimited blocks, which are
2192 matched as regular expressions. The following license template therefore
2193 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
2194 Copyright 2018 The Rust Project Developers.`, etc.:
2197 // Copyright {\d+} The Rust Project Developers.
2200 `\{`, `\}` and `\\` match literal braces / backslashes.
2204 Skip formatting the specified files and directories.
2206 - **Default value**: format every files
2207 - **Possible values**: See an example below
2212 If you want to ignore specific files, put the following to your config file:
2221 If you want to ignore every file under `examples/`, put the following to your config file: