From 48424ea7654bbf1a0b3d747be05b45f799c7e28d Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Mon, 26 Mar 2018 07:38:39 +0900 Subject: Update tests and cargo fmt --- src/closures.rs | 20 ++++++-------------- src/expr.rs | 8 +------- src/format-diff/main.rs | 2 +- src/rustfmt_diff.rs | 46 ++++++++++++++++++++-------------------------- 4 files changed, 28 insertions(+), 48 deletions(-) (limited to 'src') 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())], + }] ); } } -- cgit 1.4.1-3-g733a5