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