about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSeiichi Uchida <seuchida@gmail.com>2018-03-26 07:38:39 +0900
committerSeiichi Uchida <seuchida@gmail.com>2018-03-26 07:38:39 +0900
commit48424ea7654bbf1a0b3d747be05b45f799c7e28d (patch)
treecfbd755de1b57b0a3b9977869e51c4487a2020a6
parent98c6f7b7313c0053f822a10ab473f31bf1f480ef (diff)
Update tests and cargo fmt
-rw-r--r--Configurations.md6
-rw-r--r--src/closures.rs20
-rw-r--r--src/expr.rs8
-rw-r--r--src/format-diff/main.rs2
-rw-r--r--src/rustfmt_diff.rs46
-rw-r--r--tests/lib.rs24
-rw-r--r--tests/target/chains.rs5
-rw-r--r--tests/target/expr-block.rs14
-rw-r--r--tests/target/match.rs5
9 files changed, 46 insertions, 84 deletions
diff --git a/Configurations.md b/Configurations.md
index f7fa88b61f2..da027d10e70 100644
--- a/Configurations.md
+++ b/Configurations.md
@@ -1688,7 +1688,8 @@ Number of spaces per tab
 fn lorem() {
     let ipsum = dolor();
     let sit = vec![
-        "amet consectetur adipiscing elit amet consectetur adipiscing elit amet consectetur.",
+        "amet consectetur adipiscing elit amet",
+        "consectetur adipiscing elit amet consectetur.",
     ];
 }
 ```
@@ -1699,7 +1700,8 @@ fn lorem() {
 fn lorem() {
   let ipsum = dolor();
   let sit = vec![
-    "amet consectetur adipiscing elit amet consectetur adipiscing elit amet consectetur.",
+    "amet consectetur adipiscing elit amet",
+    "consectetur adipiscing elit amet consectetur.",
   ];
 }
 ```
diff --git a/src/closures.rs b/src/closures.rs
index 7fdc0e85686..20ba0118f5f 100644
--- a/src/closures.rs
+++ b/src/closures.rs
@@ -127,13 +127,11 @@ fn rewrite_closure_with_block(
     }
 
     let block = ast::Block {
-        stmts: vec![
-            ast::Stmt {
-                id: ast::NodeId::new(0),
-                node: ast::StmtKind::Expr(ptr::P(body.clone())),
-                span: body.span,
-            },
-        ],
+        stmts: vec![ast::Stmt {
+            id: ast::NodeId::new(0),
+            node: ast::StmtKind::Expr(ptr::P(body.clone())),
+            span: body.span,
+        }],
         id: ast::NodeId::new(0),
         rules: ast::BlockCheckMode::Default,
         span: body.span,
@@ -300,13 +298,7 @@ pub fn rewrite_last_closure(
             _ => body,
         };
         let (prefix, extra_offset) = rewrite_closure_fn_decl(
-            capture,
-            movability,
-            fn_decl,
-            body,
-            expr.span,
-            context,
-            shape,
+            capture, movability, fn_decl, body, expr.span, context, shape,
         )?;
         // If the closure goes multi line before its body, do not overflow the closure.
         if prefix.contains('\n') {
diff --git a/src/expr.rs b/src/expr.rs
index c719f9938ee..14ba8d0f7a0 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -173,13 +173,7 @@ pub fn format_expr(
         },
         ast::ExprKind::Closure(capture, movability, ref fn_decl, ref body, _) => {
             closures::rewrite_closure(
-                capture,
-                movability,
-                fn_decl,
-                body,
-                expr.span,
-                context,
-                shape,
+                capture, movability, fn_decl, body, expr.span, context, shape,
             )
         }
         ast::ExprKind::Try(..)
diff --git a/src/format-diff/main.rs b/src/format-diff/main.rs
index c871395f72a..402f7ab507a 100644
--- a/src/format-diff/main.rs
+++ b/src/format-diff/main.rs
@@ -261,7 +261,7 @@ fn scan_simple_git_diff() {
             Range {
                 file: "src/ir/traversal.rs".to_owned(),
                 range: [35, 43],
-            }
+            },
         ]
     );
 }
diff --git a/src/rustfmt_diff.rs b/src/rustfmt_diff.rs
index db72a775f41..d5c97b95560 100644
--- a/src/rustfmt_diff.rs
+++ b/src/rustfmt_diff.rs
@@ -221,18 +221,16 @@ mod test {
         let diff = make_diff(src, dest, 1);
         assert_eq!(
             diff,
-            vec![
-                Mismatch {
-                    line_number: 2,
-                    line_number_orig: 2,
-                    lines: vec![
-                        Context("two".to_owned()),
-                        Resulting("three".to_owned()),
-                        Expected("trois".to_owned()),
-                        Context("four".to_owned()),
-                    ],
-                },
-            ]
+            vec![Mismatch {
+                line_number: 2,
+                line_number_orig: 2,
+                lines: vec![
+                    Context("two".to_owned()),
+                    Resulting("three".to_owned()),
+                    Expected("trois".to_owned()),
+                    Context("four".to_owned()),
+                ],
+            }]
         );
     }
 
