]> git.lizzy.rs Git - rust.git/blob - Configurations.md
1c6a8048017a456de7c032fd1c28c1fd9534d176
[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 unable to get all lines within `max_width`, except for comments and string literals.
583
584 - **Default value**: `true`
585 - **Possible values**: `true`, `false`
586 - **Stable**: No
587
588 See also [`max_width`](#max_width).
589
590 ## `error_on_unformatted`
591
592 Error if unable to get comments or string literals within `max_width`, or they are left with
593 trailing whitespaces.
594
595 - **Default value**: `false`
596 - **Possible values**: `true`, `false`
597 - **Stable**: No
598
599 ## `fn_args_density`
600
601 Argument density in functions
602
603 - **Default value**: `"Tall"`
604 - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"`
605 - **Stable**: No
606
607 #### `"Tall"` (default):
608
609 ```rust
610 trait Lorem {
611     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
612
613     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
614         // body
615     }
616
617     fn lorem(
618         ipsum: Ipsum,
619         dolor: Dolor,
620         sit: Sit,
621         amet: Amet,
622         consectetur: Consectetur,
623         adipiscing: Adipiscing,
624         elit: Elit,
625     );
626
627     fn lorem(
628         ipsum: Ipsum,
629         dolor: Dolor,
630         sit: Sit,
631         amet: Amet,
632         consectetur: Consectetur,
633         adipiscing: Adipiscing,
634         elit: Elit,
635     ) {
636         // body
637     }
638 }
639 ```
640
641 #### `"Compressed"`:
642
643 ```rust
644 trait Lorem {
645     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);
646
647     fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {
648         // body
649     }
650
651     fn lorem(
652         ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
653         adipiscing: Adipiscing, elit: Elit,
654     );
655
656     fn lorem(
657         ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,
658         adipiscing: Adipiscing, elit: Elit,
659     ) {
660         // body
661     }
662 }
663 ```
664
665 #### `"Vertical"`:
666
667 ```rust
668 trait Lorem {
669     fn lorem(
670         ipsum: Ipsum,
671         dolor: Dolor,
672         sit: Sit,
673         amet: Amet,
674     );
675
676     fn lorem(
677         ipsum: Ipsum,
678         dolor: Dolor,
679         sit: Sit,
680         amet: Amet,
681     ) {
682         // body
683     }
684
685     fn lorem(
686         ipsum: Ipsum,
687         dolor: Dolor,
688         sit: Sit,
689         amet: Amet,
690         consectetur: Consectetur,
691         adipiscing: Adipiscing,
692         elit: Elit,
693     );
694
695     fn lorem(
696         ipsum: Ipsum,
697         dolor: Dolor,
698         sit: Sit,
699         amet: Amet,
700         consectetur: Consectetur,
701         adipiscing: Adipiscing,
702         elit: Elit,
703     ) {
704         // body
705     }
706 }
707 ```
708
709
710 ## `brace_style`
711
712 Brace style for items
713
714 - **Default value**: `"SameLineWhere"`
715 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
716 - **Stable**: No
717
718 ### Functions
719
720 #### `"SameLineWhere"` (default):
721
722 ```rust
723 fn lorem() {
724     // body
725 }
726
727 fn lorem(ipsum: usize) {
728     // body
729 }
730
731 fn lorem<T>(ipsum: T)
732 where
733     T: Add + Sub + Mul + Div,
734 {
735     // body
736 }
737 ```
738
739 #### `"AlwaysNextLine"`:
740
741 ```rust
742 fn lorem()
743 {
744     // body
745 }
746
747 fn lorem(ipsum: usize)
748 {
749     // body
750 }
751
752 fn lorem<T>(ipsum: T)
753 where
754     T: Add + Sub + Mul + Div,
755 {
756     // body
757 }
758 ```
759
760 #### `"PreferSameLine"`:
761
762 ```rust
763 fn lorem() {
764     // body
765 }
766
767 fn lorem(ipsum: usize) {
768     // body
769 }
770
771 fn lorem<T>(ipsum: T)
772 where
773     T: Add + Sub + Mul + Div, {
774     // body
775 }
776 ```
777
778 ### Structs and enums
779
780 #### `"SameLineWhere"` (default):
781
782 ```rust
783 struct Lorem {
784     ipsum: bool,
785 }
786
787 struct Dolor<T>
788 where
789     T: Eq,
790 {
791     sit: T,
792 }
793 ```
794
795 #### `"AlwaysNextLine"`:
796
797 ```rust
798 struct Lorem
799 {
800     ipsum: bool,
801 }
802
803 struct Dolor<T>
804 where
805     T: Eq,
806 {
807     sit: T,
808 }
809 ```
810
811 #### `"PreferSameLine"`:
812
813 ```rust
814 struct Lorem {
815     ipsum: bool,
816 }
817
818 struct Dolor<T>
819 where
820     T: Eq, {
821     sit: T,
822 }
823 ```
824
825
826 ## `empty_item_single_line`
827
828 Put empty-body functions and impls on a single line
829
830 - **Default value**: `true`
831 - **Possible values**: `true`, `false`
832 - **Stable**: No
833
834 #### `true` (default):
835
836 ```rust
837 fn lorem() {}
838
839 impl Lorem {}
840 ```
841
842 #### `false`:
843
844 ```rust
845 fn lorem() {
846 }
847
848 impl Lorem {
849 }
850 ```
851
852 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
853
854
855 ## `fn_single_line`
856
857 Put single-expression functions on a single line
858
859 - **Default value**: `false`
860 - **Possible values**: `true`, `false`
861 - **Stable**: No
862
863 #### `false` (default):
864
865 ```rust
866 fn lorem() -> usize {
867     42
868 }
869
870 fn lorem() -> usize {
871     let ipsum = 42;
872     ipsum
873 }
874 ```
875
876 #### `true`:
877
878 ```rust
879 fn lorem() -> usize { 42 }
880
881 fn lorem() -> usize {
882     let ipsum = 42;
883     ipsum
884 }
885 ```
886
887 See also [`control_brace_style`](#control_brace_style).
888
889
890 ## `where_single_line`
891
892 Forces the `where` clause to be laid out on a single line.
893
894 - **Default value**: `false`
895 - **Possible values**: `true`, `false`
896 - **Stable**: No
897
898 #### `false` (default):
899
900 ```rust
901 impl<T> Lorem for T
902 where
903     Option<T>: Ipsum,
904 {
905     // body
906 }
907 ```
908
909 #### `true`:
910
911 ```rust
912 impl<T> Lorem for T
913 where Option<T>: Ipsum
914 {
915     // body
916 }
917 ```
918
919 See also [`brace_style`](#brace_style), [`control_brace_style`](#control_brace_style).
920
921
922 ## `force_explicit_abi`
923
924 Always print the abi for extern items
925
926 - **Default value**: `true`
927 - **Possible values**: `true`, `false`
928 - **Stable**: Yes
929
930 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
931
932 #### `true` (default):
933
934 ```rust
935 extern "C" {
936     pub static lorem: c_int;
937 }
938 ```
939
940 #### `false`:
941
942 ```rust
943 extern {
944     pub static lorem: c_int;
945 }
946 ```
947
948 ## `format_strings`
949
950 Format string literals where necessary
951
952 - **Default value**: `false`
953 - **Possible values**: `true`, `false`
954 - **Stable**: No
955
956 #### `false` (default):
957
958 ```rust
959 fn main() {
960     let lorem =
961         "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";
962 }
963 ```
964
965 #### `true`:
966
967 ```rust
968 fn main() {
969     let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \
970                  consectetur adipiscing";
971 }
972 ```
973
974 See also [`max_width`](#max_width).
975
976 ## `hard_tabs`
977
978 Use tab characters for indentation, spaces for alignment
979
980 - **Default value**: `false`
981 - **Possible values**: `true`, `false`
982 - **Stable**: Yes
983
984 #### `false` (default):
985
986 ```rust
987 fn lorem() -> usize {
988     42 // spaces before 42
989 }
990 ```
991
992 #### `true`:
993
994 ```rust
995 fn lorem() -> usize {
996         42 // tabs before 42
997 }
998 ```
999
1000 See also: [`tab_spaces`](#tab_spaces).
1001
1002
1003 ## `imports_indent`
1004
1005 Indent style of imports
1006
1007 - **Default Value**: `"Visual"`
1008 - **Possible values**: `"Block"`, `"Visual"`
1009 - **Stable**: No
1010
1011 #### `"Visual"` (default):
1012
1013 ```rust
1014 use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1015           zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};
1016 ```
1017
1018 #### `"Block"`:
1019
1020 ```rust
1021 use foo::{
1022     xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,
1023     zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,
1024 };
1025 ```
1026
1027 See also: [`imports_layout`](#imports_layout).
1028
1029 ## `imports_layout`
1030
1031 Item layout inside a imports block
1032
1033 - **Default value**: "Mixed"
1034 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1035 - **Stable**: No
1036
1037 #### `"Mixed"` (default):
1038
1039 ```rust
1040 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1041
1042 use foo::{aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,
1043           eeeeeeeeeeeeeeeeee, ffffffffffffffffff};
1044 ```
1045
1046 #### `"Horizontal"`:
1047
1048 **Note**: This option forces all imports onto one line and may exceed `max_width`.
1049
1050 ```rust
1051 use foo::{xxx, yyy, zzz};
1052
1053 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1054 ```
1055
1056 #### `"HorizontalVertical"`:
1057
1058 ```rust
1059 use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};
1060
1061 use foo::{aaaaaaaaaaaaaaaaaa,
1062           bbbbbbbbbbbbbbbbbb,
1063           cccccccccccccccccc,
1064           dddddddddddddddddd,
1065           eeeeeeeeeeeeeeeeee,
1066           ffffffffffffffffff};
1067 ```
1068
1069 #### `"Vertical"`:
1070
1071 ```rust
1072 use foo::{xxx,
1073           yyy,
1074           zzz};
1075
1076 use foo::{aaa,
1077           bbb,
1078           ccc,
1079           ddd,
1080           eee,
1081           fff};
1082 ```
1083
1084
1085 ## `match_block_trailing_comma`
1086
1087 Put a trailing comma after a block based match arm (non-block arms are not affected)
1088
1089 - **Default value**: `false`
1090 - **Possible values**: `true`, `false`
1091 - **Stable**: No
1092
1093 #### `false` (default):
1094
1095 ```rust
1096 fn main() {
1097     match lorem {
1098         Lorem::Ipsum => {
1099             println!("ipsum");
1100         }
1101         Lorem::Dolor => println!("dolor"),
1102     }
1103 }
1104 ```
1105
1106 #### `true`:
1107
1108 ```rust
1109 fn main() {
1110     match lorem {
1111         Lorem::Ipsum => {
1112             println!("ipsum");
1113         },
1114         Lorem::Dolor => println!("dolor"),
1115     }
1116 }
1117 ```
1118
1119 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1120
1121 ## `max_width`
1122
1123 Maximum width of each line
1124
1125 - **Default value**: `100`
1126 - **Possible values**: any positive integer
1127 - **Stable**: Yes
1128
1129 See also [`error_on_line_overflow`](#error_on_line_overflow).
1130
1131 ## `merge_derives`
1132
1133 Merge multiple derives into a single one.
1134
1135 - **Default value**: `true`
1136 - **Possible values**: `true`, `false`
1137 - **Stable**: Yes
1138
1139 #### `true` (default):
1140
1141 ```rust
1142 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1143 pub enum Foo {}
1144 ```
1145
1146 #### `false`:
1147
1148 ```rust
1149 #[derive(Eq, PartialEq)]
1150 #[derive(Debug)]
1151 #[derive(Copy, Clone)]
1152 pub enum Foo {}
1153 ```
1154
1155 ## `force_multiline_blocks`
1156
1157 Force multiline closure and match arm bodies to be wrapped in a block
1158
1159 - **Default value**: `false`
1160 - **Possible values**: `false`, `true`
1161 - **Stable**: No
1162
1163 #### `false` (default):
1164
1165 ```rust
1166 fn main() {
1167     result.and_then(|maybe_value| match maybe_value {
1168         None => foo(),
1169         Some(value) => bar(),
1170     });
1171
1172     match lorem {
1173         None => if ipsum {
1174             println!("Hello World");
1175         },
1176         Some(dolor) => foo(),
1177     }
1178 }
1179 ```
1180
1181 #### `true`:
1182
1183 ```rust
1184 fn main() {
1185     result.and_then(|maybe_value| {
1186         match maybe_value {
1187             None => foo(),
1188             Some(value) => bar(),
1189         }
1190     });
1191
1192     match lorem {
1193         None => {
1194             if ipsum {
1195                 println!("Hello World");
1196             }
1197         }
1198         Some(dolor) => foo(),
1199     }
1200 }
1201 ```
1202
1203
1204 ## `newline_style`
1205
1206 Unix or Windows line endings
1207
1208 - **Default value**: `"Unix"`
1209 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1210 - **Stable**: Yes
1211
1212 ## `normalize_comments`
1213
1214 Convert /* */ comments to // comments where possible
1215
1216 - **Default value**: `false`
1217 - **Possible values**: `true`, `false`
1218 - **Stable**: Yes
1219
1220 #### `false` (default):
1221
1222 ```rust
1223 // Lorem ipsum:
1224 fn dolor() -> usize {}
1225
1226 /* sit amet: */
1227 fn adipiscing() -> usize {}
1228 ```
1229
1230 #### `true`:
1231
1232 ```rust
1233 // Lorem ipsum:
1234 fn dolor() -> usize {}
1235
1236 // sit amet:
1237 fn adipiscing() -> usize {}
1238 ```
1239
1240 ## `reorder_imported_names`
1241
1242 Reorder lists of names in import statements alphabetically
1243
1244 - **Default value**: `false`
1245 - **Possible values**: `true`, `false`
1246 - **Stable**: No
1247
1248 #### `false` (default):
1249
1250 ```rust
1251 use super::{lorem, ipsum, dolor, sit};
1252 ```
1253
1254 #### `true`:
1255
1256 ```rust
1257 use super::{dolor, ipsum, lorem, sit};
1258 ```
1259
1260 See also [`reorder_imports`](#reorder_imports).
1261
1262 ## `reorder_imports`
1263
1264 Reorder import statements alphabetically
1265
1266 - **Default value**: `false`
1267 - **Possible values**: `true`, `false`
1268 - **Stable**: No
1269
1270 #### `false` (default):
1271
1272 ```rust
1273 use lorem;
1274 use ipsum;
1275 use dolor;
1276 use sit;
1277 ```
1278
1279 #### `true`:
1280
1281 ```rust
1282 use dolor;
1283 use ipsum;
1284 use lorem;
1285 use sit;
1286 ```
1287
1288 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1289
1290 ## `reorder_imports_in_group`
1291
1292 Reorder import statements in group
1293
1294 - **Default value**: `false`
1295 - **Possible values**: `true`, `false`
1296 - **Stable**: No
1297
1298 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1299
1300 #### `true` (default):
1301
1302 ```rust
1303 use std::io;
1304 use std::mem;
1305
1306 use dolor;
1307 use ipsum;
1308 use lorem;
1309 use sit;
1310 ```
1311
1312 #### `false`:
1313
1314
1315 ```rust
1316 use dolor;
1317 use ipsum;
1318 use lorem;
1319 use sit;
1320 use std::io;
1321 use std::mem;
1322 ```
1323
1324 See also [`reorder_imports`](#reorder_imports).
1325
1326 ## `reorder_extern_crates`
1327
1328 Reorder `extern crate` statements alphabetically
1329
1330 - **Default value**: `true`
1331 - **Possible values**: `true`, `false`
1332 - **Stable**: No
1333
1334 #### `true` (default):
1335
1336 ```rust
1337 extern crate dolor;
1338 extern crate ipsum;
1339 extern crate lorem;
1340 extern crate sit;
1341 ```
1342
1343 #### `false`:
1344
1345 ```rust
1346 extern crate lorem;
1347 extern crate ipsum;
1348
1349 extern crate dolor;
1350 extern crate sit;
1351 ```
1352
1353 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1354
1355 ## `reorder_extern_crates_in_group`
1356
1357 Reorder `extern crate` statements in group
1358
1359 - **Default value**: `true`
1360 - **Possible values**: `true`, `false`
1361 - **Stable**: No
1362
1363 #### `false` (default):
1364
1365 This value has no influence beyond the effect of the [`reorder_extern_crates`](#reorder_extern_crates) option. Set [`reorder_extern_crates`](#reorder_extern_crates) to `false` if you do not want `extern crate` groups to be collapsed and ordered.
1366
1367 #### `true`:
1368
1369 **Note:** This only takes effect when [`reorder_extern_crates`](#reorder_extern_crates) is set to `true`.
1370
1371 ```rust
1372 extern crate a;
1373 extern crate b;
1374
1375 extern crate dolor;
1376 extern crate ipsum;
1377 extern crate lorem;
1378 extern crate sit;
1379 ```
1380
1381 ## `reorder_modules`
1382
1383 Reorder `mod` declarations alphabetically in group.
1384
1385 - **Default value**: `true`
1386 - **Possible values**: `true`, `false`
1387 - **Stable**: No
1388
1389 #### `true` (default)
1390
1391 ```rust
1392 mod a;
1393 mod b;
1394
1395 mod dolor;
1396 mod ipsum;
1397 mod lorem;
1398 mod sit;
1399 ```
1400
1401 #### `false`
1402
1403 ```rust
1404 mod b;
1405 mod a;
1406
1407 mod lorem;
1408 mod ipsum;
1409 mod dolor;
1410 mod sit;
1411 ```
1412
1413 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1414 of the original source code.
1415
1416 ## `reorder_impl_items`
1417
1418 Reorder impl items. `type` and `const` are put first, then macros and methods.
1419
1420 - **Default value**: `false`
1421 - **Possible values**: `true`, `false`
1422 - **Stable**: No
1423
1424 #### `false` (default)
1425
1426 ```rust
1427 struct Dummy;
1428
1429 impl Iterator for Dummy {
1430     fn next(&mut self) -> Option<Self::Item> {
1431         None
1432     }
1433
1434     type Item = i32;
1435 }
1436 ```
1437
1438 #### `true`
1439
1440 ```rust
1441 struct Dummy;
1442
1443 impl Iterator for Dummy {
1444     type Item = i32;
1445
1446     fn next(&mut self) -> Option<Self::Item> {
1447         None
1448     }
1449 }
1450 ```
1451
1452 ## `report_todo`
1453
1454 Report `TODO` items in comments.
1455
1456 - **Default value**: `"Never"`
1457 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1458 - **Stable**: No
1459
1460 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1461 it contains a `#X` (with `X` being a number) in parentheses following the
1462 `TODO`, `"Unnumbered"` will ignore it.
1463
1464 See also [`report_fixme`](#report_fixme).
1465
1466 ## `report_fixme`
1467
1468 Report `FIXME` items in comments.
1469
1470 - **Default value**: `"Never"`
1471 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1472 - **Stable**: No
1473
1474 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1475 it contains a `#X` (with `X` being a number) in parentheses following the
1476 `FIXME`, `"Unnumbered"` will ignore it.
1477
1478 See also [`report_todo`](#report_todo).
1479
1480
1481 ## `skip_children`
1482
1483 Don't reformat out of line modules
1484
1485 - **Default value**: `false`
1486 - **Possible values**: `true`, `false`
1487 - **Stable**: No
1488
1489 ## `space_after_colon`
1490
1491 Leave a space after the colon.
1492
1493 - **Default value**: `true`
1494 - **Possible values**: `true`, `false`
1495 - **Stable**: No
1496
1497 #### `true` (default):
1498
1499 ```rust
1500 fn lorem<T: Eq>(t: T) {
1501     let lorem: Dolor = Lorem {
1502         ipsum: dolor,
1503         sit: amet,
1504     };
1505 }
1506 ```
1507
1508 #### `false`:
1509
1510 ```rust
1511 fn lorem<T:Eq>(t:T) {
1512     let lorem:Dolor = Lorem {
1513         ipsum:dolor,
1514         sit:amet,
1515     };
1516 }
1517 ```
1518
1519 See also: [`space_before_colon`](#space_before_colon).
1520
1521 ## `space_before_colon`
1522
1523 Leave a space before the colon.
1524
1525 - **Default value**: `false`
1526 - **Possible values**: `true`, `false`
1527 - **Stable**: No
1528
1529 #### `false` (default):
1530
1531 ```rust
1532 fn lorem<T: Eq>(t: T) {
1533     let lorem: Dolor = Lorem {
1534         ipsum: dolor,
1535         sit: amet,
1536     };
1537 }
1538 ```
1539
1540 #### `true`:
1541
1542 ```rust
1543 fn lorem<T : Eq>(t : T) {
1544     let lorem : Dolor = Lorem {
1545         ipsum : dolor,
1546         sit : amet,
1547     };
1548 }
1549 ```
1550
1551 See also: [`space_after_colon`](#space_after_colon).
1552
1553 ## `struct_field_align_threshold`
1554
1555 The maximum diff of width between struct fields to be aligned with each other.
1556
1557 - **Default value** : 0
1558 - **Possible values**: any positive integer
1559 - **Stable**: No
1560
1561 #### `0` (default):
1562
1563 ```rust
1564 struct Foo {
1565     x: u32,
1566     yy: u32,
1567     zzz: u32,
1568 }
1569 ```
1570
1571 #### `20`:
1572
1573 ```rust
1574 struct Foo {
1575     x:   u32,
1576     yy:  u32,
1577     zzz: u32,
1578 }
1579 ```
1580
1581 ## `spaces_around_ranges`
1582
1583 Put spaces around the .., ..=, and ... range operators
1584
1585 - **Default value**: `false`
1586 - **Possible values**: `true`, `false`
1587 - **Stable**: No
1588
1589 #### `false` (default):
1590
1591 ```rust
1592 fn main() {
1593     let lorem = 0..10;
1594     let ipsum = 0..=10;
1595
1596     match lorem {
1597         1..5 => foo(),
1598         _ => bar,
1599     }
1600
1601     match lorem {
1602         1..=5 => foo(),
1603         _ => bar,
1604     }
1605
1606     match lorem {
1607         1...5 => foo(),
1608         _ => bar,
1609     }
1610 }
1611 ```
1612
1613 #### `true`:
1614
1615 ```rust
1616 fn main() {
1617     let lorem = 0 .. 10;
1618     let ipsum = 0 ..= 10;
1619
1620     match lorem {
1621         1 .. 5 => foo(),
1622         _ => bar,
1623     }
1624
1625     match lorem {
1626         1 ..= 5 => foo(),
1627         _ => bar,
1628     }
1629
1630     match lorem {
1631         1 ... 5 => foo(),
1632         _ => bar,
1633     }
1634 }
1635 ```
1636
1637 ## `spaces_within_parens_and_brackets`
1638
1639 Put spaces within non-empty generic arguments, parentheses, and square brackets
1640
1641 - **Default value**: `false`
1642 - **Possible values**: `true`, `false`
1643 - **Stable**: No
1644
1645 #### `false` (default):
1646
1647 ```rust
1648 // generic arguments
1649 fn lorem<T: Eq>(t: T) {
1650     // body
1651 }
1652
1653 // non-empty parentheses
1654 fn lorem<T: Eq>(t: T) {
1655     let lorem = (ipsum, dolor);
1656 }
1657
1658 // non-empty square brackets
1659 fn lorem<T: Eq>(t: T) {
1660     let lorem: [usize; 2] = [ipsum, dolor];
1661 }
1662 ```
1663
1664 #### `true`:
1665
1666 ```rust
1667 // generic arguments
1668 fn lorem< T: Eq >( t: T ) {
1669     // body
1670 }
1671
1672 // non-empty parentheses
1673 fn lorem< T: Eq >( t: T ) {
1674     let lorem = ( ipsum, dolor );
1675 }
1676
1677 // non-empty square brackets
1678 fn lorem< T: Eq >( t: T ) {
1679     let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1680 }
1681 ```
1682
1683 ## `struct_lit_single_line`
1684
1685 Put small struct literals on a single line
1686
1687 - **Default value**: `true`
1688 - **Possible values**: `true`, `false`
1689 - **Stable**: No
1690
1691 #### `true` (default):
1692
1693 ```rust
1694 fn main() {
1695     let lorem = Lorem { foo: bar, baz: ofo };
1696 }
1697 ```
1698
1699 #### `false`:
1700
1701 ```rust
1702 fn main() {
1703     let lorem = Lorem {
1704         foo: bar,
1705         baz: ofo,
1706     };
1707 }
1708 ```
1709
1710 See also: [`indent_style`](#indent_style).
1711
1712
1713 ## `tab_spaces`
1714
1715 Number of spaces per tab
1716
1717 - **Default value**: `4`
1718 - **Possible values**: any positive integer
1719 - **Stable**: Yes
1720
1721 #### `4` (default):
1722
1723 ```rust
1724 fn lorem() {
1725     let ipsum = dolor();
1726     let sit = vec![
1727         "amet consectetur adipiscing elit amet",
1728         "consectetur adipiscing elit amet consectetur.",
1729     ];
1730 }
1731 ```
1732
1733 #### `2`:
1734
1735 ```rust
1736 fn lorem() {
1737   let ipsum = dolor();
1738   let sit = vec![
1739     "amet consectetur adipiscing elit amet",
1740     "consectetur adipiscing elit amet consectetur.",
1741   ];
1742 }
1743 ```
1744
1745 See also: [`hard_tabs`](#hard_tabs).
1746
1747
1748 ## `trailing_comma`
1749
1750 How to handle trailing commas for lists
1751
1752 - **Default value**: `"Vertical"`
1753 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1754 - **Stable**: No
1755
1756 #### `"Vertical"` (default):
1757
1758 ```rust
1759 fn main() {
1760     let Lorem { ipsum, dolor, sit } = amet;
1761     let Lorem {
1762         ipsum,
1763         dolor,
1764         sit,
1765         amet,
1766         consectetur,
1767         adipiscing,
1768     } = elit;
1769 }
1770 ```
1771
1772 #### `"Always"`:
1773
1774 ```rust
1775 fn main() {
1776     let Lorem { ipsum, dolor, sit, } = amet;
1777     let Lorem {
1778         ipsum,
1779         dolor,
1780         sit,
1781         amet,
1782         consectetur,
1783         adipiscing,
1784     } = elit;
1785 }
1786 ```
1787
1788 #### `"Never"`:
1789
1790 ```rust
1791 fn main() {
1792     let Lorem { ipsum, dolor, sit } = amet;
1793     let Lorem {
1794         ipsum,
1795         dolor,
1796         sit,
1797         amet,
1798         consectetur,
1799         adipiscing
1800     } = elit;
1801 }
1802 ```
1803
1804 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1805
1806 ## `trailing_semicolon`
1807
1808 Add trailing semicolon after break, continue and return
1809
1810 - **Default value**: `true`
1811 - **Possible values**: `true`, `false`
1812 - **Stable**: No
1813
1814 #### `true` (default):
1815 ```rust
1816 fn foo() -> usize {
1817     return 0;
1818 }
1819 ```
1820
1821 #### `false`:
1822 ```rust
1823 fn foo() -> usize {
1824     return 0
1825 }
1826 ```
1827
1828 ## `type_punctuation_density`
1829
1830 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1831
1832 - **Default value**: `"Wide"`
1833 - **Possible values**: `"Compressed"`, `"Wide"`
1834 - **Stable**: No
1835
1836 #### `"Wide"` (default):
1837
1838 ```rust
1839 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1840     // body
1841 }
1842 ```
1843
1844 #### `"Compressed"`:
1845
1846 ```rust
1847 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1848     // body
1849 }
1850 ```
1851
1852 ## `use_field_init_shorthand`
1853
1854 Use field initialize shorthand if possible.
1855
1856 - **Default value**: `false`
1857 - **Possible values**: `true`, `false`
1858 - **Stable**: No
1859
1860 #### `false` (default):
1861
1862 ```rust
1863 struct Foo {
1864     x: u32,
1865     y: u32,
1866     z: u32,
1867 }
1868
1869 fn main() {
1870     let x = 1;
1871     let y = 2;
1872     let z = 3;
1873     let a = Foo { x: x, y: y, z: z };
1874 }
1875 ```
1876
1877 #### `true`:
1878
1879 ```rust
1880 struct Foo {
1881     x: u32,
1882     y: u32,
1883     z: u32,
1884 }
1885
1886 fn main() {
1887     let x = 1;
1888     let y = 2;
1889     let z = 3;
1890     let a = Foo { x, y, z };
1891 }
1892 ```
1893
1894 ## `use_try_shorthand`
1895
1896 Replace uses of the try! macro by the ? shorthand
1897
1898 - **Default value**: `false`
1899 - **Possible values**: `true`, `false`
1900 - **Stable**: No
1901
1902 #### `false` (default):
1903
1904 ```rust
1905 fn main() {
1906     let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1907 }
1908 ```
1909
1910 #### `true`:
1911
1912 ```rust
1913 fn main() {
1914     let lorem = ipsum.map(|dolor| dolor.sit())?;
1915 }
1916 ```
1917
1918
1919 ## `wrap_comments`
1920
1921 Break comments to fit on the line
1922
1923 - **Default value**: `false`
1924 - **Possible values**: `true`, `false`
1925 - **Stable**: Yes
1926
1927 #### `false` (default):
1928
1929 ```rust
1930 // 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.
1931 ```
1932
1933 #### `true`:
1934
1935 ```rust
1936 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
1937 // sed do eiusmod tempor incididunt ut labore et dolore
1938 // magna aliqua. Ut enim ad minim veniam, quis nostrud
1939 // exercitation ullamco laboris nisi ut aliquip ex ea
1940 // commodo consequat.
1941 ```
1942
1943 ## `match_arm_blocks`
1944
1945 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1946
1947 - **Default value**: `true`
1948 - **Possible values**: `true`, `false`
1949 - **Stable**: No
1950
1951 #### `true` (default):
1952
1953 ```rust
1954 fn main() {
1955     match lorem {
1956         true => {
1957             foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1958         }
1959         false => println!("{}", sit),
1960     }
1961 }
1962 ```
1963
1964 #### `false`:
1965
1966 ```rust
1967 fn main() {
1968     match lorem {
1969         true =>
1970             foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1971         false => println!("{}", sit),
1972     }
1973 }
1974 ```
1975
1976 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1977
1978 ## `write_mode`
1979
1980 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
1981
1982 - **Default value**: `"Overwrite"`
1983 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
1984 - **Stable**: No
1985
1986 ## `blank_lines_upper_bound`
1987
1988 Maximum number of blank lines which can be put between items. If more than this number of consecutive empty
1989 lines are found, they are trimmed down to match this integer.
1990
1991 - **Default value**: `1`
1992 - **Possible values**: *unsigned integer*
1993 - **Stable**: No
1994
1995 ### Example
1996 Original Code:
1997
1998 ```rust
1999 #![rustfmt_skip]
2000
2001 fn foo() {
2002     println!("a");
2003 }
2004
2005
2006
2007 fn bar() {
2008     println!("b");
2009
2010
2011     println!("c");
2012 }
2013 ```
2014
2015 #### `1` (default):
2016 ```rust
2017 fn foo() {
2018     println!("a");
2019 }
2020
2021 fn bar() {
2022     println!("b");
2023
2024     println!("c");
2025 }
2026 ```
2027
2028 #### `2` (default):
2029 ```rust
2030 fn foo() {
2031     println!("a");
2032 }
2033
2034
2035 fn bar() {
2036     println!("b");
2037
2038
2039     println!("c");
2040 }
2041 ```
2042
2043 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2044
2045 ## `blank_lines_lower_bound`
2046
2047 Minimum number of blank lines which must be put between items. If two items have fewer blank lines between
2048 them, additional blank lines are inserted.
2049
2050 - **Default value**: `0`
2051 - **Possible values**: *unsigned integer*
2052 - **Stable**: No
2053
2054 ### Example
2055 Original Code (rustfmt will not change it with the default value of `0`):
2056
2057 ```rust
2058 #![rustfmt_skip]
2059
2060 fn foo() {
2061     println!("a");
2062 }
2063 fn bar() {
2064     println!("b");
2065     println!("c");
2066 }
2067 ```
2068
2069 #### `1`
2070 ```rust
2071 fn foo() {
2072
2073     println!("a");
2074 }
2075
2076 fn bar() {
2077
2078     println!("b");
2079
2080     println!("c");
2081 }
2082 ```
2083
2084 ## `remove_blank_lines_at_start_or_end_of_block`
2085
2086 Remove blank lines at the start or the end of a block.
2087
2088 - **Default value**: `true`
2089 - **Possible values**: `true`, `false`
2090 - **Stable**: No
2091
2092 #### `true`
2093
2094 ```rust
2095 fn foo() {
2096     let msg = {
2097         let mut str = String::new();
2098         str.push_str("hello, ");
2099         str.push_str("world!");
2100         str
2101     };
2102     println!("{}", msg);
2103 }
2104 ```
2105
2106 #### `false`
2107
2108 ```rust
2109 fn foo() {
2110
2111     let msg = {
2112
2113         let mut str = String::new();
2114         str.push_str("hello, ");
2115         str.push_str("world!");
2116         str
2117
2118     };
2119     println!("{}", msg);
2120
2121 }
2122 ```
2123
2124 ## `required_version`
2125
2126 Require a specific version of rustfmt. If you want to make sure that the 
2127 specific version of rustfmt is used in your CI, use this option.
2128
2129 - **Default value**: `CARGO_PKG_VERSION`
2130 - **Possible values**: any published version (e.g. `"0.3.8"`)
2131 - **Stable**: No
2132
2133 ## `hide_parse_errors`
2134
2135 Do not show parse errors if the parser failed to parse files.
2136
2137 - **Default value**: `false`
2138 - **Possible values**: `true`, `false`
2139 - **Stable**: No
2140
2141 ## `color`
2142
2143 Whether to use colored output or not.
2144
2145 - **Default value**: `"Auto"`
2146 - **Possible values**: "Auto", "Always", "Never"
2147 - **Stable**: No
2148
2149 ## `unstable_features`
2150
2151 Enable unstable features on stable channel.
2152
2153 - **Default value**: `false`
2154 - **Possible values**: `true`, `false`
2155 - **Stable**: Yes
2156
2157 ## `license_template_path`
2158
2159 Check whether beginnings of files match a license template.
2160
2161 - **Default value**: `""``
2162 - **Possible values**: path to a license template file
2163 - **Stable**: No
2164
2165 A license template is a plain text file which is matched literally against the
2166 beginning of each source file, except for `{}`-delimited blocks, which are
2167 matched as regular expressions. The following license template therefore
2168 matches strings like `// Copyright 2017 The Rust Project Developers.`, `//
2169 Copyright 2018 The Rust Project Developers.`, etc.:
2170
2171 ```
2172 // Copyright {\d+} The Rust Project Developers.
2173 ```
2174
2175 `\{`, `\}` and `\\` match literal braces / backslashes.
2176
2177 ## `ignore`
2178
2179 Skip formatting the specified files and directories.
2180
2181 - **Default value**: format every files
2182 - **Possible values**: See an example below
2183 - **Stable**: No
2184
2185 ### Example
2186
2187 If you want to ignore specific files, put the following to your config file:
2188
2189 ```toml
2190 ignore = [
2191     "src/types.rs",
2192     "src/foo/bar.rs",
2193 ]
2194 ```
2195
2196 If you want to ignore every file under `examples/`, put the following to your config file:
2197
2198 ```toml
2199 ignore [
2200     "examples",
2201 ]
2202 ```