Update wrap_match_arms option tests and visual guide

This commit is contained in:
topecongiro 2017-07-11 21:53:57 +09:00
parent be55f856bb
commit c11aac04a3
7 changed files with 14 additions and 31 deletions

View File

@ -1986,7 +1986,7 @@ Break comments to fit on the line
## `wrap_match_arms`
Wrap multiline match arms in blocks
Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms
- **Default value**: `true`
- **Possible values**: `true`, `false`
@ -1995,13 +1995,9 @@ Wrap multiline match arms in blocks
```rust
match lorem {
true => {
let ipsum = dolor;
println!("{}", ipsum);
}
false => {
println!("{}", sit)
}
true =>
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
false => println!("{}", sit),
}
```
@ -2010,8 +2006,7 @@ match lorem {
```rust
match lorem {
true => {
let ipsum = dolor;
println!("{}", ipsum);
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
}
false => println!("{}", sit),
}

View File

@ -570,7 +570,8 @@ create_config! {
wrap_comments: bool, false, "Break comments to fit on the line";
comment_width: usize, 80, "Maximum length of comments. No effect unless wrap_comments = true";
normalize_comments: bool, false, "Convert /* */ comments to // comments where possible";
wrap_match_arms: bool, true, "Wrap multiline match arms in blocks";
wrap_match_arms: bool, true, "Wrap the body of arms in blocks when it does not fit on \
the same line with the pattern of arms";
match_block_trailing_comma: bool, false,
"Put a trailing comma after a block based match arm (non-block arms are not affected)";
indent_match_arms: bool, true, "Indent match arms instead of keeping them at the same \

View File

@ -3,10 +3,7 @@
fn main() {
match lorem {
true => {
let ipsum = dolor;
println!("{:?}", ipsum);
}
true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
false => {
println!("{}", sit)
}

View File

@ -3,10 +3,7 @@
fn main() {
match lorem {
true => {
let ipsum = dolor;
println!("{}", ipsum);
}
true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
false => {
println!("{}", sit)
}

View File

@ -3,12 +3,8 @@
fn main() {
match lorem {
true => {
let ipsum = dolor;
println!("{:?}", ipsum);
}
false => {
println!("{}", sit)
}
true =>
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
false => println!("{}", sit),
}
}

View File

@ -4,8 +4,7 @@
fn main() {
match lorem {
true => {
let ipsum = dolor;
println!("{}", ipsum);
foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
}
false => println!("{}", sit),
}

View File

@ -4,9 +4,7 @@
fn foo() {
match x {
a => {
foo()
}
a => foo(),
b => (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,