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