diff --git a/Configurations.md b/Configurations.md index cbf41b0f537..58124b8bc93 100644 --- a/Configurations.md +++ b/Configurations.md @@ -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), } diff --git a/src/config.rs b/src/config.rs index 510cdef6f1b..2fe6d3ea6b6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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 \ diff --git a/tests/source/configs-wrap_match_arms-false.rs b/tests/source/configs-wrap_match_arms-false.rs index 5d0337a0c7d..d1c05c27fd7 100644 --- a/tests/source/configs-wrap_match_arms-false.rs +++ b/tests/source/configs-wrap_match_arms-false.rs @@ -3,10 +3,7 @@ fn main() { match lorem { - true => { - let ipsum = dolor; - println!("{:?}", ipsum); - } + true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x), false => { println!("{}", sit) } diff --git a/tests/source/configs-wrap_match_arms-true.rs b/tests/source/configs-wrap_match_arms-true.rs index fb74fb4f620..8ddc5ebdc2e 100644 --- a/tests/source/configs-wrap_match_arms-true.rs +++ b/tests/source/configs-wrap_match_arms-true.rs @@ -3,10 +3,7 @@ fn main() { match lorem { - true => { - let ipsum = dolor; - println!("{}", ipsum); - } + true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x), false => { println!("{}", sit) } diff --git a/tests/target/configs-wrap_match_arms-false.rs b/tests/target/configs-wrap_match_arms-false.rs index 5d0337a0c7d..e4ca37bc6e5 100644 --- a/tests/target/configs-wrap_match_arms-false.rs +++ b/tests/target/configs-wrap_match_arms-false.rs @@ -3,12 +3,8 @@ fn main() { match lorem { - true => { - let ipsum = dolor; - println!("{:?}", ipsum); - } - false => { - println!("{}", sit) - } + true => + foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x), + false => println!("{}", sit), } } diff --git a/tests/target/configs-wrap_match_arms-true.rs b/tests/target/configs-wrap_match_arms-true.rs index 3655a62f618..f6307e53e43 100644 --- a/tests/target/configs-wrap_match_arms-true.rs +++ b/tests/target/configs-wrap_match_arms-true.rs @@ -4,8 +4,7 @@ fn main() { match lorem { true => { - let ipsum = dolor; - println!("{}", ipsum); + foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x) } false => println!("{}", sit), } diff --git a/tests/target/match-nowrap.rs b/tests/target/match-nowrap.rs index 3849a8fb0e0..14571098218 100644 --- a/tests/target/match-nowrap.rs +++ b/tests/target/match-nowrap.rs @@ -4,9 +4,7 @@ fn foo() { match x { - a => { - foo() - } + a => foo(), b => ( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,