]> git.lizzy.rs Git - rust.git/blob - Configurations.md
Add merge_imports config option
[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 ## `merge_imports`
1088
1089 Merge multiple imports into a single nested import.
1090
1091 - **Default value**: `false`
1092 - **Possible values**: `true`, `false`
1093 - **Stable**: No
1094
1095 #### `false` (default):
1096
1097 ```rust
1098 use foo::{a, c, d};
1099 use foo::{b, g};
1100 use foo::{e, f};
1101 ```
1102
1103 #### `true`:
1104
1105 ```rust
1106 use foo::{a, b, c, d, e, f, g};
1107 ```
1108
1109
1110 ## `match_block_trailing_comma`
1111
1112 Put a trailing comma after a block based match arm (non-block arms are not affected)
1113
1114 - **Default value**: `false`
1115 - **Possible values**: `true`, `false`
1116 - **Stable**: No
1117
1118 #### `false` (default):
1119
1120 ```rust
1121 fn main() {
1122     match lorem {
1123         Lorem::Ipsum => {
1124             println!("ipsum");
1125         }
1126         Lorem::Dolor => println!("dolor"),
1127     }
1128 }
1129 ```
1130
1131 #### `true`:
1132
1133 ```rust
1134 fn main() {
1135     match lorem {
1136         Lorem::Ipsum => {
1137             println!("ipsum");
1138         },
1139         Lorem::Dolor => println!("dolor"),
1140     }
1141 }
1142 ```
1143
1144 See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_blocks).
1145
1146 ## `max_width`
1147
1148 Maximum width of each line
1149
1150 - **Default value**: `100`
1151 - **Possible values**: any positive integer
1152 - **Stable**: Yes
1153
1154 See also [`error_on_line_overflow`](#error_on_line_overflow).
1155
1156 ## `merge_derives`
1157
1158 Merge multiple derives into a single one.
1159
1160 - **Default value**: `true`
1161 - **Possible values**: `true`, `false`
1162 - **Stable**: Yes
1163
1164 #### `true` (default):
1165
1166 ```rust
1167 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1168 pub enum Foo {}
1169 ```
1170
1171 #### `false`:
1172
1173 ```rust
1174 #[derive(Eq, PartialEq)]
1175 #[derive(Debug)]
1176 #[derive(Copy, Clone)]
1177 pub enum Foo {}
1178 ```
1179
1180 ## `force_multiline_blocks`
1181
1182 Force multiline closure and match arm bodies to be wrapped in a block
1183
1184 - **Default value**: `false`
1185 - **Possible values**: `false`, `true`
1186 - **Stable**: No
1187
1188 #### `false` (default):
1189
1190 ```rust
1191 fn main() {
1192     result.and_then(|maybe_value| match maybe_value {
1193         None => foo(),
1194         Some(value) => bar(),
1195     });
1196
1197     match lorem {
1198         None => if ipsum {
1199             println!("Hello World");
1200         },
1201         Some(dolor) => foo(),
1202     }
1203 }
1204 ```
1205
1206 #### `true`:
1207
1208 ```rust
1209 fn main() {
1210     result.and_then(|maybe_value| {
1211         match maybe_value {
1212             None => foo(),
1213             Some(value) => bar(),
1214         }
1215     });
1216
1217     match lorem {
1218         None => {
1219             if ipsum {
1220                 println!("Hello World");
1221             }
1222         }
1223         Some(dolor) => foo(),
1224     }
1225 }
1226 ```
1227
1228
1229 ## `newline_style`
1230
1231 Unix or Windows line endings
1232
1233 - **Default value**: `"Unix"`
1234 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1235 - **Stable**: Yes
1236
1237 ## `normalize_comments`
1238
1239 Convert /* */ comments to // comments where possible
1240
1241 - **Default value**: `false`
1242 - **Possible values**: `true`, `false`
1243 - **Stable**: Yes
1244
1245 #### `false` (default):
1246
1247 ```rust
1248 // Lorem ipsum:
1249 fn dolor() -> usize {}
1250
1251 /* sit amet: */
1252 fn adipiscing() -> usize {}
1253 ```
1254
1255 #### `true`:
1256
1257 ```rust
1258 // Lorem ipsum:
1259 fn dolor() -> usize {}
1260
1261 // sit amet:
1262 fn adipiscing() -> usize {}
1263 ```
1264
1265 ## `reorder_imported_names`
1266
1267 Reorder lists of names in 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 super::{lorem, ipsum, dolor, sit};
1277 ```
1278
1279 #### `true`:
1280
1281 ```rust
1282 use super::{dolor, ipsum, lorem, sit};
1283 ```
1284
1285 See also [`reorder_imports`](#reorder_imports).
1286
1287 ## `reorder_imports`
1288
1289 Reorder import statements alphabetically
1290
1291 - **Default value**: `false`
1292 - **Possible values**: `true`, `false`
1293 - **Stable**: No
1294
1295 #### `false` (default):
1296
1297 ```rust
1298 use lorem;
1299 use ipsum;
1300 use dolor;
1301 use sit;
1302 ```
1303
1304 #### `true`:
1305
1306 ```rust
1307 use dolor;
1308 use ipsum;
1309 use lorem;
1310 use sit;
1311 ```
1312
1313 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1314
1315 ## `reorder_imports_in_group`
1316
1317 Reorder import statements in group
1318
1319 - **Default value**: `false`
1320 - **Possible values**: `true`, `false`
1321 - **Stable**: No
1322
1323 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1324
1325 #### `true` (default):
1326
1327 ```rust
1328 use std::io;
1329 use std::mem;
1330
1331 use dolor;
1332 use ipsum;
1333 use lorem;
1334 use sit;
1335 ```
1336
1337 #### `false`:
1338
1339
1340 ```rust
1341 use dolor;
1342 use ipsum;
1343 use lorem;
1344 use sit;
1345 use std::io;
1346 use std::mem;
1347 ```
1348
1349 See also [`reorder_imports`](#reorder_imports).
1350
1351 ## `reorder_extern_crates`
1352
1353 Reorder `extern crate` statements alphabetically
1354
1355 - **Default value**: `true`
1356 - **Possible values**: `true`, `false`
1357 - **Stable**: No
1358
1359 #### `true` (default):
1360
1361 ```rust
1362 extern crate dolor;
1363 extern crate ipsum;
1364 extern crate lorem;
1365 extern crate sit;
1366 ```
1367
1368 #### `false`:
1369
1370 ```rust
1371 extern crate lorem;
1372 extern crate ipsum;
1373
1374 extern crate dolor;
1375 extern crate sit;
1376 ```
1377
1378 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1379
1380 ## `reorder_extern_crates_in_group`
1381
1382 Reorder `extern crate` statements in group
1383
1384 - **Default value**: `true`
1385 - **Possible values**: `true`, `false`
1386 - **Stable**: No
1387
1388 #### `false` (default):
1389
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.
1391
1392 #### `true`:
1393
1394 **Note:** This only takes effect when [`reorder_extern_crates`](#reorder_extern_crates) is set to `true`.
1395
1396 ```rust
1397 extern crate a;
1398 extern crate b;
1399
1400 extern crate dolor;
1401 extern crate ipsum;
1402 extern crate lorem;
1403 extern crate sit;
1404 ```
1405
1406 ## `reorder_modules`
1407
1408 Reorder `mod` declarations alphabetically in group.
1409
1410 - **Default value**: `true`
1411 - **Possible values**: `true`, `false`
1412 - **Stable**: No
1413
1414 #### `true` (default)
1415
1416 ```rust
1417 mod a;
1418 mod b;
1419
1420 mod dolor;
1421 mod ipsum;
1422 mod lorem;
1423 mod sit;
1424 ```
1425
1426 #### `false`
1427
1428 ```rust
1429 mod b;
1430 mod a;
1431
1432 mod lorem;
1433 mod ipsum;
1434 mod dolor;
1435 mod sit;
1436 ```
1437
1438 **Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantic
1439 of the original source code.
1440
1441 ## `reorder_impl_items`
1442
1443 Reorder impl items. `type` and `const` are put first, then macros and methods.
1444
1445 - **Default value**: `false`
1446 - **Possible values**: `true`, `false`
1447 - **Stable**: No
1448
1449 #### `false` (default)
1450
1451 ```rust
1452 struct Dummy;
1453
1454 impl Iterator for Dummy {
1455     fn next(&mut self) -> Option<Self::Item> {
1456         None
1457     }
1458
1459     type Item = i32;
1460 }
1461 ```
1462
1463 #### `true`
1464
1465 ```rust
1466 struct Dummy;
1467
1468 impl Iterator for Dummy {
1469     type Item = i32;
1470
1471     fn next(&mut self) -> Option<Self::Item> {
1472         None
1473     }
1474 }
1475 ```
1476
1477 ## `report_todo`
1478
1479 Report `TODO` items in comments.
1480
1481 - **Default value**: `"Never"`
1482 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1483 - **Stable**: No
1484
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.
1488
1489 See also [`report_fixme`](#report_fixme).
1490
1491 ## `report_fixme`
1492
1493 Report `FIXME` items in comments.
1494
1495 - **Default value**: `"Never"`
1496 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1497 - **Stable**: No
1498
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.
1502
1503 See also [`report_todo`](#report_todo).
1504
1505
1506 ## `skip_children`
1507
1508 Don't reformat out of line modules
1509
1510 - **Default value**: `false`
1511 - **Possible values**: `true`, `false`
1512 - **Stable**: No
1513
1514 ## `space_after_colon`
1515
1516 Leave a space after the colon.
1517
1518 - **Default value**: `true`
1519 - **Possible values**: `true`, `false`
1520 - **Stable**: No
1521
1522 #### `true` (default):
1523
1524 ```rust
1525 fn lorem<T: Eq>(t: T) {
1526     let lorem: Dolor = Lorem {
1527         ipsum: dolor,
1528         sit: amet,
1529     };
1530 }
1531 ```
1532
1533 #### `false`:
1534
1535 ```rust
1536 fn lorem<T:Eq>(t:T) {
1537     let lorem:Dolor = Lorem {
1538         ipsum:dolor,
1539         sit:amet,
1540     };
1541 }
1542 ```
1543
1544 See also: [`space_before_colon`](#space_before_colon).
1545
1546 ## `space_before_colon`
1547
1548 Leave a space before the colon.
1549
1550 - **Default value**: `false`
1551 - **Possible values**: `true`, `false`
1552 - **Stable**: No
1553
1554 #### `false` (default):
1555
1556 ```rust
1557 fn lorem<T: Eq>(t: T) {
1558     let lorem: Dolor = Lorem {
1559         ipsum: dolor,
1560         sit: amet,
1561     };
1562 }
1563 ```
1564
1565 #### `true`:
1566
1567 ```rust
1568 fn lorem<T : Eq>(t : T) {
1569     let lorem : Dolor = Lorem {
1570         ipsum : dolor,
1571         sit : amet,
1572     };
1573 }
1574 ```
1575
1576 See also: [`space_after_colon`](#space_after_colon).
1577
1578 ## `struct_field_align_threshold`
1579
1580 The maximum diff of width between struct fields to be aligned with each other.
1581
1582 - **Default value** : 0
1583 - **Possible values**: any positive integer
1584 - **Stable**: No
1585
1586 #### `0` (default):
1587
1588 ```rust
1589 struct Foo {
1590     x: u32,
1591     yy: u32,
1592     zzz: u32,
1593 }
1594 ```
1595
1596 #### `20`:
1597
1598 ```rust
1599 struct Foo {
1600     x:   u32,
1601     yy:  u32,
1602     zzz: u32,
1603 }
1604 ```
1605
1606 ## `spaces_around_ranges`
1607
1608 Put spaces around the .., ..=, and ... range operators
1609
1610 - **Default value**: `false`
1611 - **Possible values**: `true`, `false`
1612 - **Stable**: No
1613
1614 #### `false` (default):
1615
1616 ```rust
1617 fn main() {
1618     let lorem = 0..10;
1619     let ipsum = 0..=10;
1620
1621     match lorem {
1622         1..5 => foo(),
1623         _ => bar,
1624     }
1625
1626     match lorem {
1627         1..=5 => foo(),
1628         _ => bar,
1629     }
1630
1631     match lorem {
1632         1...5 => foo(),
1633         _ => bar,
1634     }
1635 }
1636 ```
1637
1638 #### `true`:
1639
1640 ```rust
1641 fn main() {
1642     let lorem = 0 .. 10;
1643     let ipsum = 0 ..= 10;
1644
1645     match lorem {
1646         1 .. 5 => foo(),
1647         _ => bar,
1648     }
1649
1650     match lorem {
1651         1 ..= 5 => foo(),
1652         _ => bar,
1653     }
1654
1655     match lorem {
1656         1 ... 5 => foo(),
1657         _ => bar,
1658     }
1659 }
1660 ```
1661
1662 ## `spaces_within_parens_and_brackets`
1663
1664 Put spaces within non-empty generic arguments, parentheses, and square brackets
1665
1666 - **Default value**: `false`
1667 - **Possible values**: `true`, `false`
1668 - **Stable**: No
1669
1670 #### `false` (default):
1671
1672 ```rust
1673 // generic arguments
1674 fn lorem<T: Eq>(t: T) {
1675     // body
1676 }
1677
1678 // non-empty parentheses
1679 fn lorem<T: Eq>(t: T) {
1680     let lorem = (ipsum, dolor);
1681 }
1682
1683 // non-empty square brackets
1684 fn lorem<T: Eq>(t: T) {
1685     let lorem: [usize; 2] = [ipsum, dolor];
1686 }
1687 ```
1688
1689 #### `true`:
1690
1691 ```rust
1692 // generic arguments
1693 fn lorem< T: Eq >( t: T ) {
1694     // body
1695 }
1696
1697 // non-empty parentheses
1698 fn lorem< T: Eq >( t: T ) {
1699     let lorem = ( ipsum, dolor );
1700 }
1701
1702 // non-empty square brackets
1703 fn lorem< T: Eq >( t: T ) {
1704     let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1705 }
1706 ```
1707
1708 ## `struct_lit_single_line`
1709
1710 Put small struct literals on a single line
1711
1712 - **Default value**: `true`
1713 - **Possible values**: `true`, `false`
1714 - **Stable**: No
1715
1716 #### `true` (default):
1717
1718 ```rust
1719 fn main() {
1720     let lorem = Lorem { foo: bar, baz: ofo };
1721 }
1722 ```
1723
1724 #### `false`:
1725
1726 ```rust
1727 fn main() {
1728     let lorem = Lorem {
1729         foo: bar,
1730         baz: ofo,
1731     };
1732 }
1733 ```
1734
1735 See also: [`indent_style`](#indent_style).
1736
1737
1738 ## `tab_spaces`
1739
1740 Number of spaces per tab
1741
1742 - **Default value**: `4`
1743 - **Possible values**: any positive integer
1744 - **Stable**: Yes
1745
1746 #### `4` (default):
1747
1748 ```rust
1749 fn lorem() {
1750     let ipsum = dolor();
1751     let sit = vec![
1752         "amet consectetur adipiscing elit amet",
1753         "consectetur adipiscing elit amet consectetur.",
1754     ];
1755 }
1756 ```
1757
1758 #### `2`:
1759
1760 ```rust
1761 fn lorem() {
1762   let ipsum = dolor();
1763   let sit = vec![
1764     "amet consectetur adipiscing elit amet",
1765     "consectetur adipiscing elit amet consectetur.",
1766   ];
1767 }
1768 ```
1769
1770 See also: [`hard_tabs`](#hard_tabs).
1771
1772
1773 ## `trailing_comma`
1774
1775 How to handle trailing commas for lists
1776
1777 - **Default value**: `"Vertical"`
1778 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1779 - **Stable**: No
1780
1781 #### `"Vertical"` (default):
1782
1783 ```rust
1784 fn main() {
1785     let Lorem { ipsum, dolor, sit } = amet;
1786     let Lorem {
1787         ipsum,
1788         dolor,
1789         sit,
1790         amet,
1791         consectetur,
1792         adipiscing,
1793     } = elit;
1794 }
1795 ```
1796
1797 #### `"Always"`:
1798
1799 ```rust
1800 fn main() {
1801     let Lorem { ipsum, dolor, sit, } = amet;
1802     let Lorem {
1803         ipsum,
1804         dolor,
1805         sit,
1806         amet,
1807         consectetur,
1808         adipiscing,
1809     } = elit;
1810 }
1811 ```
1812
1813 #### `"Never"`:
1814
1815 ```rust
1816 fn main() {
1817     let Lorem { ipsum, dolor, sit } = amet;
1818     let Lorem {
1819         ipsum,
1820         dolor,
1821         sit,
1822         amet,
1823         consectetur,
1824         adipiscing
1825     } = elit;
1826 }
1827 ```
1828
1829 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1830
1831 ## `trailing_semicolon`
1832
1833 Add trailing semicolon after break, continue and return
1834
1835 - **Default value**: `true`
1836 - **Possible values**: `true`, `false`
1837 - **Stable**: No
1838
1839 #### `true` (default):
1840 ```rust
1841 fn foo() -> usize {
1842     return 0;
1843 }
1844 ```
1845
1846 #### `false`:
1847 ```rust
1848 fn foo() -> usize {
1849     return 0
1850 }
1851 ```
1852
1853 ## `type_punctuation_density`
1854
1855 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1856
1857 - **Default value**: `"Wide"`
1858 - **Possible values**: `"Compressed"`, `"Wide"`
1859 - **Stable**: No
1860
1861 #### `"Wide"` (default):
1862
1863 ```rust
1864 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1865     // body
1866 }
1867 ```
1868
1869 #### `"Compressed"`:
1870
1871 ```rust
1872 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1873     // body
1874 }
1875 ```
1876
1877 ## `use_field_init_shorthand`
1878
1879 Use field initialize shorthand if possible.
1880
1881 - **Default value**: `false`
1882 - **Possible values**: `true`, `false`
1883 - **Stable**: No
1884
1885 #### `false` (default):
1886
1887 ```rust
1888 struct Foo {
1889     x: u32,
1890     y: u32,
1891     z: u32,
1892 }
1893
1894 fn main() {
1895     let x = 1;
1896     let y = 2;
1897     let z = 3;
1898     let a = Foo { x: x, y: y, z: z };
1899 }
1900 ```
1901
1902 #### `true`:
1903
1904 ```rust
1905 struct Foo {
1906     x: u32,
1907     y: u32,
1908     z: u32,
1909 }
1910
1911 fn main() {
1912     let x = 1;
1913     let y = 2;
1914     let z = 3;
1915     let a = Foo { x, y, z };
1916 }
1917 ```
1918
1919 ## `use_try_shorthand`
1920
1921 Replace uses of the try! macro by the ? shorthand
1922
1923 - **Default value**: `false`
1924 - **Possible values**: `true`, `false`
1925 - **Stable**: No
1926
1927 #### `false` (default):
1928
1929 ```rust
1930 fn main() {
1931     let lorem = try!(ipsum.map(|dolor| dolor.sit()));
1932 }
1933 ```
1934
1935 #### `true`:
1936
1937 ```rust
1938 fn main() {
1939     let lorem = ipsum.map(|dolor| dolor.sit())?;
1940 }
1941 ```
1942
1943
1944 ## `wrap_comments`
1945
1946 Break comments to fit on the line
1947
1948 - **Default value**: `false`
1949 - **Possible values**: `true`, `false`
1950 - **Stable**: Yes
1951
1952 #### `false` (default):
1953
1954 ```rust
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.
1956 ```
1957
1958 #### `true`:
1959
1960 ```rust
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.
1966 ```
1967
1968 ## `match_arm_blocks`
1969
1970 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
1971
1972 - **Default value**: `true`
1973 - **Possible values**: `true`, `false`
1974 - **Stable**: No
1975
1976 #### `true` (default):
1977
1978 ```rust
1979 fn main() {
1980     match lorem {
1981         true => {
1982             foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
1983         }
1984         false => println!("{}", sit),
1985     }
1986 }
1987 ```
1988
1989 #### `false`:
1990
1991 ```rust
1992 fn main() {
1993     match lorem {
1994         true =>
1995             foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
1996         false => println!("{}", sit),
1997     }
1998 }
1999 ```
2000
2001 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
2002
2003 ## `write_mode`
2004
2005 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2006
2007 - **Default value**: `"Overwrite"`
2008 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`
2009 - **Stable**: No
2010
2011 ## `blank_lines_upper_bound`
2012
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.
2015
2016 - **Default value**: `1`
2017 - **Possible values**: *unsigned integer*
2018 - **Stable**: No
2019
2020 ### Example
2021 Original Code:
2022
2023 ```rust
2024 #![rustfmt_skip]
2025
2026 fn foo() {
2027     println!("a");
2028 }
2029
2030
2031
2032 fn bar() {
2033     println!("b");
2034
2035
2036     println!("c");
2037 }
2038 ```
2039
2040 #### `1` (default):
2041 ```rust
2042 fn foo() {
2043     println!("a");
2044 }
2045
2046 fn bar() {
2047     println!("b");
2048
2049     println!("c");
2050 }
2051 ```
2052
2053 #### `2` (default):
2054 ```rust
2055 fn foo() {
2056     println!("a");
2057 }
2058
2059
2060 fn bar() {
2061     println!("b");
2062
2063
2064     println!("c");
2065 }
2066 ```
2067
2068 See also: [`blank_lines_lower_bound`](#blank_lines_lower_bound)
2069
2070 ## `blank_lines_lower_bound`
2071
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.
2074
2075 - **Default value**: `0`
2076 - **Possible values**: *unsigned integer*
2077 - **Stable**: No
2078
2079 ### Example
2080 Original Code (rustfmt will not change it with the default value of `0`):
2081
2082 ```rust
2083 #![rustfmt_skip]
2084
2085 fn foo() {
2086     println!("a");
2087 }
2088 fn bar() {
2089     println!("b");
2090     println!("c");
2091 }
2092 ```
2093
2094 #### `1`
2095 ```rust
2096 fn foo() {
2097
2098     println!("a");
2099 }
2100
2101 fn bar() {
2102
2103     println!("b");
2104
2105     println!("c");
2106 }
2107 ```
2108
2109 ## `remove_blank_lines_at_start_or_end_of_block`
2110
2111 Remove blank lines at the start or the end of a block.
2112
2113 - **Default value**: `true`
2114 - **Possible values**: `true`, `false`
2115 - **Stable**: No
2116
2117 #### `true`
2118
2119 ```rust
2120 fn foo() {
2121     let msg = {
2122         let mut str = String::new();
2123         str.push_str("hello, ");
2124         str.push_str("world!");
2125         str
2126     };
2127     println!("{}", msg);
2128 }
2129 ```
2130
2131 #### `false`
2132
2133 ```rust
2134 fn foo() {
2135
2136     let msg = {
2137
2138         let mut str = String::new();
2139         str.push_str("hello, ");
2140         str.push_str("world!");
2141         str
2142
2143     };
2144     println!("{}", msg);
2145
2146 }
2147 ```
2148
2149 ## `required_version`
2150
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.
2153
2154 - **Default value**: `CARGO_PKG_VERSION`
2155 - **Possible values**: any published version (e.g. `"0.3.8"`)
2156 - **Stable**: No
2157
2158 ## `hide_parse_errors`
2159
2160 Do not show parse errors if the parser failed to parse files.
2161
2162 - **Default value**: `false`
2163 - **Possible values**: `true`, `false`
2164 - **Stable**: No
2165
2166 ## `color`
2167
2168 Whether to use colored output or not.
2169
2170 - **Default value**: `"Auto"`
2171 - **Possible values**: "Auto", "Always", "Never"
2172 - **Stable**: No
2173
2174 ## `unstable_features`
2175
2176 Enable unstable features on stable channel.
2177
2178 - **Default value**: `false`
2179 - **Possible values**: `true`, `false`
2180 - **Stable**: Yes
2181
2182 ## `license_template_path`
2183
2184 Check whether beginnings of files match a license template.
2185
2186 - **Default value**: `""``
2187 - **Possible values**: path to a license template file
2188 - **Stable**: No
2189
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.:
2195
2196 ```
2197 // Copyright {\d+} The Rust Project Developers.
2198 ```
2199
2200 `\{`, `\}` and `\\` match literal braces / backslashes.
2201
2202 ## `ignore`
2203
2204 Skip formatting the specified files and directories.
2205
2206 - **Default value**: format every files
2207 - **Possible values**: See an example below
2208 - **Stable**: No
2209
2210 ### Example
2211
2212 If you want to ignore specific files, put the following to your config file:
2213
2214 ```toml
2215 ignore = [
2216     "src/types.rs",
2217     "src/foo/bar.rs",
2218 ]
2219 ```
2220
2221 If you want to ignore every file under `examples/`, put the following to your config file:
2222
2223 ```toml
2224 ignore [
2225     "examples",
2226 ]
2227 ```