]> git.lizzy.rs Git - rust.git/commitdiff
Update wrap_match_arms option tests and visual guide
authortopecongiro <seuchida@gmail.com>
Tue, 11 Jul 2017 12:53:57 +0000 (21:53 +0900)
committertopecongiro <seuchida@gmail.com>
Tue, 11 Jul 2017 12:53:57 +0000 (21:53 +0900)
Configurations.md
src/config.rs
tests/source/configs-wrap_match_arms-false.rs
tests/source/configs-wrap_match_arms-true.rs
tests/target/configs-wrap_match_arms-false.rs
tests/target/configs-wrap_match_arms-true.rs
tests/target/match-nowrap.rs

index cbf41b0f53730f3666a9554bdac2f9d51828b4dd..58124b8bc9333a51d129b1d8cc3a9a62e7fb6218 100644 (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),
 }
index 510cdef6f1b475e468809fcd8434e02b345c8866..2fe6d3ea6b633beca3381222e3c2ac4dba8a0400 100644 (file)
@@ -570,7 +570,8 @@ pub fn get_toml_path(dir: &Path) -> Result<Option<PathBuf>, Error> {
     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 \
index 5d0337a0c7d342bf7f7a689fb08451899c0cb69a..d1c05c27fd75a43f41fbe51846fafa14c0287dfa 100644 (file)
@@ -3,10 +3,7 @@
 
 fn main() {
     match lorem {
-        true => {
-            let ipsum = dolor;
-            println!("{:?}", ipsum);
-        }
+        true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
         false => {
             println!("{}", sit)
         }
index fb74fb4f6200a61917c618bb8109c1871d2d40e2..8ddc5ebdc2e3878271489ba35307aef87f688842 100644 (file)
@@ -3,10 +3,7 @@
 
 fn main() {
     match lorem {
-        true => {
-            let ipsum = dolor;
-            println!("{}", ipsum);
-        }
+        true => foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
         false => {
             println!("{}", sit)
         }
index 5d0337a0c7d342bf7f7a689fb08451899c0cb69a..e4ca37bc6e55ff515de16de4460849cd892a110d 100644 (file)
@@ -3,12 +3,8 @@
 
 fn main() {
     match lorem {
-        true => {
-            let ipsum = dolor;
-            println!("{:?}", ipsum);
-        }
-        false => {
-            println!("{}", sit)
-        }
+        true =>
+            foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),
+        false => println!("{}", sit),
     }
 }
index 3655a62f618e479b9c80332d5d7374fe55ab401c..f6307e53e435499ab2e7e42cfe02a142ffbb436c 100644 (file)
@@ -4,8 +4,7 @@
 fn main() {
     match lorem {
         true => {
-            let ipsum = dolor;
-            println!("{}", ipsum);
+            foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)
         }
         false => println!("{}", sit),
     }
index 3849a8fb0e01712e2d5342ae55570ed208914d2a..1457109821880441e2c3ee1a747dbd4da0d9a0e8 100644 (file)
@@ -4,9 +4,7 @@
 
 fn foo() {
     match x {
-        a => {
-            foo()
-        }
+        a => foo(),
         b => (
             aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
             bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,