]> git.lizzy.rs Git - rust.git/blob - Configurations.md
ca804b2f7f2581b53966488df1b1edb0989a4753
[rust.git] / Configurations.md
1 # Configuring Rustfmt
2
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.
4
5 A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
6
7 ```toml
8 indent_style = "Block"
9 reorder_imported_names = true
10 ```
11
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.
15
16 # Configuration Options
17
18 Below you find a detailed visual guide on all the supported configuration options of rustfmt:
19
20
21 ## `indent_style`
22
23 Indent on expressions or items.
24
25 - **Default value**: `"Block"`
26 - **Possible values**: `"Block"`, `"Visual"`
27 - **Stable**: No
28
29 ### Array
30
31 #### `"Block"` (default):
32
33 ```rust
34 fn main() {
35     let lorem = vec![
36         "ipsum",
37         "dolor",
38         "sit",
39         "amet",
40         "consectetur",
41         "adipiscing",
42         "elit",
43     ];
44 }
45 ```
46
47 #### `"Visual"`:
48
49 ```rust
50 fn main() {
51     let lorem = vec!["ipsum",
52                      "dolor",
53                      "sit",
54                      "amet",
55                      "consectetur",
56                      "adipiscing",
57                      "elit"];
58 }
59 ```
60
61 ### Control flow
62
63 #### `"Block"` (default):
64
65 ```rust
66 fn main() {
67     if lorem_ipsum && dolor_sit && amet_consectetur && lorem_sit && dolor_consectetur && amet_ipsum
68         && lorem_consectetur
69     {
70         // ...
71     }
72 }
73 ```
74
75 #### `"Visual"`:
76
77 ```rust
78 fn main() {
79     if lorem_ipsum && dolor_sit && amet_consectetur && lorem_sit && dolor_consectetur && amet_ipsum
80        && lorem_consectetur
81     {
82         // ...
83     }
84 }
85 ```
86
87 See also: [`control_brace_style`](#control_brace_style).
88
89 ### Function arguments
90
91 #### `"Block"` (default):
92
93 ```rust
94 fn lorem() {}
95
96 fn lorem(ipsum: usize) {}
97
98 fn lorem(
99     ipsum: usize,
100     dolor: usize,
101     sit: usize,
102     amet: usize,
103     consectetur: usize,
104     adipiscing: usize,
105     elit: usize,
106 ) {
107     // body
108 }
109 ```
110
111 #### `"Visual"`:
112
113 ```rust
114 fn lorem() {}
115
116 fn lorem(ipsum: usize) {}
117
118 fn lorem(ipsum: usize,
119          dolor: usize,
120          sit: usize,
121          amet: usize,
122          consectetur: usize,
123          adipiscing: usize,
124          elit: usize) {
125     // body
126 }
127 ```
128
129 ### Function calls
130
131 #### `"Block"` (default):
132
133 ```rust
134 fn main() {
135     lorem(
136         "lorem",
137         "ipsum",
138         "dolor",
139         "sit",
140         "amet",
141         "consectetur",
142         "adipiscing",
143         "elit",
144     );
145 }
146 ```
147
148 #### `"Visual"`:
149
150 ```rust
151 fn main() {
152     lorem("lorem",
153           "ipsum",
154           "dolor",
155           "sit",
156           "amet",
157           "consectetur",
158           "adipiscing",
159           "elit");
160 }
161 ```
162
163 ### Generics
164
165 #### `"Block"` (default):
166
167 ```rust
168 fn lorem<
169     Ipsum: Eq = usize,
170     Dolor: Eq = usize,
171     Sit: Eq = usize,
172     Amet: Eq = usize,
173     Adipiscing: Eq = usize,
174     Consectetur: Eq = usize,
175     Elit: Eq = usize,
176 >(
177     ipsum: Ipsum,
178     dolor: Dolor,
179     sit: Sit,
180     amet: Amet,
181     adipiscing: Adipiscing,
182     consectetur: Consectetur,
183     elit: Elit,
184 ) -> T {
185     // body
186 }
187 ```
188
189 #### `"Visual"`:
190
191 ```rust
192 fn lorem<Ipsum: Eq = usize,
193          Dolor: Eq = usize,
194          Sit: Eq = usize,
195          Amet: Eq = usize,
196          Adipiscing: Eq = usize,
197          Consectetur: Eq = usize,
198          Elit: Eq = usize>(
199     ipsum: Ipsum,
200     dolor: Dolor,
201     sit: Sit,
202     amet: Amet,
203     adipiscing: Adipiscing,
204     consectetur: Consectetur,
205     elit: Elit)
206     -> T {
207     // body
208 }
209 ```
210
211 #### Struct
212
213 #### `"Block"` (default):
214
215 ```rust
216 fn main() {
217     let lorem = Lorem {
218         ipsum: dolor,
219         sit: amet,
220     };
221 }
222 ```
223
224 #### `"Visual"`:
225
226 ```rust
227 fn main() {
228     let lorem = Lorem { ipsum: dolor,
229                         sit: amet, };
230 }
231 ```
232
233 See also: [`struct_lit_single_line`](#struct_lit_single_line), [`indent_style`](#indent_style).
234
235 ### Where predicates
236
237 #### `"Block"` (default):
238
239 ```rust
240 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
241 where
242     Ipsum: Eq,
243     Dolor: Eq,
244     Sit: Eq,
245     Amet: Eq,
246 {
247     // body
248 }
249 ```
250
251 #### `"Visual"`:
252
253 ```rust
254 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
255     where Ipsum: Eq,
256           Dolor: Eq,
257           Sit: Eq,
258           Amet: Eq
259 {
260     // body
261 }
262 ```
263
264 ## `use_small_heuristics`
265
266 Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'.
267
268 - **Default value**: `true`
269 - **Possible values**: `true`, `false`
270 - **Stable**: No
271
272 #### `true` (default):
273
274 ```rust
275 enum Lorem {
276     Ipsum,
277     Dolor(bool),
278     Sit { amet: Consectetur, adipiscing: Elit },
279 }
280
281 fn main() {
282     lorem(
283         "lorem",
284         "ipsum",
285         "dolor",
286         "sit",
287         "amet",
288         "consectetur",
289         "adipiscing",
290     );
291
292     let lorem = Lorem {
293         ipsum: dolor,
294         sit: amet,
295     };
296     let lorem = Lorem { ipsum: dolor };
297
298     let lorem = if ipsum { dolor } else { sit };
299 }
300 ```
301
302 #### `false`:
303
304 ```rust
305 enum Lorem {
306     Ipsum,
307     Dolor(bool),
308     Sit {
309         amet: Consectetur,
310         adipiscing: Elit,
311     },
312 }
313
314 fn main() {
315     lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");
316
317     let lorem = Lorem {
318         ipsum: dolor,
319         sit: amet,
320     };
321
322     let lorem = if ipsum {
323         dolor
324     } else {
325         sit
326     };
327 }
328 ```
329
330 ## `binop_separator`
331
332 Where to put a binary operator when a binary expression goes multiline.
333
334 - **Default value**: `"Front"`
335 - **Possible values**: `"Front"`, `"Back"`
336 - **Stable**: No
337
338 #### `"Front"` (default):
339
340 ```rust
341 fn main() {
342     let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo
343         || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
344
345     let sum = 123456789012345678901234567890 + 123456789012345678901234567890
346         + 123456789012345678901234567890;
347
348     let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
349         ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
350 }
351 ```
352
353 #### `"Back"`:
354
355 ```rust
356 fn main() {
357     let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo ||
358         barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;
359
360     let sum = 123456789012345678901234567890 + 123456789012345678901234567890 +
361         123456789012345678901234567890;
362
363     let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..
364         bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
365 }
366 ```
367
368 ## `combine_control_expr`
369
370 Combine control expressions with function calls.
371
372 - **Default value**: `true`
373 - **Possible values**: `true`, `false`
374 - **Stable**: No
375
376 #### `true` (default):
377
378 ```rust
379 fn example() {
380     // If
381     foo!(if x {
382         foo();
383     } else {
384         bar();
385     });
386
387     // IfLet
388     foo!(if let Some(..) = x {
389         foo();
390     } else {
391         bar();
392     });
393
394     // While
395     foo!(while x {
396         foo();
397         bar();
398     });
399
400     // WhileLet
401     foo!(while let Some(..) = x {
402         foo();
403         bar();
404     });
405
406     // ForLoop
407     foo!(for x in y {
408         foo();
409         bar();
410     });
411
412     // Loop
413     foo!(loop {
414         foo();
415         bar();
416     });
417 }
418 ```
419
420 #### `false`:
421
422 ```rust
423 fn example() {
424     // If
425     foo!(
426         if x {
427             foo();
428         } else {
429             bar();
430         }
431     );
432
433     // IfLet
434     foo!(
435         if let Some(..) = x {
436             foo();
437         } else {
438             bar();
439         }
440     );
441
442     // While
443     foo!(
444         while x {
445             foo();
446             bar();
447         }
448     );
449
450     // WhileLet
451     foo!(
452         while let Some(..) = x {
453             foo();
454             bar();
455         }
456     );
457
458     // ForLoop
459     foo!(
460         for x in y {
461             foo();
462             bar();
463         }
464     );
465
466     // Loop
467     foo!(
468         loop {
469             foo();
470             bar();
471         }
472     );
473 }
474 ```
475
476 ## `comment_width`
477
478 Maximum length of comments. No effect unless`wrap_comments = true`.
479
480 - **Default value**: `80`
481 - **Possible values**: any positive integer
482 - **Stable**: No
483
484 **Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
485
486 #### `80` (default; comments shorter than `comment_width`):
487 ```rust
488 // Lorem ipsum dolor sit amet, consectetur adipiscing elit.
489 ```
490
491 #### `60` (comments longer than `comment_width`):
492 ```rust
493 // Lorem ipsum dolor sit amet,
494 // consectetur adipiscing elit.
495 ```
496
497 See also [`wrap_comments`](#wrap_comments).
498
499 ## `condense_wildcard_suffixes`
500
501 Replace strings of _ wildcards by a single .. in tuple patterns
502
503 - **Default value**: `false`
504 - **Possible values**: `true`, `false`
505 - **Stable**: No
506
507 #### `false` (default):
508
509 ```rust
510 fn main() {
511     let (lorem, ipsum, _, _) = (1, 2, 3, 4);
512     let (lorem, ipsum, ..) = (1, 2, 3, 4);
513 }
514 ```
515
516 #### `true`:
517
518 ```rust
519 fn main() {
520     let (lorem, ipsum, ..) = (1, 2, 3, 4);
521 }
522 ```
523
524 ## `control_brace_style`
525
526 Brace style for control flow constructs
527
528 - **Default value**: `"AlwaysSameLine"`
529 - **Possible values**: `"AlwaysNextLine"`, `"AlwaysSameLine"`, `"ClosingNextLine"`
530 - **Stable**: No
531
532 #### `"AlwaysSameLine"` (default):
533
534 ```rust
535 fn main() {
536     if lorem {
537         println!("ipsum!");
538     } else {
539         println!("dolor!");
540     }
541 }
542 ```
543
544 #### `"AlwaysNextLine"`:
545
546 ```rust
547 fn main() {
548     if lorem
549     {
550         println!("ipsum!");
551     }
552     else
553     {
554         println!("dolor!");
555     }
556 }
557 ```
558
559 #### `"ClosingNextLine"`:
560
561 ```rust
562 fn main() {
563     if lorem {
564         println!("ipsum!");
565     }
566     else {
567         println!("dolor!");
568     }
569 }
570 ```
571
572 ## `disable_all_formatting`
573
574 Don't reformat anything
575
576 - **Default value**: `false`
577 - **Possible values**: `true`, `false`
578 - **Stable**: No
579
580 ## `error_on_line_overflow`
581
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.
586
587 - **Default value**: `false`
588 - **Possible values**: `true`, `false`
589 - **Stable**: No
590
591 See also [`max_width`](#max_width).
592
593 ## `error_on_unformatted`
594
595 Error if unable to get comments or string literals within `max_width`, or they are left with
596 trailing whitespaces.
597
598 - **Default value**: `false`
599 - **Possible values**: `true`, `false`
600 - **Stable**: No
601
602 ## `fn_args_density`
603
604 Argument density in functions
605
606 - **Default value**: `"Tall"`
607 - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
608 - **Stable**: No
609
610 #### `"Tall"` (default):
611
612 ```rust
613 trait Lorem {
614     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
615
616     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
617         // body
618     }
619
620     fn lorem(
621         ipsum: Ipsum,
622         dolor: Dolor,
623         sit: Sit,
624         amet: Amet,
625         consectetur: Consectetur,
626         adipiscing: Adipiscing,
627         elit: Elit,
628     );
629
630     fn lorem(
631         ipsum: Ipsum,
632         dolor: Dolor,
633         sit: Sit,
634         amet: Amet,
635         consectetur: Consectetur,
636         adipiscing: Adipiscing,
637         elit: Elit,
638     ) {
639         // body
640     }
641 }
642 ```
643
644 #### `"Compressed"`:
645
646 ```rust
647 trait Lorem {
648     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
649
650     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
651         // body
652     }
653
654     fn lorem(
655         ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
656         adipiscing: Adipiscing, elit: Elit,
657     );
658
659     fn lorem(
660         ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
661         adipiscing: Adipiscing, elit: Elit,
662     ) {
663         // body
664     }
665 }
666 ```
667
668 #### `"Vertical"`:
669
670 ```rust
671 trait Lorem {
672     fn lorem(
673         ipsum: Ipsum,
674         dolor: Dolor,
675         sit: Sit,
676         amet: Amet,
677     );
678
679     fn lorem(
680         ipsum: Ipsum,
681         dolor: Dolor,
682         sit: Sit,
683         amet: Amet,
684     ) {
685         // body
686     }
687
688     fn lorem(
689         ipsum: Ipsum,
690         dolor: Dolor,
691         sit: Sit,
692         amet: Amet,
693         consectetur: Consectetur,
694         adipiscing: Adipiscing,
695         elit: Elit,
696     );
697
698     fn lorem(
699         ipsum: Ipsum,
700         dolor: Dolor,
701         sit: Sit,
702         amet: Amet,
703         consectetur: Consectetur,
704         adipiscing: Adipiscing,
705         elit: Elit,
706     ) {
707         // body
708     }
709 }
710 ```
711
712
713 ## `brace_style`
714
715 Brace style for items
716
717 - **Default value**: `"SameLineWhere"`
718 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
719 - **Stable**: No
720
721 ### Functions
722
723 #### `"SameLineWhere"` (default):
724
725 ```rust
726 fn lorem() {
727     // body
728 }
729
730 fn lorem(ipsum: usize) {
731     // body
732 }
733
734 fn lorem<T>(ipsum: T)
735 where
736     T: Add + Sub + Mul + Div,
737 {
738     // body
739 }
740 ```
741
742 #### `"AlwaysNextLine"`:
743
744 ```rust
745 fn lorem()
746 {
747     // body
748 }
749
750 fn lorem(ipsum: usize)
751 {
752     // body
753 }
754
755 fn lorem<T>(ipsum: T)
756 where
757     T: Add + Sub + Mul + Div,
758 {
759     // body
760 }
761 ```
762
763 #### `"PreferSameLine"`:
764
765 ```rust
766 fn lorem() {
767     // body
768 }
769
770 fn lorem(ipsum: usize) {
771     // body
772 }
773
774 fn lorem<T>(ipsum: T)
775 where
776     T: Add + Sub + Mul + Div, {
777     // body
778 }
779 ```
780
781 ### Structs and enums
782
783 #### `"SameLineWhere"` (default):
784
785 ```rust
786 struct Lorem {
787     ipsum: bool,
788 }
789
790 struct Dolor<T>
791 where
792     T: Eq,
793 {
794     sit: T,
795 }
796 ```
797
798 #### `"AlwaysNextLine"`:
799
800 ```rust
801 struct Lorem
802 {
803     ipsum: bool,
804 }
805
806 struct Dolor<T>
807 where
808     T: Eq,
809 {
810     sit: T,
811 }
812 ```
813
814 #### `"PreferSameLine"`:
815
816 ```rust
817 struct Lorem {
818     ipsum: bool,
819 }
820
821 struct Dolor<T>
822 where
823     T: Eq, {
824     sit: T,
825 }
826 ```
827
828
829 ## `empty_item_single_line`
830
831 Put empty-body functions and impls on a single line
832
833 - **Default value**: `true`
834 - **Possible values**: `true`, `false`
835 - **Stable**: No
836
837 #### `true` (default):
838
839 ```rust
840 fn lorem() {}
841
842 impl Lorem {}
843 ```
844
845 #### `false`:
846
847 ```rust
848 fn lorem() {
849 }
850
851 impl Lorem {
852 }
853 ```
854
855 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
856
857
858 ## `fn_single_line`
859
860 Put single-expression functions on a single line
861
862 - **Default value**: `false`
863 - **Possible values**: `true`, `false`
864 - **Stable**: No
865
866 #### `false` (default):
867
868 ```rust
869 fn lorem() -> usize {
870     42
871 }
872
873 fn lorem() -> usize {
874     let ipsum = 42;
875     ipsum
876 }
877 ```
878
879 #### `true`:
880
881 ```rust
882 fn lorem() -> usize { 42 }
883
884 fn lorem() -> usize {
885     let ipsum = 42;
886     ipsum
887 }
888 ```
889
890 See also [`control_brace_style`](#control_brace_style).
891
892
893 ## `where_single_line`
894
895 Forces the `where` clause to be laid out on a single line.
896
897 - **Default value**: `false`
898 - **Possible values**: `true`, `false`
899 - **Stable**: No
900
901 #### `false` (default):
902
903 ```rust
904 impl<T> Lorem for T
905 where
906     Option<T>: Ipsum,
907 {
908     // body
909 }
910 ```
911
912 #### `true`:
913
914 ```rust
915 impl<T> Lorem for T
916 where Option<T>: Ipsum
917 {
918     // body
919 }
920 ```
921
922 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
923
924
925 ## `force_explicit_abi`
926
927 Always print the abi for extern items
928
929 - **Default value**: `true`
930 - **Possible values**: `true`, `false`
931 - **Stable**: Yes
932
933 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
934
935 #### `true` (default):
936
937 ```rust
938 extern "C" {
939     pub static lorem: c_int;
940 }
941 ```
942
943 #### `false`:
944
945 ```rust
946 extern {
947     pub static lorem: c_int;
948 }
949 ```
950
951 ## `format_strings`
952
953 Format string literals where necessary
954
955 - **Default value**: `false`
956 - **Possible values**: `true`, `false`
957 - **Stable**: No
958
959 #### `false` (default):
960
961 ```rust
962 fn main() {
963     let lorem =
964         "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";
965 }
966 ```
967
968 #### `true`:
969
970 ```rust
971 fn main() {
972     let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \
973                  consectetur adipiscing";
974 }
975 ```
976
977 See also [`max_width`](#max_width).
978
979 ## `hard_tabs`
980
981 Use tab characters for indentation, spaces for alignment
982
983 - **Default value**: `false`
984 - **Possible values**: `true`, `false`
985 - **Stable**: Yes
986
987 #### `false` (default):
988
989 ```rust
990 fn lorem() -> usize {
991     42 // spaces before 42
992 }
993 ```
994
995 #### `true`:
996
997 ```rust
998 fn lorem() -> usize {
999         42 // tabs before 42
1000 }
1001 ```
1002
1003 See also: [`tab_spaces`](#tab_spaces).
1004
1005
1006 ## `imports_indent`
1007
1008 Indent style of imports
1009
1010 - **Default Value**: `"Visual"`
1011 - **Possible values**: `"Block"`, `"Visual"`
1012 - **Stable**: No
1013
1014 #### `"Visual"` (default):
1015
1016 ```rust
1017 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1018           zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1019 ```
1020
1021 #### `"Block"`:
1022
1023 ```rust
1024 use foo::{
1025     xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1026     zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1027 };
1028 ```
1029
1030 See also: [`imports_layout`](#imports_layout).
1031
1032 ## `imports_layout`
1033
1034 Item layout inside a imports block
1035
1036 - **Default value**: "Mixed"
1037 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1038 - **Stable**: No
1039
1040 #### `"Mixed"` (default):
1041
1042 ```rust
1043 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1044
1045 use foo::{aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1046           eeeeeeeeeeeeeeeeee, ffffffffffffffffff};
1047 ```
1048
1049 #### `"Horizontal"`:
1050
1051 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1052
1053 ```rust
1054 use foo::{xxx, yyy, zzz};
1055
1056 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1057 ```
1058
1059 #### `"HorizontalVertical"`:
1060
1061 ```rust
1062 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1063
1064 use foo::{aaaaaaaaaaaaaaaaaa,
1065           bbbbbbbbbbbbbbbbbb,
1066           cccccccccccccccccc,
1067           dddddddddddddddddd,
1068           eeeeeeeeeeeeeeeeee,
1069           ffffffffffffffffff};
1070 ```
1071
1072 #### `"Vertical"`:
1073
1074 ```rust
1075 use foo::{xxx,
1076           yyy,
1077           zzz};
1078
1079 use foo::{aaa,
1080           bbb,
1081           ccc,
1082           ddd,
1083           eee,
1084           fff};
1085 ```
1086
1087
1088 ## `match_block_trailing_comma`
1089
1090 Put a trailing comma after a block based match arm (non-block arms are not affected)
1091
1092 - **Default value**: `false`
1093 - **Possible values**: `true`, `false`
1094 - **Stable**: No
1095
1096 #### `false` (default):
1097
1098 ```rust
1099 fn main() {
1100     match lorem {
1101         Lorem::Ipsum => {
1102             println!("ipsum");
1103         }
1104         Lorem::Dolor => println!("dolor"),
1105     }
1106 }
1107 ```
1108
1109 #### `true`:
1110
1111 ```rust
1112 fn main() {
1113     match lorem {
1114         Lorem::Ipsum => {
1115             println!("ipsum");
1116         },
1117         Lorem::Dolor => println!("dolor"),
1118     }
1119 }
1120 ```
1121
1122 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1123
1124 ## `max_width`
1125
1126 Maximum width of each line
1127
1128 - **Default value**: `100`
1129 - **Possible values**: any positive integer
1130 - **Stable**: Yes
1131
1132 See also [`error_on_line_overflow`](#error_on_line_overflow).
1133
1134 ## `merge_derives`
1135
1136 Merge multiple derives into a single one.
1137
1138 - **Default value**: `true`
1139 - **Possible values**: `true`, `false`
1140 - **Stable**: Yes
1141
1142 #### `true` (default):
1143
1144 ```rust
1145 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1146 pub enum Foo {}
1147 ```
1148
1149 #### `false`:
1150
1151 ```rust
1152 #[derive(Eq, PartialEq)]
1153 #[derive(Debug)]
1154 #[derive(Copy, Clone)]
1155 pub enum Foo {}
1156 ```
1157
1158 ## `force_multiline_blocks`
1159
1160 Force multiline closure and match arm bodies to be wrapped in a block
1161
1162 - **Default value**: `false`
1163 - **Possible values**: `false`, `true`
1164 - **Stable**: No
1165
1166 #### `false` (default):
1167
1168 ```rust
1169 fn main() {
1170     result.and_then(|maybe_value| match maybe_value {
1171         None => foo(),
1172         Some(value) => bar(),
1173     });
1174
1175     match lorem {
1176         None => if ipsum {
1177             println!("Hello World");
1178         },
1179         Some(dolor) => foo(),
1180     }
1181 }
1182 ```
1183
1184 #### `true`:
1185
1186 ```rust
1187 fn main() {
1188     result.and_then(|maybe_value| {
1189         match maybe_value {
1190             None => foo(),
1191             Some(value) => bar(),
1192         }
1193     });
1194
1195     match lorem {
1196         None => {
1197             if ipsum {
1198                 println!("Hello World");
1199             }
1200         }
1201         Some(dolor) => foo(),
1202     }
1203 }
1204 ```
1205
1206
1207 ## `newline_style`
1208
1209 Unix or Windows line endings
1210
1211 - **Default value**: `"Unix"`
1212 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1213 - **Stable**: Yes
1214
1215 ## `normalize_comments`
1216
1217 Convert /* */ comments to // comments where possible
1218
1219 - **Default value**: `false`
1220 - **Possible values**: `true`, `false`
1221 - **Stable**: Yes
1222
1223 #### `false` (default):
1224
1225 ```rust
1226 // Lorem ipsum:
1227 fn dolor() -> usize {}
1228
1229 /* sit amet: */
1230 fn adipiscing() -> usize {}
1231 ```
1232
1233 #### `true`:
1234
1235 ```rust
1236 // Lorem ipsum:
1237 fn dolor() -> usize {}
1238
1239 // sit amet:
1240 fn adipiscing() -> usize {}
1241 ```
1242
1243 ## `reorder_imported_names`
1244
1245 Reorder lists of names in import statements alphabetically
1246
1247 - **Default value**: `false`
1248 - **Possible values**: `true`, `false`
1249 - **Stable**: No
1250
1251 #### `false` (default):
1252
1253 ```rust
1254 use super::{lorem, ipsum, dolor, sit};
1255 ```
1256
1257 #### `true`:
1258
1259 ```rust
1260 use super::{dolor, ipsum, lorem, sit};
1261 ```
1262
1263 See also [`reorder_imports`](#reorder_imports).
1264
1265 ## `reorder_imports`
1266
1267 Reorder import statements alphabetically
1268
1269 - **Default value**: `false`
1270 - **Possible values**: `true`, `false`
1271 - **Stable**: No
1272
1273 #### `false` (default):
1274
1275 ```rust
1276 use lorem;
1277 use ipsum;
1278 use dolor;
1279 use sit;
1280 ```
1281
1282 #### `true`:
1283
1284 ```rust
1285 use dolor;
1286 use ipsum;
1287 use lorem;
1288 use sit;
1289 ```
1290
1291 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1292
1293 ## `reorder_imports_in_group`
1294
1295 Reorder import statements in group
1296
1297 - **Default value**: `false`
1298 - **Possible values**: `true`, `false`
1299 - **Stable**: No
1300
1301 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1302
1303 #### `true` (default):
1304
1305 ```rust
1306 use std::io;
1307 use std::mem;
1308
1309 use dolor;
1310 use ipsum;
1311 use lorem;
1312 use sit;
1313 ```
1314
1315 #### `false`:
1316
1317
1318 ```rust
1319 use dolor;
1320 use ipsum;
1321 use lorem;
1322 use sit;
1323 use std::io;
1324 use std::mem;
1325 ```
1326
1327 See also [`reorder_imports`](#reorder_imports).
1328
1329 ## `reorder_extern_crates`
1330
1331 Reorder `extern crate` statements alphabetically
1332
1333 - **Default value**: `true`
1334 - **Possible values**: `true`, `false`
1335 - **Stable**: No
1336
1337 #### `true` (default):
1338
1339 ```rust
1340 extern crate dolor;
1341 extern crate ipsum;
1342 extern crate lorem;
1343 extern crate sit;
1344 ```
1345
1346 #### `false`:
1347
1348 ```rust
1349 extern crate lorem;
1350 extern crate ipsum;
1351
1352 extern crate dolor;
1353 extern crate sit;
1354 ```
1355
1356 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1357
1358 ## `reorder_extern_crates_in_group`
1359
1360 Reorder `extern crate` statements in group
1361
1362 - **Default value**: `true`
1363 - **Possible values**: `true`, `false`
1364 - **Stable**: No
1365
1366 #### `false` (default):
1367
1368 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
1370 #### `true`:
1371
1372 **Note:** This only takes effect when [`reorder_extern_crates`](#reorder_extern_crates) is set to `true`.
1373
1374 ```rust
1375 extern crate a;
1376 extern crate b;
1377
1378 extern crate dolor;
1379 extern crate ipsum;
1380 extern crate lorem;
1381 extern crate sit;
1382 ```
1383
1384 ## `reorder_modules`
1385
1386 Reorder `mod` declarations alphabetically in group.
1387
1388 - **Default value**: `true`
1389 - **Possible values**: `true`, `false`
1390 - **Stable**: No
1391
1392 #### `true` (default)
1393
1394 ```rust
1395 mod a;
1396 mod b;
1397
1398 mod dolor;
1399 mod ipsum;
1400 mod lorem;
1401 mod sit;
1402 ```
1403
1404 #### `false`
1405
1406 ```rust
1407 mod b;
1408 mod a;
1409
1410 mod lorem;
1411 mod ipsum;
1412 mod dolor;
1413 mod sit;
1414 ```
1415
1416 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1417 of the original source code.
1418
1419 ## `reorder_impl_items`
1420
1421 Reorder impl items. `type` and `const` are put first, then macros and methods.
1422
1423 - **Default value**: `false`
1424 - **Possible values**: `true`, `false`
1425 - **Stable**: No
1426
1427 #### `false` (default)
1428
1429 ```rust
1430 struct Dummy;
1431
1432 impl Iterator for Dummy {
1433     fn next(&mut self) -> Option<Self::Item> {
1434         None
1435     }
1436
1437     type Item = i32;
1438 }
1439 ```
1440
1441 #### `true`
1442
1443 ```rust
1444 struct Dummy;
1445
1446 impl Iterator for Dummy {
1447     type Item = i32;
1448
1449     fn next(&mut self) -> Option<Self::Item> {
1450         None
1451     }
1452 }
1453 ```
1454
1455 ## `report_todo`
1456
1457 Report `TODO` items in comments.
1458
1459 - **Default value**: `"Never"`
1460 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1461 - **Stable**: No
1462
1463 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1464 it contains a `#X` (with `X` being a number) in parentheses following the
1465 `TODO`, `"Unnumbered"` will ignore it.
1466
1467 See also [`report_fixme`](#report_fixme).
1468
1469 ## `report_fixme`
1470
1471 Report `FIXME` items in comments.
1472
1473 - **Default value**: `"Never"`
1474 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1475 - **Stable**: No
1476
1477 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1478 it contains a `#X` (with `X` being a number) in parentheses following the
1479 `FIXME`, `"Unnumbered"` will ignore it.
1480
1481 See also [`report_todo`](#report_todo).
1482
1483
1484 ## `skip_children`
1485
1486 Don't reformat out of line modules
1487
1488 - **Default value**: `false`
1489 - **Possible values**: `true`, `false`
1490 - **Stable**: No
1491
1492 ## `space_after_colon`
1493
1494 Leave a space after the colon.
1495
1496 - **Default value**: `true`
1497 - **Possible values**: `true`, `false`
1498 - **Stable**: No
1499
1500 #### `true` (default):
1501
1502 ```rust
1503 fn lorem<T: Eq>(t: T) {
1504     let lorem: Dolor = Lorem {
1505         ipsum: dolor,
1506         sit: amet,
1507     };
1508 }
1509 ```
1510
1511 #### `false`:
1512
1513 ```rust
1514 fn lorem<T:Eq>(t:T) {
1515     let lorem:Dolor = Lorem {
1516         ipsum:dolor,
1517         sit:amet,
1518     };
1519 }
1520 ```
1521
1522 See also: [`space_before_colon`](#space_before_colon).
1523
1524 ## `space_before_colon`
1525
1526 Leave a space before the colon.
1527
1528 - **Default value**: `false`
1529 - **Possible values**: `true`, `false`
1530 - **Stable**: No
1531
1532 #### `false` (default):
1533
1534 ```rust
1535 fn lorem<T: Eq>(t: T) {
1536     let lorem: Dolor = Lorem {
1537         ipsum: dolor,
1538         sit: amet,
1539     };
1540 }
1541 ```
1542
1543 #### `true`:
1544
1545 ```rust
1546 fn lorem<T : Eq>(t : T) {
1547     let lorem : Dolor = Lorem {
1548         ipsum : dolor,
1549         sit : amet,
1550     };
1551 }
1552 ```
1553
1554 See also: [`space_after_colon`](#space_after_colon).
1555
1556 ## `struct_field_align_threshold`
1557
1558 The maximum diff of width between struct fields to be aligned with each other.
1559
1560 - **Default value** : 0
1561 - **Possible values**: any positive integer
1562 - **Stable**: No
1563
1564 #### `0` (default):
1565
1566 ```rust
1567 struct Foo {
1568     x: u32,
1569     yy: u32,
1570     zzz: u32,
1571 }
1572 ```
1573
1574 #### `20`:
1575
1576 ```rust
1577 struct Foo {
1578     x:   u32,
1579     yy:  u32,
1580     zzz: u32,
1581 }
1582 ```
1583
1584 ## `spaces_around_ranges`
1585
1586 Put spaces around the .., ..=, and ... range operators
1587
1588 - **Default value**: `false`
1589 - **Possible values**: `true`, `false`
1590 - **Stable**: No
1591
1592 #### `false` (default):
1593
1594 ```rust
1595 fn main() {
1596     let lorem = 0..10;
1597     let ipsum = 0..=10;
1598
1599     match lorem {
1600         1..5 => foo(),
1601         _ => bar,
1602     }
1603
1604     match lorem {
1605         1..=5 => foo(),
1606         _ => bar,
1607     }
1608
1609     match lorem {
1610         1...5 => foo(),
1611         _ => bar,
1612     }
1613 }
1614 ```
1615
1616 #### `true`:
1617
1618 ```rust
1619 fn main() {
1620     let lorem = 0 .. 10;
1621     let ipsum = 0 ..= 10;
1622
1623     match lorem {
1624         1 .. 5 => foo(),
1625         _ => bar,
1626     }
1627
1628     match lorem {
1629         1 ..= 5 => foo(),
1630         _ => bar,
1631     }
1632
1633     match lorem {
1634         1 ... 5 => foo(),
1635         _ => bar,
1636     }
1637 }
1638 ```
1639
1640 ## `spaces_within_parens_and_brackets`
1641
1642 Put spaces within non-empty generic arguments, parentheses, and square brackets
1643
1644 - **Default value**: `false`
1645 - **Possible values**: `true`, `false`
1646 - **Stable**: No
1647
1648 #### `false` (default):
1649
1650 ```rust
1651 // generic arguments
1652 fn lorem<T: Eq>(t: T) {
1653     // body
1654 }
1655
1656 // non-empty parentheses
1657 fn lorem<T: Eq>(t: T) {
1658     let lorem = (ipsum, dolor);
1659 }
1660
1661 // non-empty square brackets
1662 fn lorem<T: Eq>(t: T) {
1663     let lorem: [usize; 2] = [ipsum, dolor];
1664 }
1665 ```
1666
1667 #### `true`:
1668
1669 ```rust
1670 // generic arguments
1671 fn lorem< T: Eq >( t: T ) {
1672     // body
1673 }
1674
1675 // non-empty parentheses
1676 fn lorem< T: Eq >( t: T ) {
1677     let lorem = ( ipsum, dolor );
1678 }
1679
1680 // non-empty square brackets
1681 fn lorem< T: Eq >( t: T ) {
1682     let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1683 }
1684 ```
1685
1686 ## `struct_lit_single_line`
1687
1688 Put small struct literals on a single line
1689
1690 - **Default value**: `true`
1691 - **Possible values**: `true`, `false`
1692 - **Stable**: No
1693
1694 #### `true` (default):
1695
1696 ```rust
1697 fn main() {
1698     let lorem = Lorem { foo: bar, baz: ofo };
1699 }
1700 ```
1701
1702 #### `false`:
1703
1704 ```rust
1705 fn main() {
1706     let lorem = Lorem {
1707         foo: bar,
1708         baz: ofo,
1709     };
1710 }
1711 ```
1712
1713 See also: [`indent_style`](#indent_style).
1714
1715
1716 ## `tab_spaces`
1717
1718 Number of spaces per tab
1719
1720 - **Default value**: `4`
1721 - **Possible values**: any positive integer
1722 - **Stable**: Yes
1723
1724 #### `4` (default):
1725
1726 ```rust
1727 fn lorem() {
1728     let ipsum = dolor();
1729     let sit = vec![
1730         "amet consectetur adipiscing elit amet",
1731         "consectetur adipiscing elit amet consectetur.",
1732     ];
1733 }
1734 ```
1735
1736 #### `2`:
1737
1738 ```rust
1739 fn lorem() {
1740   let ipsum = dolor();
1741   let sit = vec![
1742     "amet consectetur adipiscing elit amet",
1743     "consectetur adipiscing elit amet consectetur.",
1744   ];
1745 }
1746 ```
1747
1748 See also: [`hard_tabs`](#hard_tabs).
1749
1750
1751 ## `trailing_comma`
1752
1753 How to handle trailing commas for lists
1754
1755 - **Default value**: `"Vertical"`
1756 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1757 - **Stable**: No
1758
1759 #### `"Vertical"` (default):
1760
1761 ```rust
1762 fn main() {
1763     let Lorem { ipsum, dolor, sit } = amet;
1764     let Lorem {
1765         ipsum,
1766         dolor,
1767         sit,
1768         amet,
1769         consectetur,
1770         adipiscing,
1771     } = elit;
1772 }
1773 ```
1774
1775 #### `"Always"`:
1776
1777 ```rust
1778 fn main() {
1779     let Lorem { ipsum, dolor, sit, } = amet;
1780     let Lorem {
1781         ipsum,
1782         dolor,
1783         sit,
1784         amet,
1785         consectetur,
1786         adipiscing,
1787     } = elit;
1788 }
1789 ```
1790
1791 #### `"Never"`:
1792
1793 ```rust
1794 fn main() {
1795     let Lorem { ipsum, dolor, sit } = amet;
1796     let Lorem {
1797         ipsum,
1798         dolor,
1799         sit,
1800         amet,
1801         consectetur,
1802         adipiscing
1803     } = elit;
1804 }
1805 ```
1806
1807 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1808
1809 ## `trailing_semicolon`
1810
1811 Add trailing semicolon after break, continue and return
1812
1813 - **Default value**: `true`
1814 - **Possible values**: `true`, `false`
1815 - **Stable**: No
1816
1817 #### `true` (default):
1818 ```rust
1819 fn foo() -> usize {
1820     return 0;
1821 }
1822 ```
1823
1824 #### `false`:
1825 ```rust
1826 fn foo() -> usize {
1827     return 0
1828 }
1829 ```
1830
1831 ## `type_punctuation_density`
1832
1833 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1834
1835 - **Default value**: `"Wide"`
1836 - **Possible values**: `"Compressed"`, `"Wide"`
1837 - **Stable**: No
1838
1839 #### `"Wide"` (default):
1840
1841 ```rust
1842 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1843     // body
1844 }
1845 ```
1846
1847 #### `"Compressed"`:
1848
1849 ```rust
1850 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1851     // body
1852 }
1853 ```
1854
1855 ## `use_field_init_shorthand`
1856
1857 Use field initialize shorthand if possible.
1858
1859 - **Default value**: `false`
1860 - **Possible values**: `true`, `false`
1861 - **Stable**: No
1862
1863 #### `false` (default):
1864
1865 ```rust
1866 struct Foo {
1867     x: u32,
1868     y: u32,
1869     z: u32,
1870 }
1871
1872 fn main() {
1873     let x = 1;
1874     let y = 2;
1875     let z = 3;
1876     let a = Foo { x: x, y: y, z: z };
1877 }
1878 ```
1879
1880 #### `true`:
1881
1882 ```rust
1883 struct Foo {
1884     x: u32,
1885     y: u32,
1886     z: u32,
1887 }
1888
1889 fn main() {
1890     let x = 1;
1891     let y = 2;
1892     let z = 3;
1893     let a = Foo { x, y, z };
1894 }
1895 ```
1896
1897 ## `use_try_shorthand`
1898
1899 Replace uses of the try! macro by the ? shorthand
1900
1901 - **Default value**: `false`
1902 - **Possible values**: `true`, `false`
1903 - **Stable**: No
1904
1905 #### `false` (default):
1906
1907 ```rust
1908 fn main() {
1909     let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1910 }
1911 ```
1912
1913 #### `true`:
1914
1915 ```rust
1916 fn main() {
1917     let lorem = ipsum.map(|dolor| dolor.sit())?;
1918 }
1919 ```
1920
1921
1922 ## `wrap_comments`
1923
1924 Break comments to fit on the line
1925
1926 - **Default value**: `false`
1927 - **Possible values**: `true`, `false`
1928 - **Stable**: Yes
1929
1930 #### `false` (default):
1931
1932 ```rust
1933 // 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.
1934 ```
1935
1936 #### `true`:
1937
1938 ```rust
1939 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
1940 // sed do eiusmod tempor incididunt ut labore et dolore
1941 // magna aliqua. Ut enim ad minim veniam, quis nostrud
1942 // exercitation ullamco laboris nisi ut aliquip ex ea
1943 // commodo consequat.
1944 ```
1945
1946 ## `match_arm_blocks`
1947
1948 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1949
1950 - **Default value**: `true`
1951 - **Possible values**: `true`, `false`
1952 - **Stable**: No
1953
1954 #### `true` (default):
1955
1956 ```rust
1957 fn main() {
1958     match lorem {
1959         true => {
1960             foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1961         }
1962         false => println!("{}", sit),
1963     }
1964 }
1965 ```
1966
1967 #### `false`:
1968
1969 ```rust
1970 fn main() {
1971     match lorem {
1972         true =>
1973             foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1974         false => println!("{}", sit),
1975     }
1976 }
1977 ```
1978
1979 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1980
1981 ## `write_mode`
1982
1983 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
1984
1985 - **Default value**: `"Overwrite"`
1986 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
1987 - **Stable**: No
1988
1989 ## `blank_lines_upper_bound`
1990
1991 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
1992 lines are found, they are trimmed down to match this integer.
1993
1994 - **Default value**: `1`
1995 - **Possible values**: *unsigned integer*
1996 - **Stable**: No
1997
1998 ### Example
1999 Original Code:
2000
2001 ```rust
2002 #![rustfmt_skip]
2003
2004 fn foo() {
2005     println!("a");
2006 }
2007
2008
2009
2010 fn bar() {
2011     println!("b");
2012
2013
2014     println!("c");
2015 }
2016 ```
2017
2018 #### `1` (default):
2019 ```rust
2020 fn foo() {
2021     println!("a");
2022 }
2023
2024 fn bar() {
2025     println!("b");
2026
2027     println!("c");
2028 }
2029 ```
2030
2031 #### `2` (default):
2032 ```rust
2033 fn foo() {
2034     println!("a");
2035 }
2036
2037
2038 fn bar() {
2039     println!("b");
2040
2041
2042     println!("c");
2043 }
2044 ```
2045
2046 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2047
2048 ## `blank_lines_lower_bound`
2049
2050 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
2051 them, additional blank lines are inserted.
2052
2053 - **Default value**: `0`
2054 - **Possible values**: *unsigned integer*
2055 - **Stable**: No
2056
2057 ### Example
2058 Original Code (rustfmt will not change it with the default value of `0`):
2059
2060 ```rust
2061 #![rustfmt_skip]
2062
2063 fn foo() {
2064     println!("a");
2065 }
2066 fn bar() {
2067     println!("b");
2068     println!("c");
2069 }
2070 ```
2071
2072 #### `1`
2073 ```rust
2074 fn foo() {
2075
2076     println!("a");
2077 }
2078
2079 fn bar() {
2080
2081     println!("b");
2082
2083     println!("c");
2084 }
2085 ```
2086
2087 ## `remove_blank_lines_at_start_or_end_of_block`
2088
2089 Remove blank lines at the start or the end of a block.
2090
2091 - **Default value**: `true`
2092 - **Possible values**: `true`, `false`
2093 - **Stable**: No
2094
2095 #### `true`
2096
2097 ```rust
2098 fn foo() {
2099     let msg = {
2100         let mut str = String::new();
2101         str.push_str("hello, ");
2102         str.push_str("world!");
2103         str
2104     };
2105     println!("{}", msg);
2106 }
2107 ```
2108
2109 #### `false`
2110
2111 ```rust
2112 fn foo() {
2113
2114     let msg = {
2115
2116         let mut str = String::new();
2117         str.push_str("hello, ");
2118         str.push_str("world!");
2119         str
2120
2121     };
2122     println!("{}", msg);
2123
2124 }
2125 ```
2126
2127 ## `required_version`
2128
2129 Require a specific version of rustfmt. If you want to make sure that the 
2130 specific version of rustfmt is used in your CI, use this option.
2131
2132 - **Default value**: `CARGO_PKG_VERSION`
2133 - **Possible values**: any published version (e.g. `"0.3.8"`)
2134 - **Stable**: No
2135
2136 ## `hide_parse_errors`
2137
2138 Do not show parse errors if the parser failed to parse files.
2139
2140 - **Default value**: `false`
2141 - **Possible values**: `true`, `false`
2142 - **Stable**: No
2143
2144 ## `color`
2145
2146 Whether to use colored output or not.
2147
2148 - **Default value**: `"Auto"`
2149 - **Possible values**: "Auto", "Always", "Never"
2150 - **Stable**: No
2151
2152 ## `unstable_features`
2153
2154 Enable unstable features on stable channel.
2155
2156 - **Default value**: `false`
2157 - **Possible values**: `true`, `false`
2158 - **Stable**: Yes
2159
2160 ## `license_template_path`
2161
2162 Check whether beginnings of files match a license template.
2163
2164 - **Default value**: `""``
2165 - **Possible values**: path to a license template file
2166 - **Stable**: No
2167
2168 A license template is a plain text file which is matched literally against the
2169 beginning of each source file, except for `{}`-delimited blocks, which are
2170 matched as regular expressions. The following license template therefore
2171 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
2172 Copyright 2018 The Rust Project Developers.`, etc.:
2173
2174 ```
2175 // Copyright {\d+} The Rust Project Developers.
2176 ```
2177
2178 `\{`, `\}` and `\\` match literal braces / backslashes.
2179
2180 ## `ignore`
2181
2182 Skip formatting the specified files and directories.
2183
2184 - **Default value**: format every files
2185 - **Possible values**: See an example below
2186 - **Stable**: No
2187
2188 ### Example
2189
2190 If you want to ignore specific files, put the following to your config file:
2191
2192 ```toml
2193 ignore = [
2194     "src/types.rs",
2195     "src/foo/bar.rs",
2196 ]
2197 ```
2198
2199 If you want to ignore every file under `examples/`, put the following to your config file:
2200
2201 ```toml
2202 ignore [
2203     "examples",
2204 ]
2205 ```