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