@@ -274,13 +272,11 @@ mod test {
         let diff = make_diff(src, dest, 0);
         assert_eq!(
             diff,
-            vec![
-                Mismatch {
-                    line_number: 3,
-                    line_number_orig: 3,
-                    lines: vec![Resulting("three".to_owned()), Expected("trois".to_owned())],
-                },
-            ]
+            vec![Mismatch {
+                line_number: 3,
+                line_number_orig: 3,
+                lines: vec![Resulting("three".to_owned()), Expected("trois".to_owned())],
+            }]
         );
     }
 
@@ -291,13 +287,11 @@ mod test {
         let diff = make_diff(src, dest, 1);
         assert_eq!(
             diff,
-            vec![
-                Mismatch {
-                    line_number: 5,
-                    line_number_orig: 5,
-                    lines: vec![Context("five".to_owned()), Expected("".to_owned())],
-                },
-            ]
+            vec![Mismatch {
+                line_number: 5,
+                line_number_orig: 5,
+                lines: vec![Context("five".to_owned()), Expected("".to_owned())],
+            }]
         );
     }
 }
diff --git a/tests/lib.rs b/tests/lib.rs
index 8c4d67575dc..3b73247f7f8 100644
--- a/tests/lib.rs
+++ b/tests/lib.rs
@@ -540,19 +540,17 @@ fn rustfmt_diff_make_diff_tests() {
     let diff = make_diff("a\nb\nc\nd", "a\ne\nc\nd", 3);
     assert_eq!(
         diff,
-        vec![
-            Mismatch {
-                line_number: 1,
-                line_number_orig: 1,
-                lines: vec![
-                    DiffLine::Context("a".into()),
-                    DiffLine::Resulting("b".into()),
-                    DiffLine::Expected("e".into()),
-                    DiffLine::Context("c".into()),
-                    DiffLine::Context("d".into()),
-                ],
-            },
-        ]
+        vec![Mismatch {
+            line_number: 1,
+            line_number_orig: 1,
+            lines: vec![
+                DiffLine::Context("a".into()),
+                DiffLine::Resulting("b".into()),
+                DiffLine::Expected("e".into()),
+                DiffLine::Context("c".into()),
+                DiffLine::Context("d".into()),
+            ],
+        }]
     );
 }
 
diff --git a/tests/target/chains.rs b/tests/target/chains.rs
index 8a41eec2bde..d3e3cad5ebb 100644
--- a/tests/target/chains.rs
+++ b/tests/target/chains.rs
@@ -233,10 +233,7 @@ impl Foo {
                         if let Some(mi) = attr.meta() {
                             if let Some(value) = mi.value_str() {
                                 doc_strings.push(DocFragment::Include(
-                                    line,
-                                    attr.span,
-                                    filename,
-                                    contents,
+                                    line, attr.span, filename, contents,
                                 ));
                             }
                         }
diff --git a/tests/target/expr-block.rs b/tests/target/expr-block.rs
index 277990c5a60..2bec429e8c8 100644
--- a/tests/target/expr-block.rs
+++ b/tests/target/expr-block.rs
@@ -114,19 +114,7 @@ fn function_calls() {
 
 fn macros() {
     baz!(
-        do_not,
-        add,
-        trailing,
-        commas,
-        inside,
-        of,
-        function,
-        like,
-        macros,
-        even,
-        if_they,
-        are,
-        long
+        do_not, add, trailing, commas, inside, of, function, like, macros, even, if_they, are, long
     );
 
     baz!(one_item_macro_which_is_also_loooooooooooooooooooooooooooooooooooooooooooooooong);
diff --git a/tests/target/match.rs b/tests/target/match.rs
index 087fb80ef09..fe565f4c154 100644
--- a/tests/target/match.rs
+++ b/tests/target/match.rs
@@ -218,10 +218,7 @@ fn issue355() {
         xc => vec![1, 2],       // comment
         yc => vec![3; 4],       // comment
         yd => looooooooooooooooooooooooooooooooooooooooooooooooooooooooong_func(
-            aaaaaaaaaa,
-            bbbbbbbbbb,
-            cccccccccc,
-            dddddddddd,
+            aaaaaaaaaa, bbbbbbbbbb, cccccccccc, dddddddddd,
         ),
     }
 }