diff --git a/src/imports.rs b/src/imports.rs index 8a327069c2f..3b7c47f0fca 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -177,13 +177,11 @@ impl Rewrite for ast::ViewPath { let prefix_shape = try_opt!(shape.sub_width(ident_str.len() + 4)); let path_str = try_opt!(rewrite_view_path_prefix(path, context, prefix_shape)); - Some( - if path.segments.last().unwrap().identifier == ident { - path_str - } else { - format!("{} as {}", path_str, ident_str) - }, - ) + Some(if path.segments.last().unwrap().identifier == ident { + path_str + } else { + format!("{} as {}", path_str, ident_str) + }) } } } @@ -392,13 +390,11 @@ pub fn rewrite_use_list( }; let list_str = try_opt!(write_list(&items[first_index..], &fmt)); - Some( - if path_str.is_empty() { - format!("{{{}}}", list_str) - } else { - format!("{}::{{{}}}", path_str, list_str) - }, - ) + Some(if path_str.is_empty() { + format!("{{{}}}", list_str) + } else { + format!("{}::{{{}}}", path_str, list_str) + }) } // Returns true when self item was found. diff --git a/src/items.rs b/src/items.rs index 3639e5ae0e5..01aa7b389d5 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1990,13 +1990,11 @@ fn rewrite_fn_base( }); let snippet = snippet.trim(); if !snippet.is_empty() { - result.push( - if original_starts_with_newline { - '\n' - } else { - ' ' - }, - ); + result.push(if original_starts_with_newline { + '\n' + } else { + ' ' + }); result.push_str(snippet); if original_ends_with_newline { force_new_line_for_brace = true; diff --git a/src/patterns.rs b/src/patterns.rs index 67e4870f660..a52f42157b8 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -336,23 +336,19 @@ fn rewrite_tuple_pat( match path_str { Some(path_str) => { - Some( - if context.config.spaces_within_parens() { - format!("{}( {} )", path_str, list) - } else { - format!("{}({})", path_str, list) - }, - ) + Some(if context.config.spaces_within_parens() { + format!("{}( {} )", path_str, list) + } else { + format!("{}({})", path_str, list) + }) } None => { let comma = if add_comma { "," } else { "" }; - Some( - if context.config.spaces_within_parens() { - format!("( {}{} )", list, comma) - } else { - format!("({}{})", list, comma) - }, - ) + Some(if context.config.spaces_within_parens() { + format!("( {}{} )", list, comma) + } else { + format!("({}{})", list, comma) + }) } } } diff --git a/src/types.rs b/src/types.rs index f54e1c96eda..b1cea7df864 100644 --- a/src/types.rs +++ b/src/types.rs @@ -348,13 +348,11 @@ where String::new() }; - Some( - if context.config.spaces_within_parens() { - format!("( {} ){}{}", list_str, infix, output) - } else { - format!("({}){}{}", list_str, infix, output) - }, - ) + Some(if context.config.spaces_within_parens() { + format!("( {} ){}{}", list_str, infix, output) + } else { + format!("({}){}{}", list_str, infix, output) + }) } fn type_bound_colon(context: &RewriteContext) -> &'static str { @@ -588,13 +586,13 @@ impl Rewrite for ast::PolyTraitRef { ), )); - Some( - if context.config.spaces_within_angle_brackets() && lifetime_str.len() > 0 { - format!("for< {} > {}", lifetime_str, path_str) - } else { - format!("for<{}> {}", lifetime_str, path_str) - }, - ) + Some(if context.config.spaces_within_angle_brackets() && + lifetime_str.len() > 0 + { + format!("for< {} > {}", lifetime_str, path_str) + } else { + format!("for<{}> {}", lifetime_str, path_str) + }) } else { self.trait_ref.rewrite(context, shape) } diff --git a/tests/system.rs b/tests/system.rs index b36676e4c37..970d9f0e2eb 100644 --- a/tests/system.rs +++ b/tests/system.rs @@ -84,9 +84,9 @@ fn assert_output(source: &str, expected_filename: &str) { let mut expected_file = fs::File::open(&expected_filename).expect("Couldn't open target"); let mut expected_text = String::new(); - expected_file - .read_to_string(&mut expected_text) - .expect("Failed reading target"); + expected_file.read_to_string(&mut expected_text).expect( + "Failed reading target", + ); let compare = make_diff(&expected_text, &output, DIFF_CONTEXT_SIZE); if compare.len() > 0 { @@ -136,9 +136,11 @@ fn self_tests() { warnings += format_report.warning_count(); } - assert!(warnings == 0, - "Rustfmt's code generated {} warnings", - warnings); + assert!( + warnings == 0, + "Rustfmt's code generated {} warnings", + warnings + ); } #[test] @@ -170,7 +172,8 @@ fn format_lines_errors_are_reported() { // For each file, run rustfmt and collect the output. // Returns the number of files checked and the number of failures. fn check_files(files: I) -> (Vec, u32, u32) - where I: Iterator +where + I: Iterator, { let mut count = 0; let mut fails = 0; @@ -217,10 +220,12 @@ fn read_config(filename: &str) -> Config { let mut config = if !sig_comments.is_empty() { get_config(sig_comments.get("config").map(|x| &(*x)[..])) } else { - get_config(Path::new(filename) - .with_extension("toml") - .file_name() - .and_then(std::ffi::OsStr::to_str)) + get_config( + Path::new(filename) + .with_extension("toml") + .file_name() + .and_then(std::ffi::OsStr::to_str), + ) }; for (key, val) in &sig_comments { @@ -280,9 +285,9 @@ fn get_config(config_file: Option<&str>) -> Config { let mut def_config_file = fs::File::open(config_file_name).expect("Couldn't open config"); let mut def_config = String::new(); - def_config_file - .read_to_string(&mut def_config) - .expect("Couldn't read config"); + def_config_file.read_to_string(&mut def_config).expect( + "Couldn't read config", + ); Config::from_toml(&def_config).expect("Invalid toml") } @@ -305,16 +310,18 @@ fn read_significant_comments(file_name: &str) -> HashMap { .take_while(|line| line_regex.is_match(&line)) .filter_map(|line| { regex.captures_iter(&line).next().map(|capture| { - (capture - .get(1) - .expect("Couldn't unwrap capture") - .as_str() - .to_owned(), - capture - .get(2) - .expect("Couldn't unwrap capture") - .as_str() - .to_owned()) + ( + capture + .get(1) + .expect("Couldn't unwrap capture") + .as_str() + .to_owned(), + capture + .get(2) + .expect("Couldn't unwrap capture") + .as_str() + .to_owned(), + ) }) }) .collect() @@ -322,9 +329,10 @@ fn read_significant_comments(file_name: &str) -> HashMap { // Compare output to input. // TODO: needs a better name, more explanation. -fn handle_result(result: HashMap, - target: Option<&str>) - -> Result<(), HashMap>> { +fn handle_result( + result: HashMap, + target: Option<&str>, +) -> Result<(), HashMap>> { let mut failures = HashMap::new(); for (file_name, fmt_text) in result { @@ -339,8 +347,10 @@ fn handle_result(result: HashMap, if fmt_text != text { let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE); - assert!(!diff.is_empty(), - "Empty diff? Maybe due to a missing a newline at the end of a file?"); + assert!( + !diff.is_empty(), + "Empty diff? Maybe due to a missing a newline at the end of a file?" + ); failures.insert(file_name, diff); } } @@ -374,15 +384,21 @@ fn get_target(file_name: &str, target: Option<&str>) -> String { #[test] 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, - lines: vec![DiffLine::Context("a".into()), - DiffLine::Resulting("b".into()), - DiffLine::Expected("e".into()), - DiffLine::Context("c".into()), - DiffLine::Context("d".into())], - }]); + assert_eq!( + diff, + vec![ + Mismatch { + line_number: 1, + lines: vec![ + DiffLine::Context("a".into()), + DiffLine::Resulting("b".into()), + DiffLine::Expected("e".into()), + DiffLine::Context("c".into()), + DiffLine::Context("d".into()), + ], + }, + ] + ); } #[test] diff --git a/tests/target/assignment.rs b/tests/target/assignment.rs index fe8f3baae1e..1bd7dbc1d91 100644 --- a/tests/target/assignment.rs +++ b/tests/target/assignment.rs @@ -19,10 +19,14 @@ fn main() { fn break_meee() { { - (block_start, block_size, margin_block_start, margin_block_end) = - match (block_start, block_end, block_size) { - x => 1, - _ => 2, - }; + ( + block_start, + block_size, + margin_block_start, + margin_block_end, + ) = match (block_start, block_end, block_size) { + x => 1, + _ => 2, + }; } } diff --git a/tests/target/chains-visual.rs b/tests/target/chains-visual.rs index 52d271a4469..48222b14e6e 100644 --- a/tests/target/chains-visual.rs +++ b/tests/target/chains-visual.rs @@ -17,15 +17,15 @@ fn main() { // Test case where first chain element isn't a path, but is shorter than // the size of a tab. x().y(|| match cond() { - true => (), - false => (), - }); + true => (), + false => (), + }); loong_func().quux(move || if true { - 1 - } else { - 2 - }); + 1 + } else { + 2 + }); some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| { let x = c; @@ -47,14 +47,15 @@ fn main() { }); let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = - xxxxxxx.map(|x| x + 5) - .map(|x| x / 2) - .fold(0, |acc, x| acc + x); + xxxxxxx.map(|x| x + 5).map(|x| x / 2).fold( + 0, + |acc, x| acc + x, + ); aaaaaaaaaaaaaaaa.map(|x| { - x += 1; - x - }) + x += 1; + x + }) .filter(some_mod::some_filter) } @@ -82,11 +83,13 @@ fn floaters() { match x { PushParam => { // params are 1-indexed - stack.push(mparams[match cur.to_digit(10) { - Some(d) => d as usize - 1, - None => return Err("bad param number".to_owned()), - }] - .clone()); + stack.push( + mparams[match cur.to_digit(10) { + Some(d) => d as usize - 1, + None => return Err("bad param number".to_owned()), + }] + .clone(), + ); } } } @@ -101,9 +104,9 @@ fn floaters() { Foo { x: val } .baz(|| { - force(); - multiline(); - }) + force(); + multiline(); + }) .quux(); Foo { @@ -111,17 +114,17 @@ fn floaters() { z: ok, } .baz(|| { - force(); - multiline(); - }) + force(); + multiline(); + }) .quux(); a + - match x { - true => "yay!", - false => "boo!", - } - .bar() + match x { + true => "yay!", + false => "boo!", + } + .bar() } fn is_replaced_content() -> bool { @@ -163,8 +166,10 @@ fn issue1434() { for _ in 0..100 { let prototype_id = PrototypeIdData::from_reader::<_, B>(&mut self.file_cursor) .chain_err(|| { - format!("could not read prototype ID at offset {:#010x}", - current_offset) - })?; + format!( + "could not read prototype ID at offset {:#010x}", + current_offset + ) + })?; } } diff --git a/tests/target/chains.rs b/tests/target/chains.rs index 298c79ae91a..52e65b420e7 100644 --- a/tests/target/chains.rs +++ b/tests/target/chains.rs @@ -19,15 +19,15 @@ fn main() { // Test case where first chain element isn't a path, but is shorter than // the size of a tab. x().y(|| match cond() { - true => (), - false => (), - }); + true => (), + false => (), + }); loong_func().quux(move || if true { - 1 - } else { - 2 - }); + 1 + } else { + 2 + }); some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| { let x = c; @@ -53,9 +53,9 @@ fn main() { aaaaaaaaaaaaaaaa .map(|x| { - x += 1; - x - }) + x += 1; + x + }) .filter(some_mod::some_filter) } @@ -81,10 +81,12 @@ fn floaters() { match x { PushParam => { // params are 1-indexed - stack.push(mparams[match cur.to_digit(10) { - Some(d) => d as usize - 1, - None => return Err("bad param number".to_owned()), - }].clone()); + stack.push( + mparams[match cur.to_digit(10) { + Some(d) => d as usize - 1, + None => return Err("bad param number".to_owned()), + }].clone(), + ); } } } @@ -98,25 +100,25 @@ fn floaters() { Foo { x: val } .baz(|| { - force(); - multiline(); - }) + force(); + multiline(); + }) .quux(); Foo { y: i_am_multi_line, z: ok, }.baz(|| { - force(); - multiline(); - }) + force(); + multiline(); + }) .quux(); a + - match x { - true => "yay!", - false => "boo!", - }.bar() + match x { + true => "yay!", + false => "boo!", + }.bar() } fn is_replaced_content() -> bool { @@ -163,7 +165,7 @@ fn issue_1004() { }?; ty::tls::with(|tcx| { - let tap = ty::Binder(TraitAndProjections(principal, projections)); - in_binder(f, tcx, &ty::Binder(""), Some(tap)) - })?; + let tap = ty::Binder(TraitAndProjections(principal, projections)); + in_binder(f, tcx, &ty::Binder(""), Some(tap)) + })?; } diff --git a/tests/target/closure.rs b/tests/target/closure.rs index d51c76b9e48..4f35a7b413a 100644 --- a/tests/target/closure.rs +++ b/tests/target/closure.rs @@ -4,13 +4,17 @@ fn main() { let square = (|i: i32| i * i); - let commented = - |// first - a, // argument - // second - b: WithType, // argument - // ignored - _| (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); + let commented = |// first + a, // argument + // second + b: WithType, // argument + // ignored + _| { + ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + ) + }; let block_body = move |xxxxxxxxxxxxxxxxxxxxxxxxxxxxx, ref yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy| { @@ -91,9 +95,9 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { match (&left.node, &right.node) { (&ExprBinary(l_op, ref ll, ref lr), &ExprBinary(r_op, ref rl, ref rr)) => { l_op.node == r_op.node && self.eq_expr(ll, rl) && self.eq_expr(lr, rr) || - swap_binop(l_op.node, ll, lr).map_or(false, |(l_op, ll, lr)| { - l_op == r_op.node && self.eq_expr(ll, rl) && self.eq_expr(lr, rr) - }) + swap_binop(l_op.node, ll, lr).map_or(false, |(l_op, ll, lr)| { + l_op == r_op.node && self.eq_expr(ll, rl) && self.eq_expr(lr, rr) + }) } } } @@ -101,10 +105,10 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> { fn foo() { lifetimes_iter___map(|lasdfasfd| { - let hi = if l.bounds.is_empty() { - l.lifetime.span.hi - }; - }); + let hi = if l.bounds.is_empty() { + l.lifetime.span.hi + }; + }); } fn issue1405() { @@ -124,17 +128,18 @@ fn issue470() { { { { - let explicit_arg_decls = explicit_arguments - .into_iter() - .enumerate() - .map(|(index, (ty, pattern))| { - let lvalue = Lvalue::Arg(index as u32); - block = this.pattern(block, - argument_extent, - hair::PatternRef::Hair(pattern), - &lvalue); - ArgDecl { ty: ty } - }); + let explicit_arg_decls = explicit_arguments.into_iter().enumerate().map(|(index, + (ty, + pattern))| { + let lvalue = Lvalue::Arg(index as u32); + block = this.pattern( + block, + argument_extent, + hair::PatternRef::Hair(pattern), + &lvalue, + ); + ArgDecl { ty: ty } + }); } } } @@ -144,19 +149,17 @@ fn issue470() { impl Foo { pub fn bar(&self) { Some(SomeType { - push_closure_out_to_100_chars: iter(otherwise_it_works_ok - .into_iter() - .map(|f| Ok(f))), - }) + push_closure_out_to_100_chars: iter(otherwise_it_works_ok.into_iter().map(|f| Ok(f))), + }) } } fn issue1329() { aaaaaaaaaaaaaaaa .map(|x| { - x += 1; - x - }) + x += 1; + x + }) .filter } diff --git a/tests/target/comment.rs b/tests/target/comment.rs index a2f8d6ba0b4..a50c147de30 100644 --- a/tests/target/comment.rs +++ b/tests/target/comment.rs @@ -37,9 +37,11 @@ fn test() { // #1388 const EXCEPTION_PATHS: &'static [&'static str] = - &[// std crates - "src/libstd/sys/", // Platform-specific code for std lives here. - "src/bootstrap"]; + &[ + // std crates + "src/libstd/sys/", // Platform-specific code for std lives here. + "src/bootstrap", + ]; } /// test123 @@ -47,10 +49,10 @@ fn doc_comment() {} fn chains() { foo.bar(|| { - let x = 10; - // comment - x - }) + let x = 10; + // comment + x + }) } fn issue_1086() { diff --git a/tests/target/comments-fn.rs b/tests/target/comments-fn.rs index 87b32f2915d..9a28c81a39e 100644 --- a/tests/target/comments-fn.rs +++ b/tests/target/comments-fn.rs @@ -1,17 +1,19 @@ // Test comments on functions are preserved. // Comment on foo. -fn foo(a: aaaaaaaaaaaaa, // A comment - b: bbbbbbbbbbbbb, // a second comment - c: ccccccccccccc, - // Newline comment - d: ddddddddddddd, - // A multi line comment - // between args. - e: eeeeeeeeeeeee /* comment before paren */) - -> bar - where F: Foo, // COmment after where clause - G: Goo // final comment +fn foo( + a: aaaaaaaaaaaaa, // A comment + b: bbbbbbbbbbbbb, // a second comment + c: ccccccccccccc, + // Newline comment + d: ddddddddddddd, + // A multi line comment + // between args. + e: eeeeeeeeeeeee, /* comment before paren */ +) -> bar +where + F: Foo, // COmment after where clause + G: Goo, // final comment { } @@ -20,6 +22,8 @@ fn bar() {} fn baz() -> Baz /* Comment after return type */ {} -fn some_fn() where T: Eq // some comment +fn some_fn() +where + T: Eq, // some comment { } diff --git a/tests/target/configs-array_width-above.rs b/tests/target/configs-array_width-above.rs index 8da896c1549..1265ebe0d8b 100644 --- a/tests/target/configs-array_width-above.rs +++ b/tests/target/configs-array_width-above.rs @@ -2,11 +2,13 @@ // Array width fn main() { - let lorem = vec!["ipsum", - "dolor", - "sit", - "amet", - "consectetur", - "adipiscing", - "elit"]; + let lorem = vec![ + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit", + ]; } diff --git a/tests/target/configs-chain_split_single_child-true.rs b/tests/target/configs-chain_split_single_child-true.rs index 154fa0bfa2e..c417e28d99c 100644 --- a/tests/target/configs-chain_split_single_child-true.rs +++ b/tests/target/configs-chain_split_single_child-true.rs @@ -1,6 +1,7 @@ // rustfmt-chain_split_single_child: true fn main() { - let files = fs::read_dir("tests/source") - .expect("Couldn't read source dir"); + let files = fs::read_dir("tests/source").expect( + "Couldn't read source dir", + ); } diff --git a/tests/target/configs-closure_block_indent_threshold-10.rs b/tests/target/configs-closure_block_indent_threshold-10.rs index 1a0c79ab234..21b47a8d7ca 100644 --- a/tests/target/configs-closure_block_indent_threshold-10.rs +++ b/tests/target/configs-closure_block_indent_threshold-10.rs @@ -3,10 +3,10 @@ fn main() { lorem_ipsum(|| { - println!("lorem"); - println!("ipsum"); - println!("dolor"); - println!("sit"); - println!("amet"); - }); + println!("lorem"); + println!("ipsum"); + println!("dolor"); + println!("sit"); + println!("amet"); + }); } diff --git a/tests/target/configs-fn_args_density-compressed.rs b/tests/target/configs-fn_args_density-compressed.rs index 5a24766d3b9..7bc949e5518 100644 --- a/tests/target/configs-fn_args_density-compressed.rs +++ b/tests/target/configs-fn_args_density-compressed.rs @@ -8,11 +8,15 @@ trait Lorem { // body } - fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, - adipiscing: Adipiscing, elit: Elit); + fn lorem( + ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, + adipiscing: Adipiscing, elit: Elit + ); - fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, - adipiscing: Adipiscing, elit: Elit) { + fn lorem( + ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, + adipiscing: Adipiscing, elit: Elit + ) { // body } } diff --git a/tests/target/configs-fn_args_density-compressed_if_empty.rs b/tests/target/configs-fn_args_density-compressed_if_empty.rs index c2fea2badd6..1a0f127f59c 100644 --- a/tests/target/configs-fn_args_density-compressed_if_empty.rs +++ b/tests/target/configs-fn_args_density-compressed_if_empty.rs @@ -8,25 +8,29 @@ trait Lorem { // body } - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: onsectetur, - adipiscing: Adipiscing, - elit: Elit); + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit, + ); // FIXME: Previous line should be formatted like this: // fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, // adipiscing: Adipiscing, elit: Elit); - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: onsectetur, - adipiscing: Adipiscing, - elit: Elit) { + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit, + ) { // body } } diff --git a/tests/target/configs-fn_args_density-tall.rs b/tests/target/configs-fn_args_density-tall.rs index 856501382f3..6ee43b41a19 100644 --- a/tests/target/configs-fn_args_density-tall.rs +++ b/tests/target/configs-fn_args_density-tall.rs @@ -8,21 +8,25 @@ trait Lorem { // body } - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: onsectetur, - adipiscing: Adipiscing, - elit: Elit); + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit, + ); - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: onsectetur, - adipiscing: Adipiscing, - elit: Elit) { + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit, + ) { // body } } diff --git a/tests/target/configs-fn_args_density-vertical.rs b/tests/target/configs-fn_args_density-vertical.rs index ac4ef01efda..d48b3492452 100644 --- a/tests/target/configs-fn_args_density-vertical.rs +++ b/tests/target/configs-fn_args_density-vertical.rs @@ -2,33 +2,41 @@ // Function arguments density trait Lorem { - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet); + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + ); - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet) { + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + ) { // body } - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: onsectetur, - adipiscing: Adipiscing, - elit: Elit); + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit, + ); - fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: onsectetur, - adipiscing: Adipiscing, - elit: Elit) { + fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit, + ) { // body } } diff --git a/tests/target/configs-fn_args_paren_newline-false.rs b/tests/target/configs-fn_args_paren_newline-false.rs index ad2aec11ea8..031d39014b3 100644 --- a/tests/target/configs-fn_args_paren_newline-false.rs +++ b/tests/target/configs-fn_args_paren_newline-false.rs @@ -5,7 +5,7 @@ fn lorem( ipsum: Ipsum, dolor: Dolor, sit: Sit, - amet: Amet) - -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { + amet: Amet, +) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { // body } diff --git a/tests/target/configs-fn_args_paren_newline-true.rs b/tests/target/configs-fn_args_paren_newline-true.rs index 19b9c342b9c..50e9e6484d8 100644 --- a/tests/target/configs-fn_args_paren_newline-true.rs +++ b/tests/target/configs-fn_args_paren_newline-true.rs @@ -2,10 +2,11 @@ // Function arguments parenthesis on a newline fn lorem - (ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet) - -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { + ( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, +) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { // body } diff --git a/tests/target/configs-fn_brace_style-always_next_line.rs b/tests/target/configs-fn_brace_style-always_next_line.rs index a249cdf87d9..543fc015cba 100644 --- a/tests/target/configs-fn_brace_style-always_next_line.rs +++ b/tests/target/configs-fn_brace_style-always_next_line.rs @@ -12,7 +12,8 @@ fn lorem(ipsum: usize) } fn lorem(ipsum: T) - where T: Add + Sub + Mul + Div +where + T: Add + Sub + Mul + Div, { // body } diff --git a/tests/target/configs-fn_brace_style-prefer_same_line.rs b/tests/target/configs-fn_brace_style-prefer_same_line.rs index 25d05f761e4..498ed9f2a99 100644 --- a/tests/target/configs-fn_brace_style-prefer_same_line.rs +++ b/tests/target/configs-fn_brace_style-prefer_same_line.rs @@ -10,6 +10,7 @@ fn lorem(ipsum: usize) { } fn lorem(ipsum: T) - where T: Add + Sub + Mul + Div { +where + T: Add + Sub + Mul + Div, { // body } diff --git a/tests/target/configs-fn_brace_style-same_line_where.rs b/tests/target/configs-fn_brace_style-same_line_where.rs index 664f256e122..4da07441eaa 100644 --- a/tests/target/configs-fn_brace_style-same_line_where.rs +++ b/tests/target/configs-fn_brace_style-same_line_where.rs @@ -10,7 +10,8 @@ fn lorem(ipsum: usize) { } fn lorem(ipsum: T) - where T: Add + Sub + Mul + Div +where + T: Add + Sub + Mul + Div, { // body } diff --git a/tests/target/configs-fn_call_width-above.rs b/tests/target/configs-fn_call_width-above.rs index 5e763106072..3f84928ed59 100644 --- a/tests/target/configs-fn_call_width-above.rs +++ b/tests/target/configs-fn_call_width-above.rs @@ -2,12 +2,14 @@ // Function call width fn main() { - lorem("lorem", - "ipsum", - "dolor", - "sit", - "amet", - "consectetur", - "adipiscing", - "elit"); + lorem( + "lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit", + ); } diff --git a/tests/target/configs-fn_return_indent-with_args.rs b/tests/target/configs-fn_return_indent-with_args.rs index ab08d0bfe0f..e1d49a65c25 100644 --- a/tests/target/configs-fn_return_indent-with_args.rs +++ b/tests/target/configs-fn_return_indent-with_args.rs @@ -1,14 +1,16 @@ // rustfmt-fn_return_indent: WithArgs // Function return type indent -fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: Consectetur, - adipiscing: Adipiscing) - -> Elit - where Ipsum: Eq +fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: Consectetur, + adipiscing: Adipiscing, +) -> Elit +where + Ipsum: Eq, { // body } diff --git a/tests/target/configs-fn_return_indent-with_where_clause.rs b/tests/target/configs-fn_return_indent-with_where_clause.rs index 279949c982b..62a35af516b 100644 --- a/tests/target/configs-fn_return_indent-with_where_clause.rs +++ b/tests/target/configs-fn_return_indent-with_where_clause.rs @@ -1,14 +1,16 @@ // rustfmt-fn_return_indent: WithWhereClause // Function return type indent -fn lorem(ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - consectetur: Consectetur, - adipiscing: Adipiscing) - -> Elit - where Ipsum: Eq +fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: Consectetur, + adipiscing: Adipiscing, +) -> Elit +where + Ipsum: Eq, { // body } diff --git a/tests/target/configs-generics_indent-block.rs b/tests/target/configs-generics_indent-block.rs index 848e59c7c0a..53175fa362f 100644 --- a/tests/target/configs-generics_indent-block.rs +++ b/tests/target/configs-generics_indent-block.rs @@ -15,7 +15,7 @@ fn lorem< amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, - elit: Elit) - -> T { + elit: Elit, +) -> T { // body } diff --git a/tests/target/configs-generics_indent-visual.rs b/tests/target/configs-generics_indent-visual.rs index 6ae0f775c22..1160772f29f 100644 --- a/tests/target/configs-generics_indent-visual.rs +++ b/tests/target/configs-generics_indent-visual.rs @@ -7,14 +7,14 @@ fn lorem - (ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - adipiscing: Adipiscing, - consectetur: Consectetur, - elit: Elit) - -> T { + Elit: Eq = usize>( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + adipiscing: Adipiscing, + consectetur: Consectetur, + elit: Elit, +) -> T { // body } diff --git a/tests/target/configs-item_brace_style-always_next_line.rs b/tests/target/configs-item_brace_style-always_next_line.rs index 6095149a514..b9334677e1f 100644 --- a/tests/target/configs-item_brace_style-always_next_line.rs +++ b/tests/target/configs-item_brace_style-always_next_line.rs @@ -7,7 +7,8 @@ struct Lorem } struct Dolor - where T: Eq +where + T: Eq, { sit: T, } diff --git a/tests/target/configs-item_brace_style-prefer_same_line.rs b/tests/target/configs-item_brace_style-prefer_same_line.rs index 0b65ecc30c1..3d2e4fd537e 100644 --- a/tests/target/configs-item_brace_style-prefer_same_line.rs +++ b/tests/target/configs-item_brace_style-prefer_same_line.rs @@ -6,6 +6,7 @@ struct Lorem { } struct Dolor - where T: Eq { +where + T: Eq, { sit: T, } diff --git a/tests/target/configs-item_brace_style-same_line_where.rs b/tests/target/configs-item_brace_style-same_line_where.rs index 33d6501f424..21a10cb28a1 100644 --- a/tests/target/configs-item_brace_style-same_line_where.rs +++ b/tests/target/configs-item_brace_style-same_line_where.rs @@ -6,7 +6,8 @@ struct Lorem { } struct Dolor - where T: Eq +where + T: Eq, { sit: T, } diff --git a/tests/target/configs-trailing_comma-never.rs b/tests/target/configs-trailing_comma-never.rs index 949069cede8..f38d26d64db 100644 --- a/tests/target/configs-trailing_comma-never.rs +++ b/tests/target/configs-trailing_comma-never.rs @@ -14,10 +14,11 @@ fn main() { // #1544 if let VrMsg::ClientReply { - request_num: reply_req_num, - value, - .. - } = msg { + request_num: reply_req_num, + value, + .. + } = msg + { let _ = safe_assert_eq!(reply_req_num, request_num, op); return Ok((request_num, op, value)); } diff --git a/tests/target/configs-where_density-compressed.rs b/tests/target/configs-where_density-compressed.rs index d10c860db07..215c10c2d7a 100644 --- a/tests/target/configs-where_density-compressed.rs +++ b/tests/target/configs-where_density-compressed.rs @@ -2,9 +2,14 @@ // Where density trait Lorem { - fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + fn ipsum(dolor: Dolor) -> Sit + where + Dolor: Eq; - fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq { + fn ipsum(dolor: Dolor) -> Sit + where + Dolor: Eq, + { // body } } diff --git a/tests/target/configs-where_density-compressed_if_empty.rs b/tests/target/configs-where_density-compressed_if_empty.rs index 101a1c92575..2a5da551f37 100644 --- a/tests/target/configs-where_density-compressed_if_empty.rs +++ b/tests/target/configs-where_density-compressed_if_empty.rs @@ -2,10 +2,13 @@ // Where density trait Lorem { - fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + fn ipsum(dolor: Dolor) -> Sit + where + Dolor: Eq; fn ipsum(dolor: Dolor) -> Sit - where Dolor: Eq + where + Dolor: Eq, { // body } diff --git a/tests/target/configs-where_density-tall.rs b/tests/target/configs-where_density-tall.rs index cdf84f37f5c..e256f1c221c 100644 --- a/tests/target/configs-where_density-tall.rs +++ b/tests/target/configs-where_density-tall.rs @@ -3,10 +3,12 @@ trait Lorem { fn ipsum(dolor: Dolor) -> Sit - where Dolor: Eq; + where + Dolor: Eq; fn ipsum(dolor: Dolor) -> Sit - where Dolor: Eq + where + Dolor: Eq, { // body } diff --git a/tests/target/configs-where_density-vertical.rs b/tests/target/configs-where_density-vertical.rs index 9fb9837710a..96ac111ba74 100644 --- a/tests/target/configs-where_density-vertical.rs +++ b/tests/target/configs-where_density-vertical.rs @@ -3,10 +3,12 @@ trait Lorem { fn ipsum(dolor: Dolor) -> Sit - where Dolor: Eq; + where + Dolor: Eq; fn ipsum(dolor: Dolor) -> Sit - where Dolor: Eq + where + Dolor: Eq, { // body } diff --git a/tests/target/configs-where_layout-horizontal.rs b/tests/target/configs-where_layout-horizontal.rs index 5778c0c66e5..062f62ff4e7 100644 --- a/tests/target/configs-where_layout-horizontal.rs +++ b/tests/target/configs-where_layout-horizontal.rs @@ -3,13 +3,19 @@ // Where layout fn lorem(ipsum: Ipsum, dolor: Dolor) - where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, { // body } fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) - where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, + Amet: AmetConsecteturAdipiscingElit, { // body } diff --git a/tests/target/configs-where_layout-horizontal_vertical.rs b/tests/target/configs-where_layout-horizontal_vertical.rs index 8906056caa9..56d125e1cf7 100644 --- a/tests/target/configs-where_layout-horizontal_vertical.rs +++ b/tests/target/configs-where_layout-horizontal_vertical.rs @@ -2,16 +2,19 @@ // Where layout fn lorem(ipsum: Ipsum, dolor: Dolor) - where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, { // body } fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) - where Ipsum: IpsumDolorSitAmet, - Dolor: DolorSitAmetConsectetur, - Sit: SitAmetConsecteturAdipiscing, - Amet: AmetConsecteturAdipiscingElit +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, + Amet: AmetConsecteturAdipiscingElit, { // body } diff --git a/tests/target/configs-where_layout-mixed.rs b/tests/target/configs-where_layout-mixed.rs index 636e42ac6ac..fa896b77267 100644 --- a/tests/target/configs-where_layout-mixed.rs +++ b/tests/target/configs-where_layout-mixed.rs @@ -2,14 +2,19 @@ // Where layout fn lorem(ipsum: Ipsum, dolor: Dolor) - where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, { // body } fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) - where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, - Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, + Amet: AmetConsecteturAdipiscingElit, { // body } diff --git a/tests/target/configs-where_layout-vertical.rs b/tests/target/configs-where_layout-vertical.rs index 9efe0cf04b8..024a74dd9ac 100644 --- a/tests/target/configs-where_layout-vertical.rs +++ b/tests/target/configs-where_layout-vertical.rs @@ -2,17 +2,19 @@ // Where layout fn lorem(ipsum: Ipsum, dolor: Dolor) - where Ipsum: IpsumDolorSitAmet, - Dolor: DolorSitAmetConsectetur +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, { // body } fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) - where Ipsum: IpsumDolorSitAmet, - Dolor: DolorSitAmetConsectetur, - Sit: SitAmetConsecteturAdipiscing, - Amet: AmetConsecteturAdipiscingElit +where + Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, + Amet: AmetConsecteturAdipiscingElit, { // body } diff --git a/tests/target/configs-where_pred_indent-block.rs b/tests/target/configs-where_pred_indent-block.rs index 7df9a3e7c22..b880995ccce 100644 --- a/tests/target/configs-where_pred_indent-block.rs +++ b/tests/target/configs-where_pred_indent-block.rs @@ -2,10 +2,11 @@ // Where predicate indent fn lorem() -> T - where Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq +where + Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq, { // body } diff --git a/tests/target/configs-where_pred_indent-visual.rs b/tests/target/configs-where_pred_indent-visual.rs index 5136470372e..11da3a3ba85 100644 --- a/tests/target/configs-where_pred_indent-visual.rs +++ b/tests/target/configs-where_pred_indent-visual.rs @@ -2,10 +2,11 @@ // Where predicate indent fn lorem() -> T - where Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq +where + Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq, { // body } diff --git a/tests/target/enum.rs b/tests/target/enum.rs index 0bb18e2df67..6ff1750ae01 100644 --- a/tests/target/enum.rs +++ b/tests/target/enum.rs @@ -11,7 +11,8 @@ pub enum Test { } pub enum Foo<'a, Y: Baz> - where X: Whatever +where + X: Whatever, { A, } @@ -29,8 +30,10 @@ enum Bar { } enum LongVariants { - First(LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG, // comment - VARIANT), + First( + LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG, // comment + VARIANT + ), // This is the second variant Second, } @@ -47,9 +50,11 @@ enum StructLikeVariants { } enum X { - CreateWebGLPaintTask(Size2D, - GLContextAttributes, - IpcSender, usize), String>>), /* This is a post comment */ + CreateWebGLPaintTask( + Size2D, + GLContextAttributes, + IpcSender, usize), String>> + ), // This is a post comment } pub enum EnumWithAttributes { @@ -79,7 +84,8 @@ pub enum SingleStruct { } pub enum GenericEnum - where I: Iterator +where + I: Iterator, { // Pre Comment Left { list: I, root: T }, // Post-comment @@ -98,7 +104,7 @@ enum TestFormatFails { fn nested_enum_test() { if true { enum TestEnum { - One(usize, + One( usize, usize, usize, @@ -113,8 +119,10 @@ fn nested_enum_test() { usize, usize, usize, - usize), /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAA - * AAAAAAAAAAAAAAAAAAAAAA */ + usize, + usize + ), /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAA + * AAAAAAAAAAAAAAAAAAAAAA */ Two, /* AAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA * AAAAAAAAAAAAAAAAAA */ } @@ -142,9 +150,11 @@ pub enum Bencoding<'i> { // #1261 pub enum CoreResourceMsg { - SetCookieForUrl(ServoUrl, - #[serde(deserialize_with = "::hyper_serde::deserialize", - serialize_with = "::hyper_serde::serialize")] - Cookie, - CookieSource), + SetCookieForUrl( + ServoUrl, + #[serde(deserialize_with = "::hyper_serde::deserialize", + serialize_with = "::hyper_serde::serialize")] + Cookie, + CookieSource + ), } diff --git a/tests/target/expr.rs b/tests/target/expr.rs index 5cd5452fd27..3932992af62 100644 --- a/tests/target/expr.rs +++ b/tests/target/expr.rs @@ -7,23 +7,21 @@ fn foo() -> bool { let referenced = &5; let very_long_variable_name = (a + first + simple + test); - let very_long_variable_name = (a + first + simple + test + AAAAAAAAAAAAA + - BBBBBBBBBBBBBBBBB + b + c); + let very_long_variable_name = + (a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB + b + c); let is_internalxxxx = self.codemap.span_to_filename(s) == - self.codemap.span_to_filename(m.inner); + self.codemap.span_to_filename(m.inner); let some_val = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbb / - (bbbbbb - function_call(x, *very_long_pointer, y)) + 1000; + (bbbbbb - function_call(x, *very_long_pointer, y)) + 1000; - some_ridiculously_loooooooooooooooooooooong_function(10000 * 30000000000 + - 40000 / 1002200000000 - - 50000 * sqrt(-1), - trivial_value); - (((((((((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - a + - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - aaaaa))))))))); + some_ridiculously_loooooooooooooooooooooong_function( + 10000 * 30000000000 + 40000 / 1002200000000 - 50000 * sqrt(-1), + trivial_value, + ); + (((((((((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + a + + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaa))))))))) ; { for _ in 0..10 {} @@ -49,18 +47,22 @@ fn foo() -> bool { } if let Some(x) = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {} + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) + {} if let (some_very_large, - tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 { + tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 + { } if let (some_very_large, - tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = - 1111 + 2222 {} + tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = + 1111 + 2222 + {} if let (some_very_large, - tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 {} + tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 + {} let test = if true { 5 } else { 3 }; @@ -71,13 +73,13 @@ fn foo() -> bool { } else { // Check subformatting aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa } } fn bar() { let range = (111111111 + 333333333333333333 + 1111 + 400000000000000000).. - (2222 + 2333333333333333); + (2222 + 2333333333333333); let another_range = 5..some_func(a, b /* comment */); @@ -85,10 +87,12 @@ fn bar() { call_forever(); } - syntactically_correct(loop { - sup('?'); - }, - if cond { 0 } else { 1 }); + syntactically_correct( + loop { + sup('?'); + }, + if cond { 0 } else { 1 }, + ); let third = ..10; let infi_range = ..; @@ -102,8 +106,10 @@ fn bar() { } } - let x = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, - a); + let x = ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + a, + ); } fn baz() { @@ -144,8 +150,8 @@ fn qux() { fn issue227() { { - let handler = box DocumentProgressHandler::new(addr, - DocumentProgressTask::DOMContentLoaded); + let handler = + box DocumentProgressHandler::new(addr, DocumentProgressTask::DOMContentLoaded); } } @@ -158,59 +164,104 @@ fn issue184(source: &str) { } fn arrays() { - let x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 7, 8, 9, 0, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 0]; + let x = [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + 7, + 8, + 9, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 0, + ]; - let y = [// comment - 1, - 2, // post comment - 3]; + let y = [ + // comment + 1, + 2, // post comment + 3, + ]; - let xy = [strukt { - test123: value_one_two_three_four, - turbo: coolio(), - }, - // comment - 1]; + let xy = [ + strukt { + test123: value_one_two_three_four, + turbo: coolio(), + }, + // comment + 1, + ]; - let a = WeightedChoice::new(&mut [Weighted { - weightweight: x, - item: 0, - }, - Weighted { - weightweight: 1, - item: 1, - }, - Weighted { - weightweight: x, - item: 2, - }, - Weighted { - weightweight: 1, - item: 3, - }]); + let a = WeightedChoice::new( + &mut [ + Weighted { + weightweight: x, + item: 0, + }, + Weighted { + weightweight: 1, + item: 1, + }, + Weighted { + weightweight: x, + item: 2, + }, + Weighted { + weightweight: 1, + item: 3, + }, + ], + ); - let z = [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - yyyyyyyyyyyyyyyyyyyyyyyyyyy, - zzzzzzzzzzzzzzzzzz, - q]; + let z = [ + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + yyyyyyyyyyyyyyyyyyyyyyyyyyy, + zzzzzzzzzzzzzzzzzz, + q, + ]; [1 + 3, 4, 5, 6, 7, 7, fncall::>(3 - 1)] } fn returns() { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && - return; + return; return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; } fn addrof() { &mut (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); &(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); } fn casts() { @@ -220,7 +271,7 @@ fn casts() { let some_trait_xxx = xxxxxxxxxxx + xxxxxxxxxxxxx as SomeTraitXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; let slightly_longer_trait = yyyyyyyyy + - yyyyyyyyyyy as SomeTraitYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY; + yyyyyyyyyyy as SomeTraitYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY; } fn indices() { @@ -232,9 +283,9 @@ fn indices() { fn repeats() { let x = [aaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccc; - x + y + z]; + x + y + z]; let y = [aaaaaaaaaaaaaaaaaaaaaaaaaaaa + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + cccccccccccccccc; - xxxxx + yyyyy + zzzzz]; + xxxxx + yyyyy + zzzzz]; } fn blocks() { @@ -257,7 +308,7 @@ fn issue767() { fn ranges() { let x = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; let y = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; let z = ...x; a...b @@ -279,10 +330,12 @@ fn complex_if_else() { } else if xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxx { yo(); } else if let Some(x) = - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx { + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + { ha(); } else if xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + - xxxxxxxxx { + xxxxxxxxx + { yo(); } } @@ -290,10 +343,12 @@ fn complex_if_else() { fn issue1106() { { if let hir::ItemEnum(ref enum_def, ref generics) = - self.ast_map.expect_item(enum_node_id).node {} + self.ast_map.expect_item(enum_node_id).node + {} } - for entry in WalkDir::new(path) - .into_iter() - .filter_entry(|entry| exclusions.filter_entry(entry)) {} + for entry in WalkDir::new(path).into_iter().filter_entry(|entry| { + exclusions.filter_entry(entry) + }) + {} } diff --git a/tests/target/extern.rs b/tests/target/extern.rs index 06d9d771e79..efee6ab26bf 100644 --- a/tests/target/extern.rs +++ b/tests/target/extern.rs @@ -3,8 +3,10 @@ extern "C" { fn c_func(x: *mut *mut libc::c_void); - fn c_func(x: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, - y: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY); + fn c_func( + x: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, + y: YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY, + ); #[test123] fn foo() -> uint64_t; @@ -13,12 +15,13 @@ extern "C" { } extern "C" { - fn DMR_GetDevice(pHDev: *mut HDEV, - searchMode: DeviceSearchMode, - pSearchString: *const c_char, - devNr: c_uint, - wildcard: c_char) - -> TDMR_ERROR; + fn DMR_GetDevice( + pHDev: *mut HDEV, + searchMode: DeviceSearchMode, + pSearchString: *const c_char, + devNr: c_uint, + wildcard: c_char, + ) -> TDMR_ERROR; fn quux() -> (); // Post comment } @@ -30,21 +33,23 @@ extern "Rust" { } extern "C" { - fn syscall(number: libc::c_long, // comment 1 - // comm 2 - ... /* sup? */) - -> libc::c_long; + fn syscall( + number: libc::c_long, // comment 1 + // comm 2 + ... // sup? + ) -> libc::c_long; fn foo(x: *const c_char, ...) -> libc::c_long; } extern "C" { - pub fn freopen(filename: *const c_char, - mode: *const c_char, - mode2: *const c_char, - mode3: *const c_char, - file: *mut FILE) - -> *mut FILE; + pub fn freopen( + filename: *const c_char, + mode: *const c_char, + mode2: *const c_char, + mode3: *const c_char, + file: *mut FILE, + ) -> *mut FILE; } extern "C" {} diff --git a/tests/target/fn-args-with-last-line-comment.rs b/tests/target/fn-args-with-last-line-comment.rs index 2e310747cc4..2ffb3909b74 100644 --- a/tests/target/fn-args-with-last-line-comment.rs +++ b/tests/target/fn-args-with-last-line-comment.rs @@ -1,22 +1,24 @@ // #1587 pub trait X { fn a(&self) -> &'static str; - fn bcd(&self, - c: &str, // comment on this arg - d: u16, // comment on this arg - e: &Vec, // comment on this arg - ) -> Box; + fn bcd( + &self, + c: &str, // comment on this arg + d: u16, // comment on this arg + e: &Vec, // comment on this arg + ) -> Box; } // #1595 -fn foo(arg1: LongTypeName, - arg2: LongTypeName, - arg3: LongTypeName, - arg4: LongTypeName, - arg5: LongTypeName, - arg6: LongTypeName, - arg7: LongTypeName, +fn foo( + arg1: LongTypeName, + arg2: LongTypeName, + arg3: LongTypeName, + arg4: LongTypeName, + arg5: LongTypeName, + arg6: LongTypeName, + arg7: LongTypeName, //arg8: LongTypeName, - ) { +) { // do stuff } diff --git a/tests/target/fn-custom-2.rs b/tests/target/fn-custom-2.rs index f0923bd1a85..430ffeb9fb7 100644 --- a/tests/target/fn-custom-2.rs +++ b/tests/target/fn-custom-2.rs @@ -24,14 +24,18 @@ fn bar< } fn baz() - where X: TTTTTTTT +where + X: TTTTTTTT, { baz(); } fn qux() - where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT +where + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, { baz(); } @@ -59,7 +63,8 @@ impl Foo { } fn baz() - where X: TTTTTTTT + where + X: TTTTTTTT, { baz(); } diff --git a/tests/target/fn-custom-3.rs b/tests/target/fn-custom-3.rs index 4d26c9b6951..655f1f1dc5b 100644 --- a/tests/target/fn-custom-3.rs +++ b/tests/target/fn-custom-3.rs @@ -24,16 +24,19 @@ fn bar< } fn qux() - where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT +where + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, { baz(); } fn qux() - where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT +where + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, { baz(); } diff --git a/tests/target/fn-custom-4.rs b/tests/target/fn-custom-4.rs index d2ba91b7632..c044becc782 100644 --- a/tests/target/fn-custom-4.rs +++ b/tests/target/fn-custom-4.rs @@ -3,21 +3,26 @@ // Test different indents. fn qux() - where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT +where + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, { baz(); } -fn qux() where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT { +fn qux() +where + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, +{ baz(); } fn qux(a: Aaaaaaaaaaaaaaaaa) - where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, - X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT +where + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, + X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, { baz(); } diff --git a/tests/target/fn-custom-6.rs b/tests/target/fn-custom-6.rs index 487d1d8b7ea..9a2d8d8981a 100644 --- a/tests/target/fn-custom-6.rs +++ b/tests/target/fn-custom-6.rs @@ -31,7 +31,8 @@ fn bar( } fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) - where T: UUUUUUUUUUU { +where + T: UUUUUUUUUUU, { foo(); } @@ -41,12 +42,14 @@ fn bar( c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee, -) where T: UUUUUUUUUUU { +) where + T: UUUUUUUUUUU, { bar(); } fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> String - where T: UUUUUUUUUUU { +where + T: UUUUUUUUUUU, { foo(); } @@ -57,7 +60,8 @@ fn bar( d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee, ) -> String - where T: UUUUUUUUUUU { +where + T: UUUUUUUUUUU, { bar(); } diff --git a/tests/target/fn-custom-8.rs b/tests/target/fn-custom-8.rs index b32fc5d7cf2..854f4231480 100644 --- a/tests/target/fn-custom-8.rs +++ b/tests/target/fn-custom-8.rs @@ -31,7 +31,8 @@ fn bar( } fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) - where T: UUUUUUUUUUU { +where + T: UUUUUUUUUUU, { foo(); } @@ -41,12 +42,14 @@ fn bar( c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee, -) where T: UUUUUUUUUUU { +) where + T: UUUUUUUUUUU, { bar(); } fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> String - where T: UUUUUUUUUUU { +where + T: UUUUUUUUUUU, { foo(); } @@ -57,7 +60,8 @@ fn bar( d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee, ) -> String - where T: UUUUUUUUUUU { +where + T: UUUUUUUUUUU, { bar(); } @@ -67,7 +71,8 @@ trait Test { fn bar(a: u8) -> String {} fn bar(a: u8) -> String - where Foo: foooo, - Bar: barrr { + where + Foo: foooo, + Bar: barrr, { } } diff --git a/tests/target/fn-custom.rs b/tests/target/fn-custom.rs index ad36de7a997..7a2ea722bfd 100644 --- a/tests/target/fn-custom.rs +++ b/tests/target/fn-custom.rs @@ -2,14 +2,18 @@ // Test some of the ways function signatures can be customised. // Test compressed layout of args. -fn foo(a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, - d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee) { +fn foo( + a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, d: Ddddddddddddddddddddddddd, + e: Eeeeeeeeeeeeeeeeeee +) { foo(); } impl Foo { - fn foo(self, a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, - d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee) { + fn foo( + self, a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, + d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee + ) { foo(); } } diff --git a/tests/target/fn-simple.rs b/tests/target/fn-simple.rs index 697fe21501c..d0c15c643f5 100644 --- a/tests/target/fn-simple.rs +++ b/tests/target/fn-simple.rs @@ -1,77 +1,88 @@ // rustfmt-normalize_comments: true -fn simple(// pre-comment on a function!? - i: i32, // yes, it's possible! - response: NoWay /* hose */) { - fn op(x: Typ, - key: &[u8], - upd: Box) - -> (memcache::Status, Result>)>) - -> MapResult { +fn simple( + // pre-comment on a function!? + i: i32, // yes, it's possible! + response: NoWay, // hose +) { + fn op( + x: Typ, + key: &[u8], + upd: Box) + -> (memcache::Status, Result>)>, + ) -> MapResult { } "cool" } -fn weird_comment(// /*/ double level */ comment - x: Hello, // /*/* tripple, even */*/ - // Does this work? - y: World) { - simple(// does this preserve comments now? - 42, - NoWay) +fn weird_comment( + // /*/ double level */ comment + x: Hello, // /*/* tripple, even */*/ + // Does this work? + y: World, +) { + simple( + // does this preserve comments now? + 42, + NoWay, + ) } fn generic(arg: T) -> &SomeType - where T: Fn(// First arg - A, - // Second argument - B, - C, - D, - // pre comment - E /* last comment */) - -> &SomeType +where + T: Fn(// First arg + A, + // Second argument + B, + C, + D, + // pre comment + E /* last comment */) + -> &SomeType, { arg(a, b, c, d, e) } fn foo() -> ! {} -pub fn http_fetch_async(listener: Box, - script_chan: Box) { +pub fn http_fetch_async( + listener: Box, + script_chan: Box, +) { } fn some_func>(val: T) {} -fn zzzzzzzzzzzzzzzzzzzz(selff: Type, - mut handle: node::Handle>, - Type, - NodeType>) - -> SearchStack<'a, K, V, Type, NodeType> { +fn zzzzzzzzzzzzzzzzzzzz( + selff: Type, + mut handle: node::Handle>, Type, NodeType>, +) -> SearchStack<'a, K, V, Type, NodeType> { } -unsafe fn generic_call(cx: *mut JSContext, - argc: libc::c_uint, - vp: *mut JSVal, - is_lenient: bool, - call: unsafe extern "C" fn(*const JSJitInfo, - *mut JSContext, - HandleObject, - *mut libc::c_void, - u32, - *mut JSVal) - -> u8) { +unsafe fn generic_call( + cx: *mut JSContext, + argc: libc::c_uint, + vp: *mut JSVal, + is_lenient: bool, + call: unsafe extern "C" fn(*const JSJitInfo, + *mut JSContext, + HandleObject, + *mut libc::c_void, + u32, + *mut JSVal) + -> u8, +) { let f: fn(_, _) -> _ = panic!(); } -pub fn start_export_thread - (database: &Database, - crypto_scheme: &C, - block_size: usize, - source_path: &Path) - -> BonzoResult> { +pub fn start_export_thread( + database: &Database, + crypto_scheme: &C, + block_size: usize, + source_path: &Path, +) -> BonzoResult> { } pub fn waltz(cwd: &Path) -> CliAssert { diff --git a/tests/target/fn-single-line.rs b/tests/target/fn-single-line.rs index 049206b60c8..3617506d89a 100644 --- a/tests/target/fn-single-line.rs +++ b/tests/target/fn-single-line.rs @@ -14,7 +14,8 @@ fn empty() {} fn foo_return() -> String { "yay" } fn foo_where() -> T - where T: Sync +where + T: Sync, { let x = 2; } @@ -62,4 +63,8 @@ trait CoolerTypes { fn dummy(&self) {} } -fn Foo() where T: Bar {} +fn Foo() +where + T: Bar, +{ +} diff --git a/tests/target/fn-ty.rs b/tests/target/fn-ty.rs index 7432fcded34..7d48f3b32db 100644 --- a/tests/target/fn-ty.rs +++ b/tests/target/fn-ty.rs @@ -1,12 +1,14 @@ -fn f(xxxxxxxxxxxxxxxxxx: fn(a, b, b) -> a, - xxxxxxxxxxxxxxxxxx: fn() -> a, - xxxxxxxxxxxxxxxxxx: fn(a, b, b), - xxxxxxxxxxxxxxxxxx: fn(), - xxxxxxxxxxxxxxxxxx: fn(a, b, b) -> !, - xxxxxxxxxxxxxxxxxx: fn() -> !) - where F1: Fn(a, b, b) -> a, - F2: Fn(a, b, b), - F3: Fn(), - F4: Fn() -> u32 +fn f( + xxxxxxxxxxxxxxxxxx: fn(a, b, b) -> a, + xxxxxxxxxxxxxxxxxx: fn() -> a, + xxxxxxxxxxxxxxxxxx: fn(a, b, b), + xxxxxxxxxxxxxxxxxx: fn(), + xxxxxxxxxxxxxxxxxx: fn(a, b, b) -> !, + xxxxxxxxxxxxxxxxxx: fn() -> !, +) where + F1: Fn(a, b, b) -> a, + F2: Fn(a, b, b), + F3: Fn(), + F4: Fn() -> u32, { } diff --git a/tests/target/fn.rs b/tests/target/fn.rs index 01806ac3cd8..7a09ec6e83c 100644 --- a/tests/target/fn.rs +++ b/tests/target/fn.rs @@ -2,24 +2,36 @@ fn foo(a: AAAA, b: BBB, c: CCC) -> RetType {} -fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType where T: Blah {} +fn foo(a: AAAA, b: BBB /* some, weird, inline comment */, c: CCC) -> RetType +where + T: Blah, +{ +} -fn foo(a: AAA /* (comment) */) where T: Blah {} +fn foo(a: AAA /* (comment) */) +where + T: Blah, +{ +} -fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, - b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) - -> RetType - where T: Blah +fn foo( + a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, + b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, +) -> RetType +where + T: Blah, { } -fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, - b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) - -> RetType - where T: Blah, - U: dsfasdfasdfasd +fn foo( + a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, + b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, +) -> RetType +where + T: Blah, + U: dsfasdfasdfasd, { } @@ -27,21 +39,27 @@ fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, fn foo B /* paren inside generics */>() {} impl Foo { - fn with_no_errors(&mut self, f: F) -> T where F: FnOnce(&mut Resolver) -> T {} + fn with_no_errors(&mut self, f: F) -> T + where + F: FnOnce(&mut Resolver) -> T, + { + } fn foo(mut self, mut bar: u32) {} fn bar(self, mut bazz: u32) {} } -pub fn render<'a, - N: Clone + 'a, - E: Clone + 'a, - G: Labeller<'a, N, E> + GraphWalk<'a, N, E>, - W: Write> - (g: &'a G, - w: &mut W) - -> io::Result<()> { +pub fn render< + 'a, + N: Clone + 'a, + E: Clone + 'a, + G: Labeller<'a, N, E> + GraphWalk<'a, N, E>, + W: Write +>( + g: &'a G, + w: &mut W, +) -> io::Result<()> { render_opts(g, w, &[]) } @@ -81,23 +99,23 @@ fn foo(a: i32) -> i32 { if a > 0 { 1 } else { 2 } } -fn ______________________baz - (a: i32) - -> *mut ::std::option::Option ()> { +fn ______________________baz( + a: i32, +) -> *mut ::std::option::Option ()> { } -pub fn check_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - path: &hir::Path, - id: ast::NodeId, - cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option)) { +pub fn check_path<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + path: &hir::Path, + id: ast::NodeId, + cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option), +) { } -pub fn check_path<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - path: &hir::Path, - id: ast::NodeId, - cb: &mut FnMut(DefId, - Span, - &Option<&Stability>, - &Option)) { +pub fn check_path<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + path: &hir::Path, + id: ast::NodeId, + cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option), +) { } diff --git a/tests/target/fn_args_density-vertical.rs b/tests/target/fn_args_density-vertical.rs index 250d32654e5..dcc8478a138 100644 --- a/tests/target/fn_args_density-vertical.rs +++ b/tests/target/fn_args_density-vertical.rs @@ -11,12 +11,13 @@ fn do_bar(a: u8) -> u8 { } // Multiple arguments should each get their own line. -fn do_bar(a: u8, - mut b: u8, - c: &u8, - d: &mut u8, - closure: &Fn(i32) -> i32) - -> i32 { +fn do_bar( + a: u8, + mut b: u8, + c: &u8, + d: &mut u8, + closure: &Fn(i32) -> i32, +) -> i32 { // This feature should not affect closures. let bar = |x: i32, y: i32| -> i32 { x + y }; bar(a, b) @@ -26,10 +27,12 @@ fn do_bar(a: u8, // the whole list should probably be pushed to the next line with hanging // indent. That's not what happens though, so check current behaviour instead. // In any case, it should maintain single argument per line. -fn do_this_that_and_the_other_thing(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: u8, - b: u8, - c: u8, - d: u8) { +fn do_this_that_and_the_other_thing( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: u8, + b: u8, + c: u8, + d: u8, +) { this(); that(); the_other_thing(); diff --git a/tests/target/fn_args_layout-block.rs b/tests/target/fn_args_layout-block.rs index 27a98cfe7f9..93f14c526bd 100644 --- a/tests/target/fn_args_layout-block.rs +++ b/tests/target/fn_args_layout-block.rs @@ -54,8 +54,9 @@ fn bar( d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee, ) -> String - where X: Fooooo, - Y: Baaar +where + X: Fooooo, + Y: Baaar, { bar(); } @@ -65,22 +66,27 @@ fn foo() -> T { } fn foo() -> T - where X: Foooo, - Y: Baaar +where + X: Foooo, + Y: Baaar, { foo(); } -fn foo() where X: Foooo {} - fn foo() - where X: Foooo, - Y: Baaar +where + X: Foooo, { } -fn foo - () +fn foo() +where + X: Foooo, + Y: Baaar, +{ +} + +fn foo() -> (Loooooooooooooooooooooong, Reeeeeeeeeeeeeeeeeeeeeeeeturn, iiiiiiiiis, Looooooooooooooooong) { foo(); @@ -90,8 +96,7 @@ fn foo() { foo(); } -fn foo - () { +fn foo() { foo(); } diff --git a/tests/target/hard-tabs.rs b/tests/target/hard-tabs.rs index bdd07ffbd74..2781d54af88 100644 --- a/tests/target/hard-tabs.rs +++ b/tests/target/hard-tabs.rs @@ -22,7 +22,8 @@ fn main() { let str = "AAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAa"; if let (some_very_large, - tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 {} + tuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuple) = 1 + 2 + 3 + {} if cond() { something(); @@ -30,7 +31,7 @@ fn main() { something_else(); } else { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa } unsafe /* very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong @@ -47,21 +48,24 @@ fn main() { .go_to_next_line_with_tab() .go_to_next_line_with_tab(); - let z = [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - yyyyyyyyyyyyyyyyyyyyyyyyyyy, - zzzzzzzzzzzzzzzzzz, - q]; + let z = [ + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + yyyyyyyyyyyyyyyyyyyyyyyyyyy, + zzzzzzzzzzzzzzzzzz, + q, + ]; fn generic(arg: T) -> &SomeType - where T: Fn(// First arg - A, - // Second argument - B, - C, - D, - // pre comment - E /* last comment */) - -> &SomeType + where + T: Fn(// First arg + A, + // Second argument + B, + C, + D, + // pre comment + E /* last comment */) + -> &SomeType, { arg(a, b, c, d, e) } diff --git a/tests/target/impl.rs b/tests/target/impl.rs index c51693afd22..528d80fd5a5 100644 --- a/tests/target/impl.rs +++ b/tests/target/impl.rs @@ -7,7 +7,8 @@ impl>> Handle Test - where V: Clone // This comment is NOT removed by formating! +where + V: Clone, // This comment is NOT removed by formating! { pub fn new(value: V) -> Self { Test { diff --git a/tests/target/impls.rs b/tests/target/impls.rs index 654d4be8967..216c9d5193d 100644 --- a/tests/target/impls.rs +++ b/tests/target/impls.rs @@ -22,7 +22,8 @@ pub impl Foo for Bar { } pub unsafe impl<'a, 'b, X, Y: Foo> !Foo<'a, X> for Bar<'b, Y> - where X: Foo<'a, Z> +where + X: Foo<'a, Z>, { fn foo() { "hi" @@ -30,7 +31,8 @@ pub unsafe impl<'a, 'b, X, Y: Foo> !Foo<'a, X> for Bar<'b, Y> } impl<'a, 'b, X, Y: Foo> Foo<'a, X> for Bar<'b, Y> - where X: Fooooooooooooooooooooooooooooo<'a, Z> +where + X: Fooooooooooooooooooooooooooooo<'a, Z>, { fn foo() { "hi" @@ -38,17 +40,23 @@ impl<'a, 'b, X, Y: Foo> Foo<'a, X> for Bar<'b, Y> } impl<'a, 'b, X, Y: Foo> Foo<'a, X> for Bar<'b, Y> - where X: Foooooooooooooooooooooooooooo<'a, Z> +where + X: Foooooooooooooooooooooooooooo<'a, Z>, { fn foo() { "hi" } } -impl Foo for Bar where T: Baz {} - impl Foo for Bar - where T: Baz +where + T: Baz, +{ +} + +impl Foo for Bar +where + T: Baz, { // Comment } @@ -101,7 +109,8 @@ impl Y5000 { } pub impl Foo for Bar - where T: Foo +where + T: Foo, { fn foo() { "hi" @@ -109,21 +118,27 @@ pub impl Foo for Bar } pub impl Foo for Bar - where T: Foo, - Z: Baz +where + T: Foo, + Z: Baz, { } mod m { impl PartialEq for S - where T: PartialEq + where + T: PartialEq, { fn eq(&self, other: &Self) { true } } - impl PartialEq for S where T: PartialEq {} + impl PartialEq for S + where + T: PartialEq, + { + } } impl @@ -136,10 +151,11 @@ impl PartialEq mod x { impl Foo - where A: 'static, - B: 'static, - C: 'static, - D: 'static + where + A: 'static, + B: 'static, + C: 'static, + D: 'static, { } } diff --git a/tests/target/issue-1049.rs b/tests/target/issue-1049.rs index 020ac6ff0d9..416db998065 100644 --- a/tests/target/issue-1049.rs +++ b/tests/target/issue-1049.rs @@ -1,15 +1,18 @@ // Test overlong function signature -pub unsafe fn reborrow_mut(&mut X: Abcde) - -> Handle, HandleType> { +pub unsafe fn reborrow_mut( + &mut X: Abcde, +) -> Handle, HandleType> { } -pub fn merge(mut X: Abcdef) - -> Handle, K, V, marker::Internal>, marker::Edge> { +pub fn merge( + mut X: Abcdef, +) -> Handle, K, V, marker::Internal>, marker::Edge> { } impl Handle { - pub fn merge(a: Abcd) - -> Handle, K, V, marker::Internal>, marker::Edge> { + pub fn merge( + a: Abcd, + ) -> Handle, K, V, marker::Internal>, marker::Edge> { } } @@ -19,6 +22,8 @@ fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeee fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) { } -fn veeeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, - b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) { +fn veeeeeeeeeeeeeeeeeeeeeeery_long_name( + a: FirstTypeeeeeeeeee, + b: SecondTypeeeeeeeeeeeeeeeeeeeeeee, +) { } diff --git a/tests/target/issue-1239.rs b/tests/target/issue-1239.rs index c8da3573e95..8db0d195ae6 100644 --- a/tests/target/issue-1239.rs +++ b/tests/target/issue-1239.rs @@ -1,9 +1,11 @@ fn foo() { let with_alignment = if condition__uses_alignment_for_first_if__0 || - condition__uses_alignment_for_first_if__1 || - condition__uses_alignment_for_first_if__2 { + condition__uses_alignment_for_first_if__1 || + condition__uses_alignment_for_first_if__2 + { } else if condition__no_alignment_for_later_else__0 || - condition__no_alignment_for_later_else__1 || - condition__no_alignment_for_later_else__2 { + condition__no_alignment_for_later_else__1 || + condition__no_alignment_for_later_else__2 + { }; } diff --git a/tests/target/issue-1247.rs b/tests/target/issue-1247.rs index 427a8076ad5..16c63e0f53d 100644 --- a/tests/target/issue-1247.rs +++ b/tests/target/issue-1247.rs @@ -1,7 +1,8 @@ // rustfmt-max_width: 80 fn foo() { - polyfill::slice::fill(&mut self.pending[padding_pos.. - (self.algorithm.block_len - 8)], - 0); + polyfill::slice::fill( + &mut self.pending[padding_pos..(self.algorithm.block_len - 8)], + 0, + ); } diff --git a/tests/target/issue-1366.rs b/tests/target/issue-1366.rs index 927aabc5018..eee147baab9 100644 --- a/tests/target/issue-1366.rs +++ b/tests/target/issue-1366.rs @@ -4,10 +4,10 @@ fn main() { .map(|s| s) .map(|s| s.to_string()) .map(|res| match Some(res) { - Some(ref s) if s == "" => 41, - Some(_) => 42, - _ => 43, - }) + Some(ref s) if s == "" => 41, + Some(_) => 42, + _ => 43, + }) } println!("{:?}", f()) } diff --git a/tests/target/issue-1397.rs b/tests/target/issue-1397.rs index d8cacd61b58..f267a91d3e1 100644 --- a/tests/target/issue-1397.rs +++ b/tests/target/issue-1397.rs @@ -12,8 +12,9 @@ fn baz(p: Packet) { loop { loop { if let Packet::Transaction { - state: TransactionState::Committed(ts, ..), .. - } = p { + state: TransactionState::Committed(ts, ..), .. + } = p + { unreachable!() } } diff --git a/tests/target/issue-1468.rs b/tests/target/issue-1468.rs index 518c31b625c..e10c83d45ac 100644 --- a/tests/target/issue-1468.rs +++ b/tests/target/issue-1468.rs @@ -1,27 +1,29 @@ fn issue1468() { euc_jp_decoder_functions!({ - let trail_minus_offset = byte.wrapping_sub(0xA1); - // Fast-track Hiragana (60% according to Lunde) - // and Katakana (10% acconding to Lunde). - if jis0208_lead_minus_offset == 0x03 && - trail_minus_offset < 0x53 { - // Hiragana - handle.write_upper_bmp(0x3041 + trail_minus_offset as u16) - } else if jis0208_lead_minus_offset == 0x04 && - trail_minus_offset < 0x56 { - // Katakana - handle.write_upper_bmp(0x30A1 + trail_minus_offset as u16) - } else if trail_minus_offset > (0xFE - 0xA1) { - if byte < 0x80 { - return (DecoderResult::Malformed(1, 0), - unread_handle_trail.unread(), - handle.written()); - } - return (DecoderResult::Malformed(2, 0), - unread_handle_trail.consumed(), - handle.written()); - } else { - unreachable!(); - } - }); + let trail_minus_offset = byte.wrapping_sub(0xA1); + // Fast-track Hiragana (60% according to Lunde) + // and Katakana (10% acconding to Lunde). + if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 { + // Hiragana + handle.write_upper_bmp(0x3041 + trail_minus_offset as u16) + } else if jis0208_lead_minus_offset == 0x04 && trail_minus_offset < 0x56 { + // Katakana + handle.write_upper_bmp(0x30A1 + trail_minus_offset as u16) + } else if trail_minus_offset > (0xFE - 0xA1) { + if byte < 0x80 { + return ( + DecoderResult::Malformed(1, 0), + unread_handle_trail.unread(), + handle.written(), + ); + } + return ( + DecoderResult::Malformed(2, 0), + unread_handle_trail.consumed(), + handle.written(), + ); + } else { + unreachable!(); + } + }); } diff --git a/tests/target/issue-510.rs b/tests/target/issue-510.rs index 21dca794e93..27eeacaa08a 100644 --- a/tests/target/issue-510.rs +++ b/tests/target/issue-510.rs @@ -1,12 +1,15 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced { - fn solve_inline_size_constraints(&self, - block: &mut BlockFlow, - input: &ISizeConstraintInput) - -> ISizeConstraintSolution { + fn solve_inline_size_constraints( + &self, + block: &mut BlockFlow, + input: &ISizeConstraintInput, + ) -> ISizeConstraintSolution { let (inline_start, inline_size, margin_inline_start, margin_inline_end) = - match (inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx, - inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx) { + match ( + inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx, + inline_startssssssxxxxxxsssssxxxxxxxxxssssssxxx, + ) { (MaybeAuto::Auto, MaybeAuto::Auto, MaybeAuto::Auto) => { let margin_start = inline_start_margin.specified_or_zero(); let margin_end = inline_end_margin.specified_or_zero(); @@ -14,9 +17,9 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced { // and inline-size Auto. // // Set inline-end to zero to calculate inline-size. - let inline_size = - block.get_shrink_to_fit_inline_size(available_inline_size - - (margin_start + margin_end)); + let inline_size = block.get_shrink_to_fit_inline_size( + available_inline_size - (margin_start + margin_end), + ); (Au(0), inline_size, margin_start, margin_end) } }; @@ -30,9 +33,9 @@ impl ISizeAndMarginsComputer for AbsoluteNonReplaced { // and inline-size Auto. // // Set inline-end to zero to calculate inline-size. - let inline_size = - block.get_shrink_to_fit_inline_size(available_inline_size - - (margin_start + margin_end)); + let inline_size = block.get_shrink_to_fit_inline_size( + available_inline_size - (margin_start + margin_end), + ); (Au(0), inline_size, margin_start, margin_end) } }; diff --git a/tests/target/item-brace-style-always-next-line.rs b/tests/target/item-brace-style-always-next-line.rs index 48dcebc0263..0c0f2163102 100644 --- a/tests/target/item-brace-style-always-next-line.rs +++ b/tests/target/item-brace-style-always-next-line.rs @@ -17,21 +17,25 @@ mod M { struct D {} enum A - where T: Copy + where + T: Copy, { A, } struct B - where T: Copy + where + T: Copy, { b: i32, } // For empty enums and structs, the brace remains on the same line. enum C - where T: Copy {} + where + T: Copy, {} struct D - where T: Copy {} + where + T: Copy, {} } diff --git a/tests/target/item-brace-style-prefer-same-line.rs b/tests/target/item-brace-style-prefer-same-line.rs index b38bd2e1a19..bb090479cab 100644 --- a/tests/target/item-brace-style-prefer-same-line.rs +++ b/tests/target/item-brace-style-prefer-same-line.rs @@ -14,18 +14,22 @@ mod M { struct D {} enum A - where T: Copy { + where + T: Copy, { A, } struct B - where T: Copy { + where + T: Copy, { b: i32, } enum C - where T: Copy {} + where + T: Copy, {} struct D - where T: Copy {} + where + T: Copy, {} } diff --git a/tests/target/item-brace-style-same-line-where.rs b/tests/target/item-brace-style-same-line-where.rs index cdcd813fda4..54ad69de42a 100644 --- a/tests/target/item-brace-style-same-line-where.rs +++ b/tests/target/item-brace-style-same-line-where.rs @@ -15,21 +15,25 @@ mod M { struct D {} enum A - where T: Copy + where + T: Copy, { A, } struct B - where T: Copy + where + T: Copy, { b: i32, } // For empty enums and structs, the brace remains on the same line. enum C - where T: Copy {} + where + T: Copy, {} struct D - where T: Copy {} + where + T: Copy, {} } diff --git a/tests/target/large_vec.rs b/tests/target/large_vec.rs index 44f6d52650c..95d1fc43c03 100644 --- a/tests/target/large_vec.rs +++ b/tests/target/large_vec.rs @@ -3,27 +3,40 @@ impl Environment { pub fn new_root() -> Rc> { let mut env = Environment::new(); - let builtin_functions = - &[("println", - Function::NativeVoid(CallSign { - num_params: 0, - variadic: true, - param_types: vec![], - }, - native_println)), - ("run_http_server", - Function::NativeVoid(CallSign { - num_params: 1, - variadic: false, - param_types: vec![Some(ConstraintType::Function)], - }, - native_run_http_server)), - ("len", - Function::NativeReturning(CallSign { - num_params: 1, - variadic: false, - param_types: vec![None], - }, - native_len))]; + let builtin_functions = &[ + ( + "println", + Function::NativeVoid( + CallSign { + num_params: 0, + variadic: true, + param_types: vec![], + }, + native_println, + ), + ), + ( + "run_http_server", + Function::NativeVoid( + CallSign { + num_params: 1, + variadic: false, + param_types: vec![Some(ConstraintType::Function)], + }, + native_run_http_server, + ), + ), + ( + "len", + Function::NativeReturning( + CallSign { + num_params: 1, + variadic: false, + param_types: vec![None], + }, + native_len, + ), + ), + ]; } } diff --git a/tests/target/long-fn-1.rs b/tests/target/long-fn-1.rs index 0e299aaecc1..f94431965c2 100644 --- a/tests/target/long-fn-1.rs +++ b/tests/target/long-fn-1.rs @@ -2,10 +2,11 @@ // formatted correctly. impl Foo { - fn some_input(&mut self, - input: Input, - input_path: Option) - -> (Input, Option) { + fn some_input( + &mut self, + input: Input, + input_path: Option, + ) -> (Input, Option) { } fn some_inpu(&mut self, input: Input, input_path: Option) -> (Input, Option) { diff --git a/tests/target/long-match-arms-brace-newline.rs b/tests/target/long-match-arms-brace-newline.rs index 7cf094906cc..95e6d3be3ed 100644 --- a/tests/target/long-match-arms-brace-newline.rs +++ b/tests/target/long-match-arms-brace-newline.rs @@ -6,8 +6,8 @@ fn main() { match x { aaaaaaaa::Bbbbb::Ccccccccccccc(_, Some(ref x)) if x == - "aaaaaaaaaaa \ - aaaaaaa aaaaaa" => + "aaaaaaaaaaa \ + aaaaaaa aaaaaa" => { Ok(()) } diff --git a/tests/target/loop.rs b/tests/target/loop.rs index 4cf18f0110a..2dfbff93a65 100644 --- a/tests/target/loop.rs +++ b/tests/target/loop.rs @@ -13,7 +13,8 @@ fn main() { } 'a: while loooooooooooooooooooooooooooooooooong_variable_name + another_value > - some_other_value {} + some_other_value + {} while aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa > bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb { } @@ -22,7 +23,8 @@ fn main() { } 'b: for xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx in - some_iter(arg1, arg2) { + some_iter(arg1, arg2) + { // do smth } diff --git a/tests/target/macros.rs b/tests/target/macros.rs index 45b475a18f9..6185e21a835 100644 --- a/tests/target/macros.rs +++ b/tests/target/macros.rs @@ -1,10 +1,12 @@ // rustfmt-normalize_comments: true itemmacro!(this, is.now().formatted(yay)); -itemmacro!(really, - long.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb() - .is - .formatted()); +itemmacro!( + really, + long.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb() + .is + .formatted() +); itemmacro!{this, is.bracket().formatted()} @@ -17,12 +19,16 @@ fn main() { baz!(1 + 2 + 3, quux.kaas()); - quux!(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, - BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB); + quux!( + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, + BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB + ); - kaas!(// comments - a, // post macro - b /* another */); + kaas!( + // comments + a, // post macro + b /* another */ + ); trailingcomma!( a , b , c , ); @@ -30,8 +36,24 @@ fn main() { vec![a, b, c]; - vec![AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, AAAAAA, BBBBB, 5, - 100 - 30, 1.33, b, b, b]; + vec![ + AAAAAA, + AAAAAA, + AAAAAA, + AAAAAA, + AAAAAA, + AAAAAA, + AAAAAA, + AAAAAA, + AAAAAA, + BBBBB, + 5, + 100 - 30, + 1.33, + b, + b, + b, + ]; vec![a /* comment */]; @@ -46,13 +68,12 @@ fn main() { vec![a; b, c]; vec![a; - (|x| { - let y = x + 1; - let z = y + 1; - z - })(2)]; - vec![a; - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]; + (|x| { + let y = x + 1; + let z = y + 1; + z + })(2)]; + vec![a; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]; vec![a; unsafe { x + 1 }]; unknown_bracket_macro__comma_should_not_be_stripped![ diff --git a/tests/target/match-block-trailing-comma.rs b/tests/target/match-block-trailing-comma.rs index b00def007e8..44d1f289f8e 100644 --- a/tests/target/match-block-trailing-comma.rs +++ b/tests/target/match-block-trailing-comma.rs @@ -8,9 +8,9 @@ fn foo() { "line1"; "line2" }, - b => { - (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) - }, + b => ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + ), } } diff --git a/tests/target/match-nowrap-trailing-comma.rs b/tests/target/match-nowrap-trailing-comma.rs index 6b2e430123d..0abc358a340 100644 --- a/tests/target/match-nowrap-trailing-comma.rs +++ b/tests/target/match-nowrap-trailing-comma.rs @@ -9,7 +9,9 @@ fn foo() { "line1"; "line2" }, - b => (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb), + b => ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + ), } } diff --git a/tests/target/match-nowrap.rs b/tests/target/match-nowrap.rs index db2a874c838..3849a8fb0e0 100644 --- a/tests/target/match-nowrap.rs +++ b/tests/target/match-nowrap.rs @@ -7,7 +7,9 @@ fn foo() { a => { foo() } - b => (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, - bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb), + b => ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + ), } } diff --git a/tests/target/match.rs b/tests/target/match.rs index 45f62ca6845..f21fdb37dc5 100644 --- a/tests/target/match.rs +++ b/tests/target/match.rs @@ -37,9 +37,10 @@ fn foo() { Patternnnnnnnnnnnnnnnnnnnnnnnnn if loooooooooooooooooooooooooooooooooooooooooong_guard => {} _ => {} - ast::PathParameters::AngleBracketedParameters(ref data) if data.lifetimes.len() > 0 || - data.types.len() > 0 || - data.bindings.len() > 0 => {} + ast::PathParameters::AngleBracketedParameters(ref data) if data.lifetimes.len() > + 0 || + data.types.len() > 0 || + data.bindings.len() > 0 => {} } let whatever = match something { @@ -66,15 +67,31 @@ fn main() { // Test that one-line bodies align. fn main() { match r { - Variableeeeeeeeeeeeeeeeee => { - ("variable", vec!["id", "name", "qualname", "value", "type", "scopeid"], true, true) - } - Enummmmmmmmmmmmmmmmmmmmm => { - ("enum", vec!["id", "qualname", "scopeid", "value"], true, true) - } - Variantttttttttttttttttttttttt => { - ("variant", vec!["id", "name", "qualname", "type", "value", "scopeid"], true, true) - } + Variableeeeeeeeeeeeeeeeee => ( + "variable", + vec!["id", "name", "qualname", "value", "type", "scopeid"], + true, + true, + ), + Enummmmmmmmmmmmmmmmmmmmm => ( + "enum", + vec!["id", "qualname", "scopeid", "value"], + true, + true, + ), + Variantttttttttttttttttttttttt => ( + "variant", + vec![ + "id", + "name", + "qualname", + "type", + "value", + "scopeid", + ], + true, + true, + ), }; match x { @@ -209,10 +226,12 @@ fn issue355() { xc => vec![1, 2], // comment yc => vec![3; 4], // comment yd => { - looooooooooooooooooooooooooooooooooooooooooooooooooooooooong_func(aaaaaaaaaa, - bbbbbbbbbb, - cccccccccc, - dddddddddd) + looooooooooooooooooooooooooooooooooooooooooooooooooooooooong_func( + aaaaaaaaaa, + bbbbbbbbbb, + cccccccccc, + dddddddddd, + ) } } } @@ -276,14 +295,12 @@ fn issue494() { hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) => { result.push(StmtRef::Mirror(Box::new(Stmt { - span: stmt.span, - kind: StmtKind::Expr { - scope: cx.tcx - .region_maps - .node_extent(id), - expr: expr.to_ref(), - }, - }))) + span: stmt.span, + kind: StmtKind::Expr { + scope: cx.tcx.region_maps.node_extent(id), + expr: expr.to_ref(), + }, + }))) } } } @@ -300,10 +317,10 @@ fn issue386() { fn guards() { match foo { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if foooooooooooooo && - barrrrrrrrrrrr => {} + barrrrrrrrrrrr => {} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if foooooooooooooo && - barrrrrrrrrrrr => {} + barrrrrrrrrrrr => {} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if fooooooooooooooooooooo && (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb || cccccccccccccccccccccccccccccccccccccccc) => { @@ -313,48 +330,48 @@ fn guards() { fn issue1371() { Some(match type_ { - sfEvtClosed => Closed, - sfEvtResized => { - let e = unsafe { *event.size.as_ref() }; + sfEvtClosed => Closed, + sfEvtResized => { + let e = unsafe { *event.size.as_ref() }; - Resized { - width: e.width, - height: e.height, - } - } - sfEvtLostFocus => LostFocus, - sfEvtGainedFocus => GainedFocus, - sfEvtTextEntered => { - TextEntered { - unicode: unsafe { - ::std::char::from_u32((*event.text.as_ref()).unicode) - .expect("Invalid unicode encountered on TextEntered event") - }, - } - } - sfEvtKeyPressed => { - let e = unsafe { event.key.as_ref() }; + Resized { + width: e.width, + height: e.height, + } + } + sfEvtLostFocus => LostFocus, + sfEvtGainedFocus => GainedFocus, + sfEvtTextEntered => { + TextEntered { + unicode: unsafe { + ::std::char::from_u32((*event.text.as_ref()).unicode) + .expect("Invalid unicode encountered on TextEntered event") + }, + } + } + sfEvtKeyPressed => { + let e = unsafe { event.key.as_ref() }; - KeyPressed { - code: unsafe { ::std::mem::transmute(e.code) }, - alt: e.alt.to_bool(), - ctrl: e.control.to_bool(), - shift: e.shift.to_bool(), - system: e.system.to_bool(), - } - } - sfEvtKeyReleased => { - let e = unsafe { event.key.as_ref() }; + KeyPressed { + code: unsafe { ::std::mem::transmute(e.code) }, + alt: e.alt.to_bool(), + ctrl: e.control.to_bool(), + shift: e.shift.to_bool(), + system: e.system.to_bool(), + } + } + sfEvtKeyReleased => { + let e = unsafe { event.key.as_ref() }; - KeyReleased { - code: unsafe { ::std::mem::transmute(e.code) }, - alt: e.alt.to_bool(), - ctrl: e.control.to_bool(), - shift: e.shift.to_bool(), - system: e.system.to_bool(), - } - } - }) + KeyReleased { + code: unsafe { ::std::mem::transmute(e.code) }, + alt: e.alt.to_bool(), + ctrl: e.control.to_bool(), + shift: e.shift.to_bool(), + system: e.system.to_bool(), + } + } + }) } fn issue1395() { @@ -362,31 +379,31 @@ fn issue1395() { let foo = Some(true); let mut x = false; bar.and_then(|_| match foo { - None => None, - Some(b) => { - x = true; - Some(b) - } - }); + None => None, + Some(b) => { + x = true; + Some(b) + } + }); } fn issue1456() { Ok(Recording { - artists: match reader - .evaluate(".//mb:recording/mb:artist-credit/mb:name-credit")? { - Nodeset(nodeset) => { - let res: Result, ReadError> = nodeset - .iter() - .map(|node| { - XPathNodeReader::new(node, &context) - .and_then(|r| ArtistRef::from_xml(&r)) - }) - .collect(); - res? - } - _ => Vec::new(), - }, - }) + artists: match reader.evaluate( + ".//mb:recording/mb:artist-credit/mb:name-credit", + )? { + Nodeset(nodeset) => { + let res: Result, ReadError> = nodeset + .iter() + .map(|node| { + XPathNodeReader::new(node, &context).and_then(|r| ArtistRef::from_xml(&r)) + }) + .collect(); + res? + } + _ => Vec::new(), + }, + }) } fn issue1460() { @@ -399,9 +416,13 @@ fn issue1460() { } fn issue525() { - foobar(f, "{}", match *self { - TaskState::Started => "started", - TaskState::Success => "success", - TaskState::Failed => "failed", - }); + foobar( + f, + "{}", + match *self { + TaskState::Started => "started", + TaskState::Success => "success", + TaskState::Failed => "failed", + }, + ); } diff --git a/tests/target/mod-1.rs b/tests/target/mod-1.rs index abf25b5e649..a5d186c5df7 100644 --- a/tests/target/mod-1.rs +++ b/tests/target/mod-1.rs @@ -23,12 +23,13 @@ mod boxed { } pub mod x { - pub fn freopen(filename: *const c_char, - mode: *const c_char, - mode2: *const c_char, - mode3: *const c_char, - file: *mut FILE) - -> *mut FILE { + pub fn freopen( + filename: *const c_char, + mode: *const c_char, + mode2: *const c_char, + mode3: *const c_char, + file: *mut FILE, + ) -> *mut FILE { } } diff --git a/tests/target/multiple.rs b/tests/target/multiple.rs index 716b77a2d30..8c1e2d9695d 100644 --- a/tests/target/multiple.rs +++ b/tests/target/multiple.rs @@ -31,18 +31,21 @@ mod other; fn foo(a: isize, b: u32 /* blah blah */, c: f64) {} fn foo() -> Box - where 'a: 'b, - for<'a> D<'b>: 'a +where + 'a: 'b, + for<'a> D<'b>: 'a, { hello!() } -fn baz<'a: 'b, // comment on 'a - T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */> - (a: A, - b: B, // comment on b - c: C) - -> Bob { +fn baz< + 'a: 'b, // comment on 'a + T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */ +>( + a: A, + b: B, // comment on b + c: C, +) -> Bob { #[attr1] extern crate foo; #[attr2] @@ -65,10 +68,11 @@ fn qux(a: dadsfa, // Comment 1 /// Blah blah blah. impl Bar { - fn foo(&mut self, - a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a - b: sdfasdfsdfasfs /* closing comment */) - -> isize { + fn foo( + &mut self, + a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a + b: sdfasdfsdfasfs, // closing comment + ) -> isize { } /// Blah blah blah. @@ -112,7 +116,8 @@ struct Bar; // With a where clause and generics. pub struct Foo<'a, Y: Baz> - where X: Whatever +where + X: Whatever, { f: SomeType, // Comment beside a field } @@ -129,11 +134,15 @@ fn main() { hello(); } - let rc = Cell::new(42usize, - 42usize, - Cell::new(42usize, - remaining_widthremaining_widthremaining_widthremaining_width), - 42usize); + let rc = Cell::new( + 42usize, + 42usize, + Cell::new( + 42usize, + remaining_widthremaining_widthremaining_widthremaining_width, + ), + 42usize, + ); let rc = RefCell::new(42usize, remaining_width, remaining_width); // a comment let x = "Hello!!!!!!!!! abcd abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd \ abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \ @@ -152,13 +161,14 @@ fn deconstruct() { } -fn deconstruct(foo: Bar) - -> (SocketAddr, - Method, - Headers, - RequestUri, - HttpVersion, - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) { +fn deconstruct( + foo: Bar, +) -> (SocketAddr, + Method, + Headers, + RequestUri, + HttpVersion, + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) { } #[rustfmt_skip] diff --git a/tests/target/nested-if-else.rs b/tests/target/nested-if-else.rs index 4d5bf1f702a..9a54789ddcd 100644 --- a/tests/target/nested-if-else.rs +++ b/tests/target/nested-if-else.rs @@ -1,11 +1,11 @@ fn issue1518() { Some(Object { - field: if a { - a_thing - } else if b { - b_thing - } else { - c_thing - }, - }) + field: if a { + a_thing + } else if b { + b_thing + } else { + c_thing + }, + }) } diff --git a/tests/target/nested-visual-block.rs b/tests/target/nested-visual-block.rs index a2e3c30f3ac..0312d6ff101 100644 --- a/tests/target/nested-visual-block.rs +++ b/tests/target/nested-visual-block.rs @@ -20,15 +20,18 @@ fn main() { |item| { match *item { StructLitField::Regular(ref field) => { - rewrite_field(inner_context, - &field, - &Constraints::new(v_budget.checked_sub(1).unwrap_or(0), indent)) + rewrite_field( + inner_context, + &field, + &Constraints::new(v_budget.checked_sub(1).unwrap_or(0), indent), + ) } StructLitField::Base(ref expr) => { // 2 = .. - expr.rewrite(inner_context, - &Constraints::new(try_opt!(v_budget.checked_sub(2)), indent + 2)) - .map(|s| format!("..{}", s)) + expr.rewrite( + inner_context, + &Constraints::new(try_opt!(v_budget.checked_sub(2)), indent + 2), + ).map(|s| format!("..{}", s)) } } }, @@ -45,16 +48,14 @@ fn main() { }); // #1581 - bootstrap - .checks - .register("PERSISTED_LOCATIONS", move || if locations2 - .0 - .inner_mut - .lock() - .poisoned { - Check::new(State::Error, - "Persisted location storage is poisoned due to a write failure") + bootstrap.checks.register("PERSISTED_LOCATIONS", move || { + if locations2.0.inner_mut.lock().poisoned { + Check::new( + State::Error, + "Persisted location storage is poisoned due to a write failure", + ) } else { Check::new(State::Healthy, "Persisted location storage is healthy") - }); + } + }); } diff --git a/tests/target/nested_skipped/mod.rs b/tests/target/nested_skipped/mod.rs index 44b25ca8797..0ab6f081e44 100644 --- a/tests/target/nested_skipped/mod.rs +++ b/tests/target/nested_skipped/mod.rs @@ -1,3 +1,3 @@ fn ugly() { -92; + 92; } diff --git a/tests/target/paths.rs b/tests/target/paths.rs index 6535463ebe3..da266389b6b 100644 --- a/tests/target/paths.rs +++ b/tests/target/paths.rs @@ -1,17 +1,18 @@ // rustfmt-normalize_comments: true fn main() { - let constellation_chan = - Constellation::::start(compositor_proxy, - resource_task, - image_cache_task, - font_cache_task, - time_profiler_chan, - mem_profiler_chan, - devtools_chan, - storage_task, - supports_clipboard); + let constellation_chan = Constellation::::start( + compositor_proxy, + resource_task, + image_cache_task, + font_cache_task, + time_profiler_chan, + mem_profiler_chan, + devtools_chan, + storage_task, + supports_clipboard, + ); Quux::::some_func(); diff --git a/tests/target/space-before-bound.rs b/tests/target/space-before-bound.rs index 0a226e1d585..538d0d41a5e 100644 --- a/tests/target/space-before-bound.rs +++ b/tests/target/space-before-bound.rs @@ -2,10 +2,21 @@ trait Trait {} trait Trait2 {} -fn f<'a, 'b : 'a, T : Trait, U>() where U : Trait2 {} +fn f<'a, 'b : 'a, T : Trait, U>() +where + U : Trait2, +{ +} // should fit on the line -fn f2<'a, 'b : 'a, Ttttttttttttttttttttttttttttttttttttttttttttttt : Trait, U>() where U : Trait2 {} -// should be wrapped -fn f2<'a, 'b : 'a, Tttttttttttttttttttttttttttttttttttttttttttttttt : Trait, U>() where U : Trait2 { +fn f2<'a, 'b : 'a, Ttttttttttttttttttttttttttttttttttttttttttttttt : Trait, U>() +where + U : Trait2, +{ +} +// should be wrapped +fn f2<'a, 'b : 'a, Tttttttttttttttttttttttttttttttttttttttttttttttt : Trait, U>() +where + U : Trait2, +{ } diff --git a/tests/target/spaces-within-angle-brackets.rs b/tests/target/spaces-within-angle-brackets.rs index bc662487369..3969327b8ec 100644 --- a/tests/target/spaces-within-angle-brackets.rs +++ b/tests/target/spaces-within-angle-brackets.rs @@ -55,4 +55,8 @@ impl Foo { trait MyTrait< A, D > {} impl< A: Send, D: Send > MyTrait< A, D > for Foo {} -fn foo() where for< 'a > u32: 'a {} +fn foo() +where + for< 'a > u32: 'a, +{ +} diff --git a/tests/target/spaces-within-square-brackets.rs b/tests/target/spaces-within-square-brackets.rs index eb58a683704..3a1b24d4def 100644 --- a/tests/target/spaces-within-square-brackets.rs +++ b/tests/target/spaces-within-square-brackets.rs @@ -13,22 +13,22 @@ fn main() { let slice = &arr[ 1..2 ]; let line100_________________________________________________________________________ = [ 1, 2 ]; - let line101__________________________________________________________________________ = [ 1, - 2 ]; - let line102___________________________________________________________________________ = [ 1, - 2 ]; - let line103____________________________________________________________________________ = [ 1, - 2 ]; + let line101__________________________________________________________________________ = + [ 1, 2 ]; + let line102___________________________________________________________________________ = + [ 1, 2 ]; + let line103____________________________________________________________________________ = + [ 1, 2 ]; let line104_____________________________________________________________________________ = [ 1, 2 ]; let line100_____________________________________________________________________ = vec![ 1, 2 ]; - let line101______________________________________________________________________ = vec![ 1, - 2 ]; - let line102_______________________________________________________________________ = vec![ 1, - 2 ]; - let line103________________________________________________________________________ = vec![ 1, - 2 ]; + let line101______________________________________________________________________ = + vec![ 1, 2 ]; + let line102_______________________________________________________________________ = + vec![ 1, 2 ]; + let line103________________________________________________________________________ = + vec![ 1, 2 ]; let line104_________________________________________________________________________ = vec![ 1, 2 ]; } diff --git a/tests/target/static.rs b/tests/target/static.rs index f2421c1444c..12a8eba111b 100644 --- a/tests/target/static.rs +++ b/tests/target/static.rs @@ -1,11 +1,52 @@ const FILE_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | - FILE_READ_EA | SYNCHRONIZE; + FILE_READ_EA | SYNCHRONIZE; -static boolnames: &'static [&'static str] = - &["bw", "am", "xsb", "xhp", "xenl", "eo", "gn", "hc", "km", "hs", "in", "db", "da", "mir", - "msgr", "os", "eslok", "xt", "hz", "ul", "xon", "nxon", "mc5i", "chts", "nrrmc", "npc", - "ndscr", "ccc", "bce", "hls", "xhpa", "crxm", "daisy", "xvpa", "sam", "cpix", "lpix", - "OTbs", "OTns", "OTnc", "OTMT", "OTNL", "OTpt", "OTxr"]; +static boolnames: &'static [&'static str] = &[ + "bw", + "am", + "xsb", + "xhp", + "xenl", + "eo", + "gn", + "hc", + "km", + "hs", + "in", + "db", + "da", + "mir", + "msgr", + "os", + "eslok", + "xt", + "hz", + "ul", + "xon", + "nxon", + "mc5i", + "chts", + "nrrmc", + "npc", + "ndscr", + "ccc", + "bce", + "hls", + "xhpa", + "crxm", + "daisy", + "xvpa", + "sam", + "cpix", + "lpix", + "OTbs", + "OTns", + "OTnc", + "OTMT", + "OTNL", + "OTpt", + "OTxr", +]; static mut name: SomeType = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; diff --git a/tests/target/string-lit.rs b/tests/target/string-lit.rs index bbca3fe097e..7ac75290f2e 100644 --- a/tests/target/string-lit.rs +++ b/tests/target/string-lit.rs @@ -26,7 +26,9 @@ formatting"#; filename.replace(" ", "\\"); let xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = - funktion("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"); + funktion( + "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", + ); let unicode = "a̐éö̲\r\n"; let unicode2 = "Löwe 老虎 Léopard"; @@ -42,8 +44,10 @@ fn issue682() { } fn issue716() { - println!("forall x. mult(e(), x) = x /\\ - forall x. mult(x, x) = e()"); + println!( + "forall x. mult(e(), x) = x /\\ + forall x. mult(x, x) = e()" + ); } fn issue_1282() { diff --git a/tests/target/string_punctuation.rs b/tests/target/string_punctuation.rs index f53e149b923..1cc73d14060 100644 --- a/tests/target/string_punctuation.rs +++ b/tests/target/string_punctuation.rs @@ -2,10 +2,14 @@ // rustfmt-error_on_line_overflow: false fn main() { - println!("ThisIsAReallyLongStringWithNoSpaces.It_should_prefer_to_break_onpunctuation:\ - Likethisssssssssssss"); + println!( + "ThisIsAReallyLongStringWithNoSpaces.It_should_prefer_to_break_onpunctuation:\ + Likethisssssssssssss" + ); format!("{}__{}__{}ItShouldOnlyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyNoticeSemicolonsPeriodsColonsAndCommasAndResortToMid-CharBreaksAfterPunctuation{}{}",x,y,z,a,b); - println!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaalhijalfhiigjapdighjapdigjapdighdapighapdighpaidhg;\ - adopgihadoguaadbadgad,qeoihapethae8t0aet8haetadbjtaeg;\ - ooeouthaoeutgadlgajduabgoiuadogabudogubaodugbadgadgadga;adoughaoeugbaouea"); + println!( + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaalhijalfhiigjapdighjapdigjapdighdapighapdighpaidhg;\ + adopgihadoguaadbadgad,qeoihapethae8t0aet8haetadbjtaeg;\ + ooeouthaoeutgadlgajduabgoiuadogabudogubaodugbadgadgadga;adoughaoeugbaouea" + ); } diff --git a/tests/target/struct_lits.rs b/tests/target/struct_lits.rs index 5befcb6cd7d..a42d8e7aada 100644 --- a/tests/target/struct_lits.rs +++ b/tests/target/struct_lits.rs @@ -50,11 +50,11 @@ fn main() { }; Some(Data::MethodCallData(MethodCallData { - span: sub_span.unwrap(), - scope: self.enclosing_scope(id), - ref_id: def_id, - decl_id: Some(decl_id), - })); + span: sub_span.unwrap(), + scope: self.enclosing_scope(id), + ref_id: def_id, + decl_id: Some(decl_id), + })); Diagram { // o This graph demonstrates how diff --git a/tests/target/struct_lits_multiline.rs b/tests/target/struct_lits_multiline.rs index 7cd2acd958f..0eb7b8b759f 100644 --- a/tests/target/struct_lits_multiline.rs +++ b/tests/target/struct_lits_multiline.rs @@ -59,11 +59,11 @@ fn main() { }; Some(Data::MethodCallData(MethodCallData { - span: sub_span.unwrap(), - scope: self.enclosing_scope(id), - ref_id: def_id, - decl_id: Some(decl_id), - })); + span: sub_span.unwrap(), + scope: self.enclosing_scope(id), + ref_id: def_id, + decl_id: Some(decl_id), + })); Diagram { // o This graph demonstrates how diff --git a/tests/target/struct_tuple_visual.rs b/tests/target/struct_tuple_visual.rs index 8f935c1aa4d..fa49c4f61a4 100644 --- a/tests/target/struct_tuple_visual.rs +++ b/tests/target/struct_tuple_visual.rs @@ -6,34 +6,44 @@ fn foo() { Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b()); - Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(// Comment - foo(), /* Comment */ - // Comment - bar() /* Comment */); + Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo( + // Comment + foo(), // Comment + // Comment + bar(), /* Comment */ + ); Foo(Bar, f()); - Quux(if cond { - bar(); - }, - baz()); + Quux( + if cond { + bar(); + }, + baz(), + ); - Baz(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - zzzzz /* test */); + Baz( + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + zzzzz, /* test */ + ); - A(// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante - // hendrerit. Donec et mollis dolor. - item(), - // Praesent et diam eget libero egestas mattis sit amet vitae augue. - // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. - Item); + A( + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit + // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante + // hendrerit. Donec et mollis dolor. + item(), + // Praesent et diam eget libero egestas mattis sit amet vitae augue. + // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. + Item, + ); - Diagram(// o This graph demonstrates how - // / \ significant whitespace is - // o o preserved. - // /|\ \ - // o o o o - G) + Diagram( + // o This graph demonstrates how + // / \ significant whitespace is + // o o preserved. + // /|\ \ + // o o o o + G, + ) } diff --git a/tests/target/structs.rs b/tests/target/structs.rs index 2872750c20a..f6387fc2bf3 100644 --- a/tests/target/structs.rs +++ b/tests/target/structs.rs @@ -59,14 +59,17 @@ struct Qux<'a, pub W, ); -struct Tuple(// Comment 1 - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, - // Comment 2 - BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB); +struct Tuple( + // Comment 1 + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, + // Comment 2 + BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +); // With a where clause and generics. pub struct Foo<'a, Y: Baz> - where X: Whatever +where + X: Whatever, { f: SomeType, // Comment beside a field } @@ -145,38 +148,52 @@ struct Deep { struct Foo(T); struct Foo(T) - where T: Copy, - T: Eq; -struct Foo(TTTTTTTTTTTTTTTTT, - UUUUUUUUUUUUUUUUUUUUUUUU, - TTTTTTTTTTTTTTTTTTT, - UUUUUUUUUUUUUUUUUUU); -struct Foo(TTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT) where T: PartialEq; +where + T: Copy, + T: Eq; +struct Foo( + TTTTTTTTTTTTTTTTT, + UUUUUUUUUUUUUUUUUUUUUUUU, + TTTTTTTTTTTTTTTTTTT, + UUUUUUUUUUUUUUUUUUU +); +struct Foo(TTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT) +where + T: PartialEq; struct Foo(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTTTT) - where T: PartialEq; -struct Foo(TTTTTTTTTTTTTTTTT, - UUUUUUUUUUUUUUUUUUUUUUUU, - TTTTTTTTTTTTTTTTTTT, - UUUUUUUUUUUUUUUUUUU) - where T: PartialEq; -struct Foo(TTTTTTTTTTTTTTTTT, // Foo - UUUUUUUUUUUUUUUUUUUUUUUU, // Bar - // Baz - TTTTTTTTTTTTTTTTTTT, - // Qux (FIXME #572 - doc comment) - UUUUUUUUUUUUUUUUUUU); +where + T: PartialEq; +struct Foo( + TTTTTTTTTTTTTTTTT, + UUUUUUUUUUUUUUUUUUUUUUUU, + TTTTTTTTTTTTTTTTTTT, + UUUUUUUUUUUUUUUUUUU +) +where + T: PartialEq; +struct Foo( + TTTTTTTTTTTTTTTTT, // Foo + UUUUUUUUUUUUUUUUUUUUUUUU, // Bar + // Baz + TTTTTTTTTTTTTTTTTTT, + // Qux (FIXME #572 - doc comment) + UUUUUUUUUUUUUUUUUUU +); mod m { struct X - where T: Sized + where + T: Sized, { a: T, } } -struct Foo(TTTTTTTTTTTTTTTTTTT, - /// Qux - UUUUUUUUUUUUUUUUUUU); +struct Foo( + TTTTTTTTTTTTTTTTTTT, + /// Qux + UUUUUUUUUUUUUUUUUUU +); struct Issue677 { pub ptr: *const libc::c_void, diff --git a/tests/target/trailing_commas.rs b/tests/target/trailing_commas.rs index 9e74266b396..9ef4eecbcc5 100644 --- a/tests/target/trailing_commas.rs +++ b/tests/target/trailing_commas.rs @@ -12,56 +12,65 @@ fn main() { } fn f(x: T, y: S) -> T - where T: P, - S: Q, +where + T: P, + S: Q, { x } impl Trait for T - where T: P, +where + T: P, { fn f(x: T) -> T - where T: Q + R, + where + T: Q + R, { x } } struct Pair - where T: P, - S: P + Q, +where + T: P, + S: P + Q, { a: T, b: S, } struct TupPair(S, T) - where T: P, - S: P + Q; +where + T: P, + S: P + Q; enum E - where S: P, - T: P, +where + S: P, + T: P, { A { a: T, }, } -type Double - where T: P, - T: Q = Pair; +type Double where + T: P, + T: Q = Pair; extern "C" { fn f(x: T, y: S) -> T - where T: P, - S: Q; + where + T: P, + S: Q; } trait Q - where T: P, - S: R, +where + T: P, + S: R, { fn f(self, x: T, y: S, z: U) -> Self - where U: P, - V: P; + where + U: P, + V: P; } diff --git a/tests/target/trait.rs b/tests/target/trait.rs index d8acc1ba229..e4758e98b5e 100644 --- a/tests/target/trait.rs +++ b/tests/target/trait.rs @@ -7,15 +7,18 @@ trait Foo { fn baz(a: AAAAAAAAAAAAAAAAAAAAAA, b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) -> RetType; - fn foo(a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Another comment - b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB) - -> RetType; // Some comment + fn foo( + a: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Another comment + b: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB, + ) -> RetType; // Some comment fn baz(&mut self) -> i32; fn increment(&mut self, x: i32); - fn read(&mut self, x: BufReader /* Used to be MemReader */) where R: Read; + fn read(&mut self, x: BufReader /* Used to be MemReader */) + where + R: Read; } pub trait WriteMessage { @@ -32,7 +35,8 @@ trait TraitWithExpr { trait Test { fn read_struct(&mut self, s_name: &str, len: usize, f: F) -> Result - where F: FnOnce(&mut Self) -> Result; + where + F: FnOnce(&mut Self) -> Result; } trait T {} @@ -42,27 +46,35 @@ trait Foo { } trait ConstCheck: Foo - where T: Baz +where + T: Baz, { const J: i32; } -trait Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttt where T: Foo {} +trait Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttt +where + T: Foo +{ +} trait Ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt - where T: Foo +where + T: Foo { } trait FooBar : Tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt - where J: Bar +where + J: Bar, { fn test(); } trait WhereList - where T: Foo, - J: Bar +where + T: Foo, + J: Bar { } diff --git a/tests/target/try-conversion.rs b/tests/target/try-conversion.rs index 7198606d75b..e16fba278d2 100644 --- a/tests/target/try-conversion.rs +++ b/tests/target/try-conversion.rs @@ -18,9 +18,10 @@ fn test() { } fn issue1291() { - fs::create_dir_all(&gitfiledir) - .chain_err(|| { - format!("failed to create the {} submodule directory for the workarea", - name) - })?; + fs::create_dir_all(&gitfiledir).chain_err(|| { + format!( + "failed to create the {} submodule directory for the workarea", + name + ) + })?; } diff --git a/tests/target/tuple.rs b/tests/target/tuple.rs index 16fc3df020f..f398b7dffb7 100644 --- a/tests/target/tuple.rs +++ b/tests/target/tuple.rs @@ -2,52 +2,74 @@ fn foo() { let a = (a, a, a, a, a); - let aaaaaaaaaaaaaaaa = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaa, aaaaaaaaaaaaaa); - let aaaaaaaaaaaaaaaaaaaaaa = (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, - aaaaaaaaaaaaaaaaaaaaaaaaa, - aaaa); + let aaaaaaaaaaaaaaaa = ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + aaaaaaaaaaaaaa, + aaaaaaaaaaaaaa, + ); + let aaaaaaaaaaaaaaaaaaaaaa = ( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + aaaaaaaaaaaaaaaaaaaaaaaaa, + aaaa, + ); let a = (a,); - let b = (// This is a comment - b, // Comment - b /* Trailing comment */); + let b = ( + // This is a comment + b, // Comment + b, /* Trailing comment */ + ); // #1063 foo(x.0 .0); } fn a() { - ((aaaaaaaa, - aaaaaaaaaaaaa, - aaaaaaaaaaaaaaaaa, - aaaaaaaaaaaaaa, - aaaaaaaaaaaaaaaa, - aaaaaaaaaaaaaa),) + (( + aaaaaaaa, + aaaaaaaaaaaaa, + aaaaaaaaaaaaaaaaa, + aaaaaaaaaaaaaa, + aaaaaaaaaaaaaaaa, + aaaaaaaaaaaaaa, + ),) } fn b() { - ((bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb), - bbbbbbbbbbbbbbbbbb) + ( + ( + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + ), + bbbbbbbbbbbbbbbbbb, + ) } fn issue550() { - self.visitor.visit_volume(self.level.sector_id(sector), - (floor_y, - if is_sky_flat(ceil_tex) { - from_wad_height(self.height_range.1) - } else { - ceil_y - })); + self.visitor.visit_volume(self.level.sector_id(sector), ( + floor_y, + if is_sky_flat(ceil_tex) { + from_wad_height(self.height_range.1) + } else { + ceil_y + }, + )); } fn issue775() { if indent { - let a = mk_object(&[("a".to_string(), Boolean(true)), - ("b".to_string(), - Array(vec![mk_object(&[("c".to_string(), - String("\x0c\r".to_string()))]), - mk_object(&[("d".to_string(), - String("".to_string()))])]))]); + let a = mk_object( + &[ + ("a".to_string(), Boolean(true)), + ( + "b".to_string(), + Array(vec![ + mk_object(&[("c".to_string(), String("\x0c\r".to_string()))]), + mk_object(&[("d".to_string(), String("".to_string()))]), + ]), + ), + ], + ); } } diff --git a/tests/target/type-ascription.rs b/tests/target/type-ascription.rs index 121c7990f86..f99d524eb2e 100644 --- a/tests/target/type-ascription.rs +++ b/tests/target/type-ascription.rs @@ -1,12 +1,12 @@ fn main() { let xxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: - SomeTrait; + SomeTrait; let xxxxxxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; let z = funk(yyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz, wwwwww): - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; x: u32 - 1u32 / 10f32: u32 } diff --git a/tests/target/type-punctuation.rs b/tests/target/type-punctuation.rs index e7021eca84f..f35293de626 100644 --- a/tests/target/type-punctuation.rs +++ b/tests/target/type-punctuation.rs @@ -1,12 +1,14 @@ // rustfmt-type_punctuation_density: Compressed struct Foo - where U: Eq+Clone { +where + U: Eq+Clone, { // body } trait Foo<'a, T=usize> - where T: 'a+Eq+Clone +where + T: 'a+Eq+Clone, { type Bar: Eq+Clone; } @@ -16,13 +18,15 @@ trait Foo: Eq+Clone { } impl Foo<'a> for Bar - where for<'a> T: 'a+Eq+Clone +where + for<'a> T: 'a+Eq+Clone, { // body } fn foo<'a, 'b, 'c>() - where 'a: 'b+'c +where + 'a: 'b+'c, { // body } diff --git a/tests/target/type_alias.rs b/tests/target/type_alias.rs index 42600aa3ae5..86180149aac 100644 --- a/tests/target/type_alias.rs +++ b/tests/target/type_alias.rs @@ -7,16 +7,18 @@ pub type PublicTest<'a, I, O> = Result, Box + 'a>, Box + 'a>>; -pub type LongGenericListTest<'a, - 'b, - 'c, - 'd, - LONGPARAMETERNAME, - LONGPARAMETERNAME, - LONGPARAMETERNAME, - A, - B, - C> = Option>; +pub type LongGenericListTest< + 'a, + 'b, + 'c, + 'd, + LONGPARAMETERNAME, + LONGPARAMETERNAME, + LONGPARAMETERNAME, + A, + B, + C +> = Option>; pub type Exactly100CharsTest<'a, 'b, 'c, 'd, LONGPARAMETERNAME, LONGPARAMETERNAME, A, B> = Vec; @@ -26,30 +28,34 @@ pub type Exactly101CharsTest<'a, 'b, 'c, 'd, LONGPARAMETERNAME, LONGPARAMETERNAM pub type Exactly100CharsToEqualTest<'a, 'b, 'c, 'd, LONGPARAMETERNAME, LONGPARAMETERNAME, A, B, C> = Vec; -pub type GenericsFitButNotEqualTest<'a, - 'b, - 'c, - 'd, - LONGPARAMETERNAME, - LONGPARAMETERNAME, - A1, - B, - C> = Vec; +pub type GenericsFitButNotEqualTest< + 'a, + 'b, + 'c, + 'd, + LONGPARAMETERNAME, + LONGPARAMETERNAME, + A1, + B, + C +> = Vec; -pub type CommentTest = (); +pub type CommentTest< + // Lifetime + 'a, // Type + T +> = (); -pub type WithWhereClause - where T: Clone, - LONGPARAMETERNAME: Clone + Eq + OtherTrait = Option; +pub type WithWhereClause where + T: Clone, + LONGPARAMETERNAME: Clone + Eq + OtherTrait = Option; -pub type Exactly100CharstoEqualWhereTest where T: Clone + Ord + Eq + SomeOtherTrait = - Option; +pub type Exactly100CharstoEqualWhereTest where + T: Clone + Ord + Eq + SomeOtherTrait = Option; -pub type Exactly101CharstoEqualWhereTest - where T: Clone + Ord + Eq + SomeOtherTrait = Option; +pub type Exactly101CharstoEqualWhereTest where + T: Clone + Ord + Eq + SomeOtherTrait = Option; type RegisterPlugin = unsafe fn(pt: *const c_char, plugin: *mut c_void, diff --git a/tests/target/where-clause.rs b/tests/target/where-clause.rs index cf225cab350..724f3b34bf0 100644 --- a/tests/target/where-clause.rs +++ b/tests/target/where-clause.rs @@ -1,21 +1,29 @@ pub trait Test { fn very_long_method_name(self, f: F) -> MyVeryLongReturnType - where F: FnMut(Self::Item) -> bool; - fn exactly_100_chars1(self, f: F) -> MyVeryLongReturnType where F: FnMut(Self::Item) -> bool; + where + F: FnMut(Self::Item) -> bool; + fn exactly_100_chars1(self, f: F) -> MyVeryLongReturnType + where + F: FnMut(Self::Item) -> bool; } fn very_long_function_name(very_long_argument: F) -> MyVeryLongReturnType - where F: FnMut(Self::Item) -> bool +where + F: FnMut(Self::Item) -> bool, { } struct VeryLongTupleStructName(LongLongTypename, LongLongTypename, i32, i32) - where A: LongTrait; +where + A: LongTrait; -struct Exactly100CharsToSemicolon(LongLongTypename, i32, i32) where A: LongTrait1234; +struct Exactly100CharsToSemicolon(LongLongTypename, i32, i32) +where + A: LongTrait1234; struct AlwaysOnNextLine - where A: LongTrait +where + A: LongTrait, { x: i32, } diff --git a/tests/writemode/target/checkstyle.xml b/tests/writemode/target/checkstyle.xml index b59d81b29c8..30ab5ad7579 100644 --- a/tests/writemode/target/checkstyle.xml +++ b/tests/writemode/target/checkstyle.xml @@ -1,2 +1,2 @@ - +