X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=Configurations.md;h=6c4e7dc77604d8802dfdde3263278d0dc70bafb8;hb=a92a1cb51283bc6861bb1bb33b2b34c36b5d16bd;hp=09d9f57d6b2082071145b3d5279bc6a64cc23f0f;hpb=55dd8f1df08daadb14936aa51bca9f9e96aac8be;p=rust.git diff --git a/Configurations.md b/Configurations.md index 09d9f57d6b2..6c4e7dc7760 100644 --- a/Configurations.md +++ b/Configurations.md @@ -64,7 +64,12 @@ fn main() { ```rust fn main() { - if lorem_ipsum && dolor_sit && amet_consectetur && lorem_sit && dolor_consectetur && amet_ipsum + if lorem_ipsum + && dolor_sit + && amet_consectetur + && lorem_sit + && dolor_consectetur + && amet_ipsum && lorem_consectetur { // ... @@ -76,7 +81,12 @@ fn main() { ```rust fn main() { - if lorem_ipsum && dolor_sit && amet_consectetur && lorem_sit && dolor_consectetur && amet_ipsum + if lorem_ipsum + && dolor_sit + && amet_consectetur + && lorem_sit + && dolor_consectetur + && amet_ipsum && lorem_consectetur { // ... @@ -342,7 +352,8 @@ fn main() { let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar; - let sum = 123456789012345678901234567890 + 123456789012345678901234567890 + let sum = 123456789012345678901234567890 + + 123456789012345678901234567890 + 123456789012345678901234567890; let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa @@ -357,7 +368,8 @@ fn main() { let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar; - let sum = 123456789012345678901234567890 + 123456789012345678901234567890 + + let sum = 123456789012345678901234567890 + + 123456789012345678901234567890 + 123456789012345678901234567890; let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.. @@ -1042,8 +1054,10 @@ Item layout inside a imports block ```rust use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz}; -use foo::{aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd, - eeeeeeeeeeeeeeeeee, ffffffffffffffffff}; +use foo::{ + aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd, + eeeeeeeeeeeeeeeeee, ffffffffffffffffff, +}; ``` #### `"Horizontal"`: @@ -1061,27 +1075,33 @@ use foo::{aaa, bbb, ccc, ddd, eee, fff}; ```rust use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz}; -use foo::{aaaaaaaaaaaaaaaaaa, - bbbbbbbbbbbbbbbbbb, - cccccccccccccccccc, - dddddddddddddddddd, - eeeeeeeeeeeeeeeeee, - ffffffffffffffffff}; +use foo::{ + aaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbb, + cccccccccccccccccc, + dddddddddddddddddd, + eeeeeeeeeeeeeeeeee, + ffffffffffffffffff, +}; ``` #### `"Vertical"`: ```rust -use foo::{xxx, - yyy, - zzz}; +use foo::{ + xxx, + yyy, + zzz, +}; -use foo::{aaa, - bbb, - ccc, - ddd, - eee, - fff}; +use foo::{ + aaa, + bbb, + ccc, + ddd, + eee, + fff, +}; ``` ## `merge_imports` @@ -1240,7 +1260,7 @@ Convert /* */ comments to // comments where possible - **Default value**: `false` - **Possible values**: `true`, `false` -- **Stable**: Yes +- **Stable**: No #### `false` (default): @@ -1262,6 +1282,29 @@ fn dolor() -> usize {} fn adipiscing() -> usize {} ``` +## `remove_nested_parens` + +Remove nested parens. + +- **Default value**: `true`, +- **Possible values**: `true`, `false` +- **Stable**: Yes + + +#### `true` (default): +```rust +fn main() { + (foo()); +} +``` + +#### `false`: +```rust +fn main() { + ((((foo())))); +} +``` + ## `reorder_imports` @@ -1270,23 +1313,23 @@ separated by a newline). - **Default value**: `true` - **Possible values**: `true`, `false` -- **Stable**: No +- **Stable**: Yes -#### `false` (default): +#### `true` (default): ```rust -use lorem; -use ipsum; use dolor; +use ipsum; +use lorem; use sit; ``` -#### `true`: +#### `false`: ```rust -use dolor; -use ipsum; use lorem; +use ipsum; +use dolor; use sit; ``` @@ -1297,7 +1340,7 @@ Reorder `mod` declarations alphabetically in group. - **Default value**: `true` - **Possible values**: `true`, `false` -- **Stable**: No +- **Stable**: Yes #### `true` (default) @@ -1547,52 +1590,6 @@ fn main() { } ``` -## `spaces_within_parens_and_brackets` - -Put spaces within non-empty generic arguments, parentheses, and square brackets - -- **Default value**: `false` -- **Possible values**: `true`, `false` -- **Stable**: No - -#### `false` (default): - -```rust -// generic arguments -fn lorem(t: T) { - // body -} - -// non-empty parentheses -fn lorem(t: T) { - let lorem = (ipsum, dolor); -} - -// non-empty square brackets -fn lorem(t: T) { - let lorem: [usize; 2] = [ipsum, dolor]; -} -``` - -#### `true`: - -```rust -// generic arguments -fn lorem< T: Eq >( t: T ) { - // body -} - -// non-empty parentheses -fn lorem< T: Eq >( t: T ) { - let lorem = ( ipsum, dolor ); -} - -// non-empty square brackets -fn lorem< T: Eq >( t: T ) { - let lorem: [ usize; 2 ] = [ ipsum, dolor ]; -} -``` - ## `struct_lit_single_line` Put small struct literals on a single line @@ -1768,7 +1765,7 @@ Use field initialize shorthand if possible. - **Default value**: `false` - **Possible values**: `true`, `false` -- **Stable**: No +- **Stable**: Yes #### `false` (default): @@ -1810,7 +1807,7 @@ Replace uses of the try! macro by the ? shorthand - **Default value**: `false` - **Possible values**: `true`, `false` -- **Stable**: No +- **Stable**: Yes #### `false` (default): @@ -1835,7 +1832,7 @@ Break comments to fit on the line - **Default value**: `false` - **Possible values**: `true`, `false` -- **Stable**: Yes +- **Stable**: No #### `false` (default): @@ -1888,13 +1885,6 @@ fn main() { See also: [`match_block_trailing_comma`](#match_block_trailing_comma). -## `write_mode` - -What Write Mode to use when none is supplied: Replace, Overwrite, Display, Diff, Coverage - -- **Default value**: `"Overwrite"` -- **Possible values**: `"Checkstyle"`, `"Coverage"`, `"Diff"`, `"Display"`, `"Overwrite"`, `"Plain"`, `"Replace"` -- **Stable**: No ## `blank_lines_upper_bound` @@ -1909,7 +1899,7 @@ lines are found, they are trimmed down to match this integer. Original Code: ```rust -#![rustfmt_skip] +#![rustfmt::skip] fn foo() { println!("a"); @@ -1968,7 +1958,7 @@ them, additional blank lines are inserted. Original Code (rustfmt will not change it with the default value of `0`): ```rust -#![rustfmt_skip] +#![rustfmt::skip] fn foo() { println!("a"); @@ -1994,49 +1984,10 @@ fn bar() { } ``` -## `remove_blank_lines_at_start_or_end_of_block` - -Remove blank lines at the start or the end of a block. - -- **Default value**: `true` -- **Possible values**: `true`, `false` -- **Stable**: No - -#### `true` - -```rust -fn foo() { - let msg = { - let mut str = String::new(); - str.push_str("hello, "); - str.push_str("world!"); - str - }; - println!("{}", msg); -} -``` - -#### `false` - -```rust -fn foo() { - - let msg = { - - let mut str = String::new(); - str.push_str("hello, "); - str.push_str("world!"); - str - - }; - println!("{}", msg); - -} -``` ## `required_version` -Require a specific version of rustfmt. If you want to make sure that the +Require a specific version of rustfmt. If you want to make sure that the specific version of rustfmt is used in your CI, use this option. - **Default value**: `CARGO_PKG_VERSION` @@ -2065,7 +2016,7 @@ Enable unstable features on stable channel. - **Default value**: `false` - **Possible values**: `true`, `false` -- **Stable**: Yes +- **Stable**: No ## `license_template_path` @@ -2113,3 +2064,11 @@ ignore [ "examples", ] ``` + +## `emit_mode` + +Internal option + +## `make_backup` + +Internal option, use `--backup`