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