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