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