diff --git a/Configurations.md b/Configurations.md index f7fa88b61f2c..da027d10e706 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 7fdc0e85686f..20ba0118f5f3 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 c719f9938ee9..14ba8d0f7a08 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 c871395f72ab..402f7ab507ab 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 db72a775f414..d5c97b95560d 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 8c4d67575dcb..3b73247f7f88 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 8a41eec2bde3..d3e3cad5ebbd 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 277990c5a60e..2bec429e8c82 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 087fb80ef092..fe565f4c1540 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, ), } }