]> git.lizzy.rs Git - rust.git/blob - Configurations.md
Merge pull request #1900 from spinda/attributes-on-same-line
[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 ## `newline_style`
1269
1270 Unix or Windows line endings
1271
1272 - **Default value**: `"Unix"`
1273 - **Possible values**: `"Native"`, `"Unix"`, `"Windows"`
1274
1275 ## `normalize_comments`
1276
1277 Convert /* */ comments to // comments where possible
1278
1279 - **Default value**: `false`
1280 - **Possible values**: `true`, `false`
1281
1282 #### `false`:
1283
1284 ```rust
1285 // Lorem ipsum:
1286 fn dolor() -> usize {}
1287
1288 /* sit amet: */
1289 fn adipiscing() -> usize {}
1290 ```
1291
1292 #### `true`:
1293
1294 ```rust
1295 // Lorem ipsum:
1296 fn dolor() -> usize {}
1297
1298 // sit amet:
1299 fn adipiscing() -> usize {}
1300 ```
1301
1302 ## `reorder_imported_names`
1303
1304 Reorder lists of names in import statements alphabetically
1305
1306 - **Default value**: `false`
1307 - **Possible values**: `true`, `false`
1308
1309 #### `false`:
1310
1311 ```rust
1312 use super::{lorem, ipsum, dolor, sit};
1313 ```
1314
1315 #### `true`:
1316
1317 ```rust
1318 use super::{dolor, ipsum, lorem, sit};
1319 ```
1320
1321 See also [`reorder_imports`](#reorder_imports).
1322
1323 ## `reorder_imports`
1324
1325 Reorder import statements alphabetically
1326
1327 - **Default value**: `false`
1328 - **Possible values**: `true`, `false`
1329
1330 #### `false`:
1331
1332 ```rust
1333 use lorem;
1334 use ipsum;
1335 use dolor;
1336 use sit;
1337 ```
1338
1339 #### `true`:
1340
1341 ```rust
1342 use dolor;
1343 use ipsum;
1344 use lorem;
1345 use sit;
1346 ```
1347
1348 See also [`reorder_imported_names`](#reorder_imported_names), [`reorder_imports_in_group`](#reorder_imports_in_group).
1349
1350 ## `reorder_imports_in_group`
1351
1352 Reorder import statements in group
1353
1354 - **Default value**: `false`
1355 - **Possible values**: `true`, `false`
1356
1357 **Note:** This option takes effect only when [`reorder_imports`](#reorder_imports) is set to `true`.
1358
1359 #### `false`:
1360
1361 ```rust
1362 use std::mem;
1363 use std::io;
1364
1365 use lorem;
1366 use ipsum;
1367 use dolor;
1368 use sit;
1369 ```
1370
1371 #### `true`:
1372
1373 ```rust
1374 use std::io;
1375 use std::mem;
1376
1377 use dolor;
1378 use ipsum;
1379 use lorem;
1380 use sit;
1381 ```
1382
1383 See also [`reorder_imports`](#reorder_imports).
1384
1385 ## `single_line_if_else_max_width`
1386
1387 Maximum line length for single line if-else expressions.
1388
1389 - **Default value**: `50`
1390 - **Possible values**: any positive integer
1391
1392 **Note:** A value of `0` results in if-else expressions being broken regardless of their line's width.
1393
1394 #### Lines shorter than `single_line_if_else_max_width`:
1395 ```rust
1396 let lorem = if ipsum { dolor } else { sit };
1397 ```
1398
1399 #### Lines longer than `single_line_if_else_max_width`:
1400 ```rust
1401 let lorem = if ipsum {
1402     dolor
1403 } else {
1404     sit
1405 };
1406 ```
1407
1408 See also: [`control_brace_style`](#control_brace_style).
1409
1410 ## `skip_children`
1411
1412 Don't reformat out of line modules
1413
1414 - **Default value**: `false`
1415 - **Possible values**: `true`, `false`
1416
1417 ## `space_after_bound_colon`
1418
1419 Leave a space after the colon in a trait or lifetime bound
1420
1421 - **Default value**: `true`
1422 - **Possible values**: `true`, `false`
1423
1424 #### `false`:
1425
1426 ```rust
1427 fn lorem<T:Eq>(t: T) {
1428     // body
1429 }
1430 ```
1431
1432 #### `true`:
1433
1434 ```rust
1435 fn lorem<T: Eq>(t: T) {
1436     // body
1437 }
1438 ```
1439
1440 See also: [`space_before_bound`](#space_before_bound).
1441
1442 ## `struct_field_align_threshold`
1443
1444 The maximum diff of width between struct fields to be aligned with each other.
1445
1446 - **Default value** : 0
1447 - **Possible values**: any positive integer
1448
1449 #### `0`:
1450
1451 ```rust
1452 struct Foo {
1453     x: u32,
1454     yy: u32,
1455     zzz: u32,
1456 }
1457 ```
1458
1459 #### `20`:
1460
1461 ```rust
1462 struct Foo {
1463     x:   u32,
1464     yy:  u32,
1465     zzz: u32,
1466 }
1467 ```
1468
1469 ## `space_after_struct_lit_field_colon`
1470
1471 Leave a space after the colon in a struct literal field
1472
1473 - **Default value**: `true`
1474 - **Possible values**: `true`, `false`
1475
1476 #### `false`:
1477
1478 ```rust
1479 let lorem = Lorem {
1480     ipsum:dolor,
1481     sit:amet,
1482 };
1483 ```
1484
1485 #### `true`:
1486
1487 ```rust
1488 let lorem = Lorem {
1489     ipsum: dolor,
1490     sit: amet,
1491 };
1492 ```
1493
1494 See also: [`space_before_struct_lit_field_colon`](#space_before_struct_lit_field_colon).
1495
1496 ## `space_after_type_annotation_colon`
1497
1498 Leave a space after the colon in a type annotation
1499
1500 - **Default value**: `true`
1501 - **Possible values**: `true`, `false`
1502
1503 #### `false`:
1504
1505 ```rust
1506 fn lorem<T: Eq>(t:T) {
1507     let ipsum:Dolor = sit;
1508 }
1509 ```
1510
1511 #### `true`:
1512
1513 ```rust
1514 fn lorem<T: Eq>(t: T) {
1515     let ipsum: Dolor = sit;
1516 }
1517 ```
1518
1519 See also: [`space_before_type_annotation`](#space_before_type_annotation).
1520
1521 ## `space_before_bound`
1522
1523 Leave a space before the colon in a trait or lifetime bound
1524
1525 - **Default value**: `false`
1526 - **Possible values**: `true`, `false`
1527
1528 #### `false`:
1529
1530 ```rust
1531 fn lorem<T: Eq>(t: T) {
1532     let ipsum: Dolor = sit;
1533 }
1534 ```
1535
1536 #### `true`:
1537
1538 ```rust
1539 fn lorem<T : Eq>(t: T) {
1540     let ipsum: Dolor = sit;
1541 }
1542 ```
1543
1544 See also: [`space_after_bound_colon`](#space_after_bound_colon).
1545
1546 ## `space_before_struct_lit_field_colon`
1547
1548 Leave a space before the colon in a struct literal field
1549
1550 - **Default value**: `false`
1551 - **Possible values**: `true`, `false`
1552
1553 #### `false`:
1554
1555 ```rust
1556 let lorem = Lorem {
1557     ipsum: dolor,
1558     sit: amet,
1559 };
1560 ```
1561
1562 #### `true`:
1563
1564 ```rust
1565 let lorem = Lorem {
1566     ipsum : dolor,
1567     sit : amet,
1568 };
1569 ```
1570
1571 See also: [`space_after_struct_lit_field_colon`](#space_after_struct_lit_field_colon).
1572
1573 ## `space_before_type_annotation`
1574
1575 Leave a space before the colon in a type annotation
1576
1577 - **Default value**: `false`
1578 - **Possible values**: `true`, `false`
1579
1580 #### `false`:
1581
1582 ```rust
1583 fn lorem<T: Eq>(t: T) {
1584     let ipsum: Dolor = sit;
1585 }
1586 ```
1587
1588 #### `true`:
1589
1590 ```rust
1591 fn lorem<T: Eq>(t : T) {
1592     let ipsum : Dolor = sit;
1593 }
1594 ```
1595
1596 See also: [`space_after_type_annotation_colon`](#space_after_type_annotation_colon).
1597
1598 ## `spaces_around_ranges`
1599
1600 Put spaces around the .. and ... range operators
1601
1602 - **Default value**: `false`
1603 - **Possible values**: `true`, `false`
1604
1605 #### `false`:
1606
1607 ```rust
1608 let lorem = 0..10;
1609 ```
1610
1611 #### `true`:
1612
1613 ```rust
1614 let lorem = 0 .. 10;
1615 ```
1616
1617 ## `spaces_within_angle_brackets`
1618
1619 Put spaces within non-empty generic arguments
1620
1621 - **Default value**: `false`
1622 - **Possible values**: `true`, `false`
1623
1624 #### `false`:
1625
1626 ```rust
1627 fn lorem<T: Eq>(t: T) {
1628     // body
1629 }
1630 ```
1631
1632 #### `true`:
1633
1634 ```rust
1635 fn lorem< T: Eq >(t: T) {
1636     // body
1637 }
1638 ```
1639
1640 See also: [`spaces_within_parens`](#spaces_within_parens), [`spaces_within_square_brackets`](#spaces_within_square_brackets).
1641
1642 ## `spaces_within_parens`
1643
1644 Put spaces within non-empty parentheses
1645
1646 - **Default value**: `false`
1647 - **Possible values**: `true`, `false`
1648
1649 #### `false`:
1650
1651 ```rust
1652 fn lorem<T: Eq>(t: T) {
1653     let lorem = (ipsum, dolor);
1654 }
1655 ```
1656
1657 #### `true`:
1658
1659 ```rust
1660 fn lorem<T: Eq>( t: T ) {
1661     let lorem = ( ipsum, dolor );
1662 }
1663 ```
1664
1665 See also: [`spaces_within_angle_brackets`](#spaces_within_angle_brackets), [`spaces_within_square_brackets`](#spaces_within_square_brackets).
1666
1667 ## `spaces_within_square_brackets`
1668
1669 Put spaces within non-empty square brackets
1670
1671 - **Default value**: `false`
1672 - **Possible values**: `true`, `false`
1673
1674 #### `false`:
1675
1676 ```rust
1677 let lorem: [usize; 2] = [ipsum, dolor];
1678 ```
1679
1680 #### `true`:
1681
1682 ```rust
1683 let lorem: [ usize; 2 ] = [ ipsum, dolor ];
1684 ```
1685
1686 See also: [`spaces_within_parens`](#spaces_within_parens), [`spaces_within_angle_brackets`](#spaces_within_angle_brackets).
1687
1688 ## `struct_lit_multiline_style`
1689
1690 Multiline style on literal structs
1691
1692 - **Default value**: `"PreferSingle"`
1693 - **Possible values**: `"ForceMulti"`, `"PreferSingle"`
1694
1695 #### `"ForceMulti"`:
1696
1697 ```rust
1698 let lorem = Lorem {
1699     ipsum: dolor,
1700     sit: amet,
1701 };
1702 ```
1703
1704 #### `"PreferSingle"`:
1705
1706 ```rust
1707 let lorem = Lorem { ipsum: dolor, sit: amet };
1708 ```
1709
1710 See also: [`struct_lit_style`](#struct_lit_style), [`struct_lit_width`](#struct_lit_width).
1711
1712 ## `struct_lit_style`
1713
1714 Style of struct definition
1715
1716 - **Default value**: `"Block"`
1717 - **Possible values**: `"Block"`, `"Visual"`
1718
1719 #### `"Block"`:
1720
1721 ```rust
1722 let lorem = Lorem {
1723     ipsum: dolor,
1724     sit: amet,
1725 };
1726 ```
1727
1728 #### `"Visual"`:
1729
1730 ```rust
1731 let lorem = Lorem { ipsum: dolor,
1732                     sit: amet, };
1733 ```
1734
1735 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1736
1737 ## `struct_lit_width`
1738
1739 Maximum width in the body of a struct lit before falling back to vertical formatting
1740
1741 - **Default value**: `18`
1742 - **Possible values**: any positive integer
1743
1744 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1745
1746 #### Lines shorter than `struct_lit_width`:
1747 ```rust
1748 let lorem = Lorem { ipsum: dolor, sit: amet };
1749 ```
1750
1751 #### Lines longer than `struct_lit_width`:
1752 See [`struct_lit_style`](#struct_lit_style).
1753
1754 See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1755
1756 ## `struct_variant_width`
1757
1758 Maximum width in the body of a struct variant before falling back to vertical formatting
1759
1760 - **Default value**: `35`
1761 - **Possible values**: any positive integer
1762
1763 **Note:** A value of `0` results in vertical formatting being applied regardless of a line's width.
1764
1765 #### Struct variants shorter than `struct_variant_width`:
1766 ```rust
1767 enum Lorem {
1768     Ipsum,
1769     Dolor(bool),
1770     Sit { amet: Consectetur, adipiscing: Elit },
1771 }
1772 ```
1773
1774 #### Struct variants longer than `struct_variant_width`:
1775 ```rust
1776 enum Lorem {
1777     Ipsum,
1778     Dolor(bool),
1779     Sit {
1780         amet: Consectetur,
1781         adipiscing: Elit,
1782     },
1783 }
1784 ```
1785
1786 ## `tab_spaces`
1787
1788 Number of spaces per tab
1789
1790 - **Default value**: `4`
1791 - **Possible values**: any positive integer
1792
1793 #### `2`:
1794
1795 ```rust
1796 fn lorem() {
1797   let ipsum = dolor();
1798   let sit = vec![
1799     "amet consectetur adipiscing elit."
1800   ];
1801 }
1802 ```
1803
1804 #### `4`:
1805
1806 ```rust
1807 fn lorem() {
1808     let ipsum = dolor();
1809     let sit = vec![
1810         "amet consectetur adipiscing elit."
1811     ];
1812 }
1813 ```
1814
1815 See also: [`hard_tabs`](#hard_tabs).
1816
1817 ## `take_source_hints`
1818
1819 Retain some formatting characteristics from the source code
1820
1821 - **Default value**: `false`
1822 - **Possible values**: `true`, `false`
1823
1824 #### `false`:
1825
1826 ```rust
1827 lorem
1828     .ipsum()
1829     .dolor(|| { sit.amet().consectetur().adipiscing().elit(); });
1830 ```
1831
1832 #### `true`:
1833
1834 ```rust
1835 lorem
1836     .ipsum()
1837     .dolor(|| {
1838                sit.amet()
1839                    .consectetur()
1840                    .adipiscing()
1841                    .elit();
1842            });
1843 ```
1844
1845 Note: This only applies if the call chain within the inner closure had already been formatted on separate lines before running rustfmt.
1846
1847 ## `trailing_comma`
1848
1849 How to handle trailing commas for lists
1850
1851 - **Default value**: `"Vertical"`
1852 - **Possible values**: `"Always"`, `"Never"`, `"Vertical"`
1853
1854 #### `"Always"`:
1855
1856 ```rust
1857 let Lorem { ipsum, dolor, sit, } = amet;
1858 let Lorem {
1859     ipsum,
1860     dolor,
1861     sit,
1862     amet,
1863     consectetur,
1864     adipiscing,
1865 } = elit;
1866 ```
1867
1868 #### `"Never"`:
1869
1870 ```rust
1871 let Lorem { ipsum, dolor, sit } = amet;
1872 let Lorem {
1873     ipsum,
1874     dolor,
1875     sit,
1876     amet,
1877     consectetur,
1878     adipiscing
1879 } = elit;
1880 ```
1881
1882 #### `"Vertical"`:
1883
1884 ```rust
1885 let Lorem { ipsum, dolor, sit } = amet;
1886 let Lorem {
1887     ipsum,
1888     dolor,
1889     sit,
1890     amet,
1891     consectetur,
1892     adipiscing,
1893 } = elit;
1894 ```
1895
1896 See also: [`match_block_trailing_comma`](#match_block_trailing_comma).
1897
1898 ## `trailing_semicolon`
1899
1900 Add trailing semicolon after break, continue and return
1901
1902 - **Default value**: `true`
1903 - **Possible values**: `true`, `false`
1904
1905 #### `true`:
1906 ```rust
1907 fn foo() -> usize {
1908     return 0;
1909 }
1910 ```
1911
1912 #### `false`:
1913 ```rust
1914 fn foo() -> usize {
1915     return 0
1916 }
1917 ```
1918
1919 ## `type_punctuation_density`
1920
1921 Determines if `+` or `=` are wrapped in spaces in the punctuation of types
1922
1923 - **Default value**: `"Wide"`
1924 - **Possible values**: `"Compressed"`, `"Wide"`
1925
1926 #### `"Compressed"`:
1927
1928 ```rust
1929 fn lorem<Ipsum: Dolor+Sit=Amet>() {
1930         // body
1931 }
1932 ```
1933
1934 #### `"Wide"`:
1935
1936 ```rust
1937 fn lorem<Ipsum: Dolor + Sit = Amet>() {
1938         // body
1939 }
1940 ```
1941
1942 ## `use_try_shorthand`
1943
1944 Replace uses of the try! macro by the ? shorthand
1945
1946 - **Default value**: `false`
1947 - **Possible values**: `true`, `false`
1948
1949 #### `false`:
1950
1951 ```rust
1952 let lorem = try!(ipsum.map(|dolor|dolor.sit()));
1953 ```
1954
1955 #### `true`:
1956
1957 ```rust
1958 let lorem = ipsum.map(|dolor| dolor.sit())?;
1959 ```
1960
1961 ## `where_density`
1962
1963 Density of a where clause. 
1964
1965 - **Default value**: `"CompressedIfEmpty"`
1966 - **Possible values**: `"Compressed"`, `"CompressedIfEmpty"`, `"Tall"`, `"Vertical"`
1967
1968 #### `"Compressed"`:
1969
1970 ```rust
1971 trait Lorem {
1972     fn ipsum<Dolor>(dolor: Dolor) -> Sit
1973     where Dolor: Eq;
1974
1975     fn ipsum<Dolor>(dolor: Dolor) -> Sit
1976     where Dolor: Eq {
1977         // body
1978     }
1979 }
1980 ```
1981
1982 #### `"CompressedIfEmpty"`:
1983
1984 ```rust
1985 trait Lorem {
1986     fn ipsum<Dolor>(dolor: Dolor) -> Sit
1987     where Dolor: Eq;
1988
1989     fn ipsum<Dolor>(dolor: Dolor) -> Sit
1990     where
1991         Dolor: Eq,
1992     {
1993         // body
1994     }
1995 }
1996 ```
1997
1998 #### `"Tall"`:
1999
2000 ```rust
2001 trait Lorem {
2002     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2003     where
2004         Dolor: Eq;
2005
2006     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2007     where
2008         Dolor: Eq,
2009     {
2010         // body
2011     }
2012 }
2013 ```
2014
2015 **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`.
2016
2017 #### `"Vertical"`:
2018
2019 ```rust
2020 trait Lorem {
2021     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2022         where Dolor: Eq;
2023
2024     fn ipsum<Dolor>(dolor: Dolor) -> Sit
2025         where Dolor: Eq
2026     {
2027         // body
2028     }
2029 }
2030 ```
2031
2032 **Note:** `where_density = "Vertical"` currently produces the same output as `where_density = "Tall"`.
2033
2034 See also: [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
2035
2036 ## `where_layout`
2037
2038 Element layout inside a where clause
2039
2040 - **Default value**: `"Vertical"`
2041 - **Possible values**: `"Horizontal"`, `"HorizontalVertical"`, `"Mixed"`, `"Vertical"`
2042
2043 #### `"Horizontal"`:
2044
2045 ```rust
2046 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2047     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2048 {
2049     // body
2050 }
2051
2052 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2053     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2054 {
2055     // body
2056 }
2057 ```
2058
2059 #### `"HorizontalVertical"`:
2060
2061 ```rust
2062 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2063     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2064 {
2065     // body
2066 }
2067
2068 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2069     where Ipsum: IpsumDolorSitAmet,
2070           Dolor: DolorSitAmetConsectetur,
2071           Sit: SitAmetConsecteturAdipiscing,
2072           Amet: AmetConsecteturAdipiscingElit
2073 {
2074     // body
2075 }
2076 ```
2077
2078 #### `"Mixed"`:
2079
2080 ```rust
2081 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2082     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur
2083 {
2084     // body
2085 }
2086
2087 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2088     where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur,
2089           Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit
2090 {
2091     // body
2092 }
2093 ```
2094
2095 #### `"Vertical"`:
2096
2097 ```rust
2098 fn lorem<Ipsum, Dolor>(ipsum: Ipsum, dolor: Dolor)
2099     where Ipsum: IpsumDolorSitAmet,
2100           Dolor: DolorSitAmetConsectetur
2101 {
2102     // body
2103 }
2104
2105 fn lorem<Ipsum, Dolor, Sit, Amet>(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet)
2106     where Ipsum: IpsumDolorSitAmet,
2107           Dolor: DolorSitAmetConsectetur,
2108           Sit: SitAmetConsecteturAdipiscing,
2109           Amet: AmetConsecteturAdipiscingElit
2110 {
2111     // body
2112 }
2113 ```
2114
2115 **Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
2116
2117 See also: [`where_density`](#where_density), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style).
2118
2119 ## `where_pred_indent`
2120
2121 Indentation style of a where predicate
2122
2123 - **Default value**: `"Visual"`
2124 - **Possible values**: `"Block"`, `"Visual"`
2125
2126 #### `"Block"`:
2127
2128 ```rust
2129 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2130     where Ipsum: Eq,
2131         Dolor: Eq,
2132         Sit: Eq,
2133         Amet: Eq
2134 {
2135     // body
2136 }
2137 ```
2138
2139 #### `"Visual"`:
2140
2141 ```rust
2142 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2143     where Ipsum: Eq,
2144           Dolor: Eq,
2145           Sit: Eq,
2146           Amet: Eq
2147 {
2148     // body
2149 }
2150 ```
2151
2152 **Note**: This option only takes effect when `where_style` is set to `"Legacy"`.
2153
2154 See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_style`](#where_style).
2155
2156 ## `where_style`
2157
2158 Overall strategy for where clauses
2159
2160 - **Default value**: `"Rfc"`
2161 - **Possible values**: `"Rfc"`, `"Legacy"`
2162
2163 #### `"Rfc"`:
2164
2165 ```rust
2166 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2167 where
2168     Ipsum: Eq,
2169     Dolor: Eq,
2170     Sit: Eq,
2171     Amet: Eq,
2172 {
2173     // body
2174 }
2175 ```
2176
2177 #### `"Legacy"`:
2178
2179 ```rust
2180 fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
2181     where Ipsum: Eq,
2182           Dolor: Eq,
2183           Sit: Eq,
2184           Amet: Eq
2185 {
2186     // body
2187 }
2188 ```
2189
2190 See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent).
2191
2192 ## `wrap_comments`
2193
2194 Break comments to fit on the line
2195
2196 - **Default value**: `false`
2197 - **Possible values**: `true`, `false`
2198
2199 #### `false`:
2200
2201 ```rust
2202 // 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.
2203 ```
2204
2205 #### `true`:
2206
2207 ```rust
2208 // Lorem ipsum dolor sit amet, consectetur adipiscing elit,
2209 // sed do eiusmod tempor incididunt ut labore et dolore
2210 // magna aliqua. Ut enim ad minim veniam, quis nostrud
2211 // exercitation ullamco laboris nisi ut aliquip ex ea
2212 // commodo consequat.
2213 ```
2214
2215 ## `wrap_match_arms`
2216
2217 Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
2218
2219 - **Default value**: `true`
2220 - **Possible values**: `true`, `false`
2221
2222 #### `false`:
2223
2224 ```rust
2225 match lorem {
2226     true =>
2227         foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
2228     false => println!("{}", sit),
2229 }
2230 ```
2231
2232 #### `true`:
2233
2234 ```rust
2235 match lorem {
2236     true => {
2237         foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
2238     }
2239     false => println!("{}", sit),
2240 }
2241 ```
2242
2243 See also: [`indent_match_arms`](#indent_match_arms), [`match_block_trailing_comma`](#match_block_trailing_comma).
2244
2245 ## `write_mode`
2246
2247 What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage
2248
2249 - **Default value**: `"Overwrite"`
2250 - **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"`