]> git.lizzy.rs Git - rust.git/blob - Configurations.md
Remove `force_format_strings` in favour of `format_strings`
[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 ### Function 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
810 ## `brace_style`
811
812 Brace style for items
813
814 - **Default value**: `"SameLineWhere"`
815 - **Possible values**: `"AlwaysNextLine"`, `"PreferSameLine"`, `"SameLineWhere"`
816
817 ### Functions
818
819 #### `"SameLineWhere"` (default):
820
821 ```rust
822 fn lorem() {
823     // body
824 }
825
826 fn lorem(ipsum: usize) {
827     // body
828 }
829
830 fn lorem<T>(ipsum: T)
831 where
832     T: Add + Sub + Mul + Div,
833 {
834     // body
835 }
836 ```
837
838 #### `"AlwaysNextLine"`:
839
840 ```rust
841 fn lorem()
842 {
843     // body
844 }
845
846 fn lorem(ipsum: usize)
847 {
848     // body
849 }
850
851 fn lorem<T>(ipsum: T)
852 where
853     T: Add + Sub + Mul + Div,
854 {
855     // body
856 }
857 ```
858
859 #### `"PreferSameLine"`:
860
861 ```rust
862 fn lorem() {
863     // body
864 }
865
866 fn lorem(ipsum: usize) {
867     // body
868 }
869
870 fn lorem<T>(ipsum: T)
871 where
872     T: Add + Sub + Mul + Div, {
873     // body
874 }
875 ```
876
877 ### Structs and enums
878
879 #### `"SameLineWhere"` (default):
880
881 ```rust
882 struct Lorem {
883     ipsum: bool,
884 }
885
886 struct Dolor<T>
887     where T: Eq
888 {
889     sit: T,
890 }
891 ```
892
893 #### `"AlwaysNextLine"`:
894
895 ```rust
896 struct Lorem
897 {
898     ipsum: bool,
899 }
900
901 struct Dolor<T>
902     where T: Eq
903 {
904     sit: T,
905 }
906 ```
907
908 #### `"PreferSameLine"`:
909
910 ```rust
911 struct Lorem {
912     ipsum: bool,
913 }
914
915 struct Dolor<T>
916     where T: Eq {
917     sit: T,
918 }
919 ```
920
921 ## `fn_call_width`
922
923 Maximum width of the args of a function call before falling back to vertical formatting
924
925 - **Default value**: `60`
926 - **Possible values**: any positive integer
927
928 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
929
930 #### Function call shorter than `fn_call_width`:
931 ```rust
932 lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit");
933 ```
934
935 #### Function call longer than `fn_call_width`:
936
937 See [`indent_style`](#indent_style).
938
939 ## `fn_empty_single_line`
940
941 Put empty-body functions on a single line
942
943 - **Default value**: `true`
944 - **Possible values**: `true`, `false`
945
946 #### `true` (default):
947
948 ```rust
949 fn lorem() {}
950 ```
951
952 #### `false`:
953
954 ```rust
955 fn lorem() {
956 }
957 ```
958
959 See also [`control_brace_style`](#control_brace_style).
960
961
962 ## `fn_single_line`
963
964 Put single-expression functions on a single line
965
966 - **Default value**: `false`
967 - **Possible values**: `true`, `false`
968
969 #### `false` (default):
970
971 ```rust
972 fn lorem() -> usize {
973     42
974 }
975
976 fn lorem() -> usize {
977     let ipsum = 42;
978     ipsum
979 }
980 ```
981
982 #### `true`:
983
984 ```rust
985 fn lorem() -> usize { 42 }
986
987 fn lorem() -> usize {
988     let ipsum = 42;
989     ipsum
990 }
991 ```
992
993 See also [`control_brace_style`](#control_brace_style).
994
995 ## `force_explicit_abi`
996
997 Always print the abi for extern items
998
999 - **Default value**: `true`
1000 - **Possible values**: `true`, `false`
1001
1002 **Note:** Non-"C" ABIs are always printed. If `false` then "C" is removed.
1003
1004 #### `true` (default):
1005
1006 ```rust
1007 extern "C" {
1008     pub static lorem: c_int;
1009 }
1010 ```
1011
1012 #### `false`:
1013
1014 ```rust
1015 extern {
1016     pub static lorem: c_int;
1017 }
1018 ```
1019
1020 ## `format_strings`
1021
1022 Format string literals where necessary
1023
1024 - **Default value**: `false`
1025 - **Possible values**: `true`, `false`
1026
1027 #### `false` (default):
1028
1029 ```rust
1030 let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit";
1031 ```
1032
1033 #### `true`:
1034
1035 ```rust
1036 let lorem =
1037     "ipsum dolor sit amet consectetur \
1038      adipiscing elit lorem ipsum dolor sit";
1039 ```
1040
1041 See also [`max_width`](#max_width).
1042
1043 ## `hard_tabs`
1044
1045 Use tab characters for indentation, spaces for alignment
1046
1047 - **Default value**: `false`
1048 - **Possible values**: `true`, `false`
1049
1050 #### `false` (default):
1051
1052 ```rust
1053 fn lorem() -> usize {
1054     42 // spaces before 42
1055 }
1056 ```
1057
1058 #### `true`:
1059
1060 ```rust
1061 fn lorem() -> usize {
1062         42 // tabs before 42
1063 }
1064 ```
1065
1066 See also: [`tab_spaces`](#tab_spaces).
1067
1068 ## `impl_empty_single_line`
1069
1070 Put empty-body implementations on a single line
1071
1072 - **Default value**: `true`
1073 - **Possible values**: `true`, `false`
1074
1075 #### `true` (default):
1076
1077 ```rust
1078 impl Lorem {}
1079 ```
1080
1081 #### `false`:
1082
1083 ```rust
1084 impl Lorem {
1085 }
1086 ```
1087
1088 See also [`brace_style`](#brace_style).
1089
1090 ## `indent_match_arms`
1091
1092 Indent match arms instead of keeping them at the same indentation level as the match keyword
1093
1094 - **Default value**: `true`
1095 - **Possible values**: `true`, `false`
1096
1097 #### `true` (default):
1098
1099 ```rust
1100 match lorem {
1101     Lorem::Ipsum => (),
1102     Lorem::Dolor => (),
1103     Lorem::Sit => (),
1104     Lorem::Amet => (),
1105 }
1106 ```
1107
1108 #### `false`:
1109
1110 ```rust
1111 match lorem {
1112 Lorem::Ipsum => (),
1113 Lorem::Dolor => (),
1114 Lorem::Sit => (),
1115 Lorem::Amet => (),
1116 }
1117 ```
1118
1119 See also: [`match_block_trailing_comma`](#match_block_trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1120
1121 ## `imports_indent`
1122
1123 Indent style of imports
1124
1125 - **Default Value**: `"Visual"`
1126 - **Possible values**: `"Block"`, `"Visual"`
1127
1128 #### `"Visual"` (default):
1129
1130 ```rust
1131 use foo::{xxx,
1132           yyy,
1133           zzz};
1134 ```
1135
1136 #### `"Block"`:
1137
1138 ```rust
1139 use foo::{
1140     xxx,
1141     yyy,
1142     zzz,
1143 };
1144 ```
1145
1146 See also: [`imports_layout`](#imports_layout).
1147
1148 ## `imports_layout`
1149
1150 Item layout inside a imports block
1151
1152 - **Default value**: "Mixed"
1153 - **Possible values**: "Horizontal", "HorizontalVertical", "Mixed", "Vertical"
1154
1155 #### `"Mixed"` (default):
1156
1157 ```rust
1158 use foo::{xxx, yyy, zzz};
1159
1160 use foo::{aaa, bbb, ccc,
1161           ddd, eee, fff};
1162 ```
1163
1164 #### `"Horizontal"`:
1165
1166 **Note**: This option forces to put everything on one line and may exceeds `max_width`.
1167
1168 ```rust
1169 use foo::{xxx, yyy, zzz};
1170
1171 use foo::{aaa, bbb, ccc, ddd, eee, fff};
1172 ```
1173
1174 #### `"HorizontalVertical"`:
1175
1176 ```rust
1177 use foo::{xxx, yyy, zzz};
1178
1179 use foo::{aaa,
1180           bbb,
1181           ccc,
1182           ddd,
1183           eee,
1184           fff};
1185 ```
1186
1187 #### `"Vertical"`:
1188
1189 ```rust
1190 use foo::{xxx,
1191           yyy,
1192           zzz};
1193
1194 use foo::{aaa,
1195           bbb,
1196           ccc,
1197           ddd,
1198           eee,
1199           fff};
1200 ```
1201
1202 ## `match_arm_forces_newline`
1203
1204 Consistently put match arms (block based or not) in a newline.
1205
1206 - **Default value**: `false`
1207 - **Possible values**: `true`, `false`
1208
1209 #### `false` (default):
1210
1211 ```rust
1212 match x {
1213     // a non-empty block
1214     X0 => {
1215         f();
1216     }
1217     // an empty block
1218     X1 => {}
1219     // a non-block
1220     X2 => println!("ok"),
1221 }
1222 ```
1223
1224 #### `true`:
1225
1226 ```rust
1227 match x {
1228     // a non-empty block
1229     X0 => {
1230         f();
1231     }
1232     // an empty block
1233     X1 =>
1234         {}
1235     // a non-block
1236     X2 => {
1237         println!("ok")
1238     }
1239 }
1240 ```
1241
1242 See also: [`wrap_match_arms`](#wrap_match_arms).
1243
1244 ## `match_block_trailing_comma`
1245
1246 Put a trailing comma after a block based match arm (non-block arms are not affected)
1247
1248 - **Default value**: `false`
1249 - **Possible values**: `true`, `false`
1250
1251 #### `false` (default):
1252
1253 ```rust
1254 match lorem {
1255     Lorem::Ipsum => {
1256         println!("ipsum");
1257     }
1258     Lorem::Dolor => println!("dolor"),
1259 }
1260 ```
1261
1262 #### `true`:
1263
1264 ```rust
1265 match lorem {
1266     Lorem::Ipsum => {
1267         println!("ipsum");
1268     },
1269     Lorem::Dolor => println!("dolor"),
1270 }
1271 ```
1272
1273 See also: [`indent_match_arms`](#indent_match_arms), [`trailing_comma`](#trailing_comma), [`wrap_match_arms`](#wrap_match_arms).
1274
1275 ## `max_width`
1276
1277 Maximum width of each line
1278
1279 - **Default value**: `100`
1280 - **Possible values**: any positive integer
1281
1282 See also [`error_on_line_overflow`](#error_on_line_overflow).
1283
1284 ## `merge_derives`
1285
1286 Merge multiple derives into a single one.
1287
1288 - **Default value**: `true`
1289 - **Possible values**: `true`, `false`
1290
1291 #### `true` (default):
1292
1293 ```rust
1294 #[derive(Eq, PartialEq, Debug, Copy, Clone)]
1295 pub enum Foo {}
1296 ```
1297
1298 #### `false`:
1299
1300 ```rust
1301 #[derive(Eq, PartialEq)]
1302 #[derive(Debug)]
1303 #[derive(Copy, Clone)]
1304 pub enum Foo {}
1305 ```
1306
1307 ## `multiline_closure_forces_block`
1308
1309 Force multiline closure bodies to be wrapped in a block
1310
1311 - **Default value**: `false`
1312 - **Possible values**: `false`, `true`
1313
1314 #### `false` (default):
1315
1316 ```rust
1317 result.and_then(|maybe_value| match maybe_value {
1318     None => ...,
1319     Some(value) => ...,
1320 })
1321 ```
1322
1323 #### `true`:
1324
1325 ```rust
1326
1327 result.and_then(|maybe_value| {
1328     match maybe_value {
1329         None => ...,
1330         Some(value) => ...,
1331     }
1332 })
1333 ```
1334
1335 ## `multiline_match_arm_forces_block`
1336
1337 Force multiline match arm bodies to be wrapped in a block
1338
1339 - **Default value**: `false`
1340 - **Possible values**: `false`, `true`
1341
1342 #### `false` (default):
1343
1344 ```rust
1345 match lorem {
1346     None => if ipsum {
1347         println!("Hello World");
1348     },
1349     Some(dolor) => ...,
1350 }
1351 ```
1352
1353 #### `true`:
1354
1355 ```rust
1356 match lorem {
1357     None => {
1358         if ipsum {
1359             println!("Hello World");
1360         }
1361     }
1362     Some(dolor) => ...,
1363 }
1364 ```
1365
1366 ## `newline_style`
1367
1368 Unix or Windows line endings
1369
1370 - **Default value**: `"Unix"`
1371 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1372
1373 ## `normalize_comments`
1374
1375 Convert /* */ comments to // comments where possible
1376
1377 - **Default value**: `false`
1378 - **Possible values**: `true`, `false`
1379
1380 #### `false` (default):
1381
1382 ```rust
1383 // Lorem ipsum:
1384 fn dolor() -> usize {}
1385
1386 /* sit amet: */
1387 fn adipiscing() -> usize {}
1388 ```
1389
1390 #### `true`:
1391
1392 ```rust
1393 // Lorem ipsum:
1394 fn dolor() -> usize {}
1395
1396 // sit amet:
1397 fn adipiscing() -> usize {}
1398 ```
1399
1400 ## `reorder_imported_names`
1401
1402 Reorder lists of names in import statements alphabetically
1403
1404 - **Default value**: `false`
1405 - **Possible values**: `true`, `false`
1406
1407 #### `false` (default):
1408
1409 ```rust
1410 use super::{lorem, ipsum, dolor, sit};
1411 ```
1412
1413 #### `true`:
1414
1415 ```rust
1416 use super::{dolor, ipsum, lorem, sit};
1417 ```
1418
1419 See also [`reorder_imports`](#reorder_imports).
1420
1421 ## `reorder_imports`
1422
1423 Reorder import statements alphabetically
1424
1425 - **Default value**: `false`
1426 - **Possible values**: `true`, `false`
1427
1428 #### `false` (default):
1429
1430 ```rust
1431 use lorem;
1432 use ipsum;
1433 use dolor;
1434 use sit;
1435 ```
1436
1437 #### `true`:
1438
1439 ```rust
1440 use dolor;
1441 use ipsum;
1442 use lorem;
1443 use sit;
1444 ```
1445
1446 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1447
1448 ## `reorder_imports_in_group`
1449
1450 Reorder import statements in group
1451
1452 - **Default value**: `false`
1453 - **Possible values**: `true`, `false`
1454
1455 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1456
1457 #### `false` (default):
1458
1459 ```rust
1460 use std::mem;
1461 use std::io;
1462
1463 use lorem;
1464 use ipsum;
1465 use dolor;
1466 use sit;
1467 ```
1468
1469 #### `true`:
1470
1471 ```rust
1472 use std::io;
1473 use std::mem;
1474
1475 use dolor;
1476 use ipsum;
1477 use lorem;
1478 use sit;
1479 ```
1480
1481 See also [`reorder_imports`](#reorder_imports).
1482
1483 ## `reorder_extern_crates`
1484
1485 Reorder `extern crate` statements alphabetically
1486
1487 - **Default value**: `true`
1488 - **Possible values**: `true`, `false`
1489
1490 #### `true` (default):
1491
1492 ```rust
1493 extern crate dolor;
1494 extern crate ipsum;
1495 extern crate lorem;
1496 extern crate sit;
1497 ```
1498
1499 #### `false`:
1500
1501 ```rust
1502 extern crate lorem;
1503 extern crate ipsum;
1504 extern crate dolor;
1505 extern crate sit;
1506 ```
1507
1508 See also [`reorder_extern_crates_in_group`](#reorder_extern_crates_in_group).
1509
1510 ## `reorder_extern_crates_in_group`
1511
1512 Reorder `extern crate` statements in group
1513
1514 - **Default value**: `true`
1515 - **Possible values**: `true`, `false`
1516
1517 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1518
1519 #### `true` (default):
1520
1521 ```rust
1522 extern crate a;
1523 extern crate b;
1524
1525 extern crate dolor;
1526 extern crate ipsum;
1527 extern crate lorem;
1528 extern crate sit;
1529 ```
1530
1531 #### `false`:
1532
1533 ```rust
1534 extern crate b;
1535 extern crate a;
1536
1537 extern crate lorem;
1538 extern crate ipsum;
1539 extern crate dolor;
1540 extern crate sit;
1541 ```
1542
1543 See also [`reorder_extern_crates`](#reorder_extern_crates).
1544
1545 ## `report_todo`
1546
1547 Report `TODO` items in comments.
1548
1549 - **Default value**: `"Never"`
1550 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1551
1552 Warns about any comments containing `TODO` in them when set to `"Always"`. If
1553 it contains a `#X` (with `X` being a number) in parentheses following the
1554 `TODO`, `"Unnumbered"` will ignore it.
1555
1556 See also [`report_fixme`](#report_fixme).
1557
1558 ## `report_fixme`
1559
1560 Report `FIXME` items in comments.
1561
1562 - **Default value**: `"Never"`
1563 - **Possible values**: `"Always"`, `"Unnumbered"`, `"Never"`
1564
1565 Warns about any comments containing `FIXME` in them when set to `"Always"`. If
1566 it contains a `#X` (with `X` being a number) in parentheses following the
1567 `FIXME`, `"Unnumbered"` will ignore it.
1568
1569 See also [`report_todo`](#report_todo).
1570
1571 ## `single_line_if_else_max_width`
1572
1573 Maximum line length for single line if-else expressions.
1574
1575 - **Default value**: `50`
1576 - **Possible values**: any positive integer
1577
1578 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1579
1580 #### Lines shorter than `single_line_if_else_max_width`:
1581 ```rust
1582 let lorem = if ipsum { dolor } else { sit };
1583 ```
1584
1585 #### Lines longer than `single_line_if_else_max_width`:
1586 ```rust
1587 let lorem = if ipsum {
1588     dolor
1589 } else {
1590     sit
1591 };
1592 ```
1593
1594 See also: [`control_brace_style`](#control_brace_style).
1595
1596 ## `skip_children`
1597
1598 Don't reformat out of line modules
1599
1600 - **Default value**: `false`
1601 - **Possible values**: `true`, `false`
1602
1603 ## `space_after_colon`
1604
1605 Leave a space after the colon.
1606
1607 - **Default value**: `true`
1608 - **Possible values**: `true`, `false`
1609
1610 #### `true` (default):
1611
1612 ```rust
1613 fn lorem<T: Eq>(t: T) {
1614     let lorem: Dolor = Lorem {
1615         ipsum: dolor,
1616         sit: amet,
1617     };
1618 }
1619 ```
1620
1621 #### `false`:
1622
1623 ```rust
1624 fn lorem<T:Eq>(t:T) {
1625     let lorem:Dolor = Lorem {
1626         ipsum:dolor,
1627         sit:amet,
1628     };
1629 }
1630 ```
1631
1632 See also: [`space_before_colon`](#space_before_colon).
1633
1634 ## `space_before_colon`
1635
1636 Leave a space before the colon.
1637
1638 - **Default value**: `false`
1639 - **Possible values**: `true`, `false`
1640
1641 #### `false` (default):
1642
1643 ```rust
1644 fn lorem<T: Eq>(t: T) {
1645     let lorem: Dolor = Lorem {
1646         ipsum: dolor,
1647         sit: amet,
1648     };
1649 }
1650 ```
1651
1652 #### `true`:
1653
1654 ```rust
1655 fn lorem<T : Eq>(t : T) {
1656     let lorem : Dolor = Lorem {
1657         ipsum : dolor,
1658         sit : amet,
1659     };
1660 }
1661 ```
1662
1663 See also: [`space_after_colon`](#space_after_colon).
1664
1665 ## `struct_field_align_threshold`
1666
1667 The maximum diff of width between struct fields to be aligned with each other.
1668
1669 - **Default value** : 0
1670 - **Possible values**: any positive integer
1671
1672 #### `0` (default):
1673
1674 ```rust
1675 struct Foo {
1676     x: u32,
1677     yy: u32,
1678     zzz: u32,
1679 }
1680 ```
1681
1682 #### `20`:
1683
1684 ```rust
1685 struct Foo {
1686     x:   u32,
1687     yy:  u32,
1688     zzz: u32,
1689 }
1690 ```
1691
1692 ```
1693
1694 ## `spaces_around_ranges`
1695
1696 Put spaces around the .. and ... range operators
1697
1698 - **Default value**: `false`
1699 - **Possible values**: `true`, `false`
1700
1701 #### `false` (default):
1702
1703 ```rust
1704 let lorem = 0..10;
1705 ```
1706
1707 #### `true`:
1708
1709 ```rust
1710 let lorem = 0 .. 10;
1711 ```
1712
1713 ## `spaces_within_parens_and_brackets`
1714
1715 Put spaces within non-empty generic arguments
1716
1717 - **Default value**: `false`
1718 - **Possible values**: `true`, `false`
1719
1720 #### `false` (default):
1721
1722 ```rust
1723 fn lorem<T: Eq>(t: T) {
1724     // body
1725 }
1726 ```
1727
1728 #### `true`:
1729
1730 ```rust
1731 fn lorem< T: Eq >(t: T) {
1732     // body
1733 }
1734 ```
1735
1736 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1737
1738 ## `spaces_within_parens_and_brackets`
1739
1740 Put spaces within non-empty parentheses
1741
1742 - **Default value**: `false`
1743 - **Possible values**: `true`, `false`
1744
1745 #### `false` (default):
1746
1747 ```rust
1748 fn lorem<T: Eq>(t: T) {
1749     let lorem = (ipsum, dolor);
1750 }
1751 ```
1752
1753 #### `true`:
1754
1755 ```rust
1756 fn lorem<T: Eq>( t: T ) {
1757     let lorem = ( ipsum, dolor );
1758 }
1759 ```
1760
1761 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1762
1763 ## `spaces_within_parens_and_brackets`
1764
1765 Put spaces within non-empty square brackets
1766
1767 - **Default value**: `false`
1768 - **Possible values**: `true`, `false`
1769
1770 #### `false` (default):
1771
1772 ```rust
1773 let lorem: [usize; 2] = [ipsum, dolor];
1774 ```
1775
1776 #### `true`:
1777
1778 ```rust
1779 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1780 ```
1781
1782 See also: [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets), [`spaces_within_parens_and_brackets`](#spaces_within_parens_and_brackets).
1783
1784 ## `struct_lit_multiline_style`
1785
1786 Multiline style on literal structs
1787
1788 - **Default value**: `"PreferSingle"`
1789 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1790
1791 #### `"PreferSingle"` (default):
1792
1793 ```rust
1794 let lorem = Lorem { ipsum: dolor, sit: amet };
1795 ```
1796
1797 #### `"ForceMulti"`:
1798
1799 ```rust
1800 let lorem = Lorem {
1801     ipsum: dolor,
1802     sit: amet,
1803 };
1804 ```
1805
1806 See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width).
1807
1808 ## `struct_lit_width`
1809
1810 Maximum width in the body of a struct lit before falling back to vertical formatting
1811
1812 - **Default value**: `18`
1813 - **Possible values**: any positive integer
1814
1815 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1816
1817 #### Lines shorter than `struct_lit_width`:
1818 ```rust
1819 let lorem = Lorem { ipsum: dolor, sit: amet };
1820 ```
1821
1822 #### Lines longer than `struct_lit_width`:
1823 See [`indent_style`](#indent_style).
1824
1825 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style).
1826
1827 ## `struct_variant_width`
1828
1829 Maximum width in the body of a struct variant before falling back to vertical formatting
1830
1831 - **Default value**: `35`
1832 - **Possible values**: any positive integer
1833
1834 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1835
1836 #### Struct variants shorter than `struct_variant_width`:
1837 ```rust
1838 enum Lorem {
1839     Ipsum,
1840     Dolor(bool),
1841     Sit { amet: Consectetur, adipiscing: Elit },
1842 }
1843 ```
1844
1845 #### Struct variants longer than `struct_variant_width`:
1846 ```rust
1847 enum Lorem {
1848     Ipsum,
1849     Dolor(bool),
1850     Sit {
1851         amet: Consectetur,
1852         adipiscing: Elit,
1853     },
1854 }
1855 ```
1856
1857 ## `tab_spaces`
1858
1859 Number of spaces per tab
1860
1861 - **Default value**: `4`
1862 - **Possible values**: any positive integer
1863
1864 #### `4` (default):
1865
1866 ```rust
1867 fn lorem() {
1868     let ipsum = dolor();
1869     let sit = vec![
1870         "amet consectetur adipiscing elit."
1871     ];
1872 }
1873 ```
1874
1875 #### `2`:
1876
1877 ```rust
1878 fn lorem() {
1879   let ipsum = dolor();
1880   let sit = vec![
1881     "amet consectetur adipiscing elit."
1882   ];
1883 }
1884 ```
1885
1886 See also: [`hard_tabs`](#hard_tabs).
1887
1888
1889 ## `trailing_comma`
1890
1891 How to handle trailing commas for lists
1892
1893 - **Default value**: `"Vertical"`
1894 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1895
1896 #### `"Vertical"` (default):
1897
1898 ```rust
1899 let Lorem { ipsum, dolor, sit } = amet;
1900 let Lorem {
1901     ipsum,
1902     dolor,
1903     sit,
1904     amet,
1905     consectetur,
1906     adipiscing,
1907 } = elit;
1908 ```
1909
1910 #### `"Always"`:
1911
1912 ```rust
1913 let Lorem { ipsum, dolor, sit, } = amet;
1914 let Lorem {
1915     ipsum,
1916     dolor,
1917     sit,
1918     amet,
1919     consectetur,
1920     adipiscing,
1921 } = elit;
1922 ```
1923
1924 #### `"Never"`:
1925
1926 ```rust
1927 let Lorem { ipsum, dolor, sit } = amet;
1928 let Lorem {
1929     ipsum,
1930     dolor,
1931     sit,
1932     amet,
1933     consectetur,
1934     adipiscing
1935 } = elit;
1936 ```
1937
1938 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1939
1940 ## `trailing_semicolon`
1941
1942 Add trailing semicolon after break, continue and return
1943
1944 - **Default value**: `true`
1945 - **Possible values**: `true`, `false`
1946
1947 #### `true` (default):
1948 ```rust
1949 fn foo() -> usize {
1950     return 0;
1951 }
1952 ```
1953
1954 #### `false`:
1955 ```rust
1956 fn foo() -> usize {
1957     return 0
1958 }
1959 ```
1960
1961 ## `type_punctuation_density`
1962
1963 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1964
1965 - **Default value**: `"Wide"`
1966 - **Possible values**: `"Compressed"`, `"Wide"`
1967
1968 #### `"Wide"` (default):
1969
1970 ```rust
1971 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1972         // body
1973 }
1974 ```
1975
1976 #### `"Compressed"`:
1977
1978 ```rust
1979 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1980         // body
1981 }
1982 ```
1983
1984 ## `use_try_shorthand`
1985
1986 Replace uses of the try! macro by the ? shorthand
1987
1988 - **Default value**: `false`
1989 - **Possible values**: `true`, `false`
1990
1991 #### `false` (default):
1992
1993 ```rust
1994 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
1995 ```
1996
1997 #### `true`:
1998
1999 ```rust
2000 let lorem = ipsum.map(|dolor| dolor.sit())?;
2001 ```
2002
2003 ## `where_density`
2004
2005 Density of a where clause.
2006
2007 - **Default value**: `"Vertical"`
2008 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
2009
2010 #### `"Vertical"` (default):
2011
2012 ```rust
2013 trait Lorem {
2014     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2015     where
2016         Dolor: Eq;
2017
2018     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2019     where
2020         Dolor: Eq,
2021     {
2022         // body
2023     }
2024 }
2025 ```
2026
2027 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2028
2029 #### `"CompressedIfEmpty"`:
2030
2031 ```rust
2032 trait Lorem {
2033     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2034     where Dolor: Eq;
2035
2036     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2037     where
2038         Dolor: Eq,
2039     {
2040         // body
2041     }
2042 }
2043 ```
2044
2045 #### `"Compressed"`:
2046
2047 ```rust
2048 trait Lorem {
2049     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2050     where Dolor: Eq;
2051
2052     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2053     where Dolor: Eq {
2054         // body
2055     }
2056 }
2057 ```
2058
2059 #### `"Tall"`:
2060
2061 ```rust
2062 trait Lorem {
2063     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2064     where
2065         Dolor: Eq;
2066
2067     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2068     where
2069         Dolor: Eq,
2070     {
2071         // body
2072     }
2073 }
2074 ```
2075
2076 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2077
2078 See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style).
2079
2080 ## `where_layout`
2081
2082 Element layout inside a where clause
2083
2084 - **Default value**: `"Vertical"`
2085 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2086
2087 #### `"Vertical"` (default):
2088
2089 ```rust
2090 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2091     where Ipsum: IpsumDolorSitAmet,
2092           Dolor: DolorSitAmetConsectetur
2093 {
2094     // body
2095 }
2096
2097 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2098     where Ipsum: IpsumDolorSitAmet,
2099           Dolor: DolorSitAmetConsectetur,
2100           Sit: SitAmetConsecteturAdipiscing,
2101           Amet: AmetConsecteturAdipiscingElit
2102 {
2103     // body
2104 }
2105 ```
2106
2107 #### `"Horizontal"`:
2108
2109 ```rust
2110 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2111     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2112 {
2113     // body
2114 }
2115
2116 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2117     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2118 {
2119     // body
2120 }
2121 ```
2122
2123 #### `"HorizontalVertical"`:
2124
2125 ```rust
2126 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2127     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2128 {
2129     // body
2130 }
2131
2132 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2133     where Ipsum: IpsumDolorSitAmet,
2134           Dolor: DolorSitAmetConsectetur,
2135           Sit: SitAmetConsecteturAdipiscing,
2136           Amet: AmetConsecteturAdipiscingElit
2137 {
2138     // body
2139 }
2140 ```
2141
2142 #### `"Mixed"`:
2143
2144 ```rust
2145 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2146     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2147 {
2148     // body
2149 }
2150
2151 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2152     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2153           Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2154 {
2155     // body
2156 }
2157 ```
2158
2159 See also: [`where_density`](#where_density), [`indent_style`](#indent_style).
2160
2161 ## `wrap_comments`
2162
2163 Break comments to fit on the line
2164
2165 - **Default value**: `false`
2166 - **Possible values**: `true`, `false`
2167
2168 #### `false` (default):
2169
2170 ```rust
2171 // 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.
2172 ```
2173
2174 #### `true`:
2175
2176 ```rust
2177 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2178 // sed do eiusmod tempor incididunt ut labore et dolore
2179 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2180 // exercitation ullamco laboris nisi ut aliquip ex ea
2181 // commodo consequat.
2182 ```
2183
2184 ## `wrap_match_arms`
2185
2186 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2187
2188 - **Default value**: `true`
2189 - **Possible values**: `true`, `false`
2190
2191 #### `true` (default):
2192
2193 ```rust
2194 match lorem {
2195     true => {
2196         foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2197     }
2198     false => println!("{}", sit),
2199 }
2200 ```
2201
2202 #### `false`:
2203
2204 ```rust
2205 match lorem {
2206     true =>
2207         foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2208     false => println!("{}", sit),
2209 }
2210 ```
2211
2212 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2213
2214 ## `write_mode`
2215
2216 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2217
2218 - **Default value**: `"Overwrite"`
2219 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`