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