From 087f8b58545519aec6cca7a0a69feb7b0738455e Mon Sep 17 00:00:00 2001
From: Nick Cameron <ncameron@mozilla.com>
Date: Mon, 27 Nov 2017 16:31:49 +1300
Subject: [PATCH] Remove `match_arm_forces_newline`

---
 Configurations.md                             | 41 -----------------
 src/config.rs                                 |  2 -
 src/expr.rs                                   |  7 +--
 .../configs-match_arm_forces_newline-true.rs  | 20 ---------
 .../configs-match_arm_forces_newline-true.rs  | 44 -------------------
 5 files changed, 1 insertion(+), 113 deletions(-)
 delete mode 100644 tests/source/configs-match_arm_forces_newline-true.rs
 delete mode 100644 tests/target/configs-match_arm_forces_newline-true.rs

diff --git a/Configurations.md b/Configurations.md
index ce0a56b0f1c..ee4851eb2e5 100644
--- a/Configurations.md
+++ b/Configurations.md
@@ -1108,47 +1108,6 @@ use foo::{aaa,
           fff};
 ```
 
-## `match_arm_forces_newline`
-
-Consistently put match arms (block based or not) in a newline.
-
-- **Default value**: `false`
-- **Possible values**: `true`, `false`
-
-#### `false` (default):
-
-```rust
-match x {
-    // a non-empty block
-    X0 => {
-        f();
-    }
-    // an empty block
-    X1 => {}
-    // a non-block
-    X2 => println!("ok"),
-}
-```
-
-#### `true`:
-
-```rust
-match x {
-    // a non-empty block
-    X0 => {
-        f();
-    }
-    // an empty block
-    X1 =>
-        {}
-    // a non-block
-    X2 => {
-        println!("ok")
-    }
-}
-```
-
-See also: [`wrap_match_arms`](#wrap_match_arms).
 
 ## `match_block_trailing_comma`
 
diff --git a/src/config.rs b/src/config.rs
index 51e593e0f2a..fe18f02d33e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -625,8 +625,6 @@ create_config! {
         "Force multiline match arm bodies to be wrapped in a block";
     match_block_trailing_comma: bool, false, false,
         "Put a trailing comma after a block based match arm (non-block arms are not affected)";
-    match_arm_forces_newline: bool, false, false,
-        "Force match arm bodies to be in a new lines";
 
     // Spaces around punctuation
     binop_separator: SeparatorPlace, SeparatorPlace::Front, false,
diff --git a/src/expr.rs b/src/expr.rs
index dc44f20d1b3..14913fef9e7 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1529,11 +1529,6 @@ fn rewrite_match_body(
     } else {
         (false, false)
     };
-    let extend = if context.config.match_arm_forces_newline() {
-        is_block
-    } else {
-        extend
-    };
 
     let comma = arm_comma(context.config, body, is_last);
     let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config);
@@ -1606,7 +1601,7 @@ fn rewrite_match_body(
 
         match rewrite {
             Some(ref body_str)
-                if !forbid_same_line && !context.config.match_arm_forces_newline()
+                if !forbid_same_line
                     && (is_block
                         || (!body_str.contains('\n') && body_str.len() <= body_shape.width)) =>
             {
diff --git a/tests/source/configs-match_arm_forces_newline-true.rs b/tests/source/configs-match_arm_forces_newline-true.rs
deleted file mode 100644
index e9c8d575f1d..00000000000
--- a/tests/source/configs-match_arm_forces_newline-true.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// rustfmt-match_arm_forces_newline: true
-// rustfmt-wrap_match_arms: false
-
-// match_arm_forces_newline puts all match arms bodies in a newline and indents
-// them.
-
-fn main() {
-    match x() {
-        // a short non-empty block
-        X0 => { f(); }
-        // a long non-empty block
-        X1 => { some.really.long.expression.fooooooooooooooooooooooooooooooooooooooooo().baaaaarrrrrrrrrrrrrrrrrrrrrrrrrr(); }
-        // an empty block
-        X2 => {}
-        // a short non-block
-        X3 => println!("ok"),
-        // a long non-block
-        X4 => foo.bar.baz.test.x.y.z.a.s.d.fasdfasdf.asfads.fasd.fasdfasdf.dfasfdsaf(),
-    }
-}
diff --git a/tests/target/configs-match_arm_forces_newline-true.rs b/tests/target/configs-match_arm_forces_newline-true.rs
deleted file mode 100644
index 5629a56d664..00000000000
--- a/tests/target/configs-match_arm_forces_newline-true.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// rustfmt-match_arm_forces_newline: true
-// rustfmt-wrap_match_arms: false
-
-// match_arm_forces_newline puts all match arms bodies in a newline and indents
-// them.
-
-fn main() {
-    match x() {
-        // a short non-empty block
-        X0 => {
-            f();
-        }
-        // a long non-empty block
-        X1 => {
-            some.really
-                .long
-                .expression
-                .fooooooooooooooooooooooooooooooooooooooooo()
-                .baaaaarrrrrrrrrrrrrrrrrrrrrrrrrr();
-        }
-        // an empty block
-        X2 =>
-            {}
-        // a short non-block
-        X3 =>
-            println!("ok"),
-        // a long non-block
-        X4 =>
-            foo.bar
-                .baz
-                .test
-                .x
-                .y
-                .z
-                .a
-                .s
-                .d
-                .fasdfasdf
-                .asfads
-                .fasd
-                .fasdfasdf
-                .dfasfdsaf(),
-    }
-}