diff options
| author | bors <bors@rust-lang.org> | 2024-09-25 06:41:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-09-25 06:41:56 +0000 |
| commit | 34aff74fb06e78fb9cd1a66acafb6d150638de35 (patch) | |
| tree | 14533de260c2f1834994e58af1d210a6884625a9 /src/tools/rustfmt/tests/source | |
| parent | 938c7b1162a38dca257c7004ef7ecf86397a8634 (diff) | |
| parent | 8be19465ec14880160d294f2909202451a547740 (diff) | |
| download | rust-34aff74fb06e78fb9cd1a66acafb6d150638de35.tar.gz rust-34aff74fb06e78fb9cd1a66acafb6d150638de35.zip | |
Auto merge of #18183 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
Diffstat (limited to 'src/tools/rustfmt/tests/source')
50 files changed, 409 insertions, 45 deletions
diff --git a/src/tools/rustfmt/tests/source/arrow_in_comments/arrow_in_single_comment.rs b/src/tools/rustfmt/tests/source/arrow_in_comments/arrow_in_single_comment.rs index fb0576a4822..38e8967e7e6 100644 --- a/src/tools/rustfmt/tests/source/arrow_in_comments/arrow_in_single_comment.rs +++ b/src/tools/rustfmt/tests/source/arrow_in_comments/arrow_in_single_comment.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { match a { _ => diff --git a/src/tools/rustfmt/tests/source/arrow_in_comments/multiple_arrows.rs b/src/tools/rustfmt/tests/source/arrow_in_comments/multiple_arrows.rs index fc696b309f2..98ef919450f 100644 --- a/src/tools/rustfmt/tests/source/arrow_in_comments/multiple_arrows.rs +++ b/src/tools/rustfmt/tests/source/arrow_in_comments/multiple_arrows.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { match a { _ => // comment with => diff --git a/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/one.rs b/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/one.rs index 6d48ea742fc..66e2f538415 100644 --- a/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/one.rs +++ b/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 // rustfmt-error_on_line_overflow: false // rustfmt-indent_style: Block diff --git a/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/two.rs b/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/two.rs index 7a62d722c6e..51aa6376e23 100644 --- a/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/two.rs +++ b/src/tools/rustfmt/tests/source/configs/indent_style/block_trailing_comma_call/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // rustfmt-error_on_line_overflow: false // rustfmt-indent_style: Block diff --git a/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2015.rs b/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2015.rs new file mode 100644 index 00000000000..5cb4a870fc1 --- /dev/null +++ b/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2015.rs @@ -0,0 +1,155 @@ +// rustfmt-style_edition: 2015 + +fn combine_blocklike() { + do_thing( + |param| { + action(); + foo(param) + }, + ); + + do_thing( + x, + |param| { + action(); + foo(param) + }, + ); + + do_thing( + x, + + // I'll be discussing the `action` with your para(m)legal counsel + |param| { + action(); + foo(param) + }, + ); + + do_thing( + Bar { + x: value, + y: value2, + }, + ); + + do_thing( + x, + Bar { + x: value, + y: value2, + }, + ); + + do_thing( + x, + + // Let me tell you about that one time at the `Bar` + Bar { + x: value, + y: value2, + }, + ); + + do_thing( + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + + // Just admit it; my list is longer than can be folded on to one line + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + + // Just admit it; my list is longer than can be folded on to one line + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + ( + 1, + 2, + 3, + |param| { + action(); + foo(param) + }, + ), + ); +} + +fn combine_struct_sample() { + let identity = verify( + &ctx, + VerifyLogin { + type_: LoginType::Username, + username: args.username.clone(), + password: Some(args.password.clone()), + domain: None, + }, + )?; +} + +fn combine_macro_sample() { + rocket::ignite() + .mount( + "/", + routes![ + http::auth::login, + http::auth::logout, + http::cors::options, + http::action::dance, + http::action::sleep, + ], + ) + .launch(); +} diff --git a/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2024.rs b/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2024.rs new file mode 100644 index 00000000000..66c95e71aa9 --- /dev/null +++ b/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2024.rs @@ -0,0 +1,155 @@ +// rustfmt-style_edition: 2024 + +fn combine_blocklike() { + do_thing( + |param| { + action(); + foo(param) + }, + ); + + do_thing( + x, + |param| { + action(); + foo(param) + }, + ); + + do_thing( + x, + + // I'll be discussing the `action` with your para(m)legal counsel + |param| { + action(); + foo(param) + }, + ); + + do_thing( + Bar { + x: value, + y: value2, + }, + ); + + do_thing( + x, + Bar { + x: value, + y: value2, + }, + ); + + do_thing( + x, + + // Let me tell you about that one time at the `Bar` + Bar { + x: value, + y: value2, + }, + ); + + do_thing( + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + + // Just admit it; my list is longer than can be folded on to one line + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + + // Just admit it; my list is longer than can be folded on to one line + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); + + do_thing( + x, + ( + 1, + 2, + 3, + |param| { + action(); + foo(param) + }, + ), + ); +} + +fn combine_struct_sample() { + let identity = verify( + &ctx, + VerifyLogin { + type_: LoginType::Username, + username: args.username.clone(), + password: Some(args.password.clone()), + domain: None, + }, + )?; +} + +fn combine_macro_sample() { + rocket::ignite() + .mount( + "/", + routes![ + http::auth::login, + http::auth::logout, + http::cors::options, + http::action::dance, + http::action::sleep, + ], + ) + .launch(); +} diff --git a/src/tools/rustfmt/tests/source/fn-single-line/version_one.rs b/src/tools/rustfmt/tests/source/fn-single-line/version_one.rs index 469ab621567..85957e3fdcc 100644 --- a/src/tools/rustfmt/tests/source/fn-single-line/version_one.rs +++ b/src/tools/rustfmt/tests/source/fn-single-line/version_one.rs @@ -1,5 +1,5 @@ // rustfmt-fn_single_line: true -// rustfmt-version: One +// rustfmt-style_edition: 2015 // Test single-line functions. fn foo_expr() { diff --git a/src/tools/rustfmt/tests/source/fn-single-line/version_two.rs b/src/tools/rustfmt/tests/source/fn-single-line/version_two.rs index bf381ff1065..f119e581217 100644 --- a/src/tools/rustfmt/tests/source/fn-single-line/version_two.rs +++ b/src/tools/rustfmt/tests/source/fn-single-line/version_two.rs @@ -1,5 +1,5 @@ // rustfmt-fn_single_line: true -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // Test single-line functions. fn foo_expr() { diff --git a/src/tools/rustfmt/tests/source/issue-2179/one.rs b/src/tools/rustfmt/tests/source/issue-2179/one.rs index d23947931ff..8bbd56f0521 100644 --- a/src/tools/rustfmt/tests/source/issue-2179/one.rs +++ b/src/tools/rustfmt/tests/source/issue-2179/one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 // rustfmt-error_on_line_overflow: false fn issue_2179() { diff --git a/src/tools/rustfmt/tests/source/issue-2179/two.rs b/src/tools/rustfmt/tests/source/issue-2179/two.rs index f4cc9cc488b..631b0f3c86e 100644 --- a/src/tools/rustfmt/tests/source/issue-2179/two.rs +++ b/src/tools/rustfmt/tests/source/issue-2179/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // rustfmt-error_on_line_overflow: false fn issue_2179() { diff --git a/src/tools/rustfmt/tests/source/issue-3213/version_one.rs b/src/tools/rustfmt/tests/source/issue-3213/version_one.rs index f9f4cab55e3..ed7d5145150 100644 --- a/src/tools/rustfmt/tests/source/issue-3213/version_one.rs +++ b/src/tools/rustfmt/tests/source/issue-3213/version_one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 fn foo() { match 0 { diff --git a/src/tools/rustfmt/tests/source/issue-3213/version_two.rs b/src/tools/rustfmt/tests/source/issue-3213/version_two.rs index 0f068c19d74..c6d04aced8d 100644 --- a/src/tools/rustfmt/tests/source/issue-3213/version_two.rs +++ b/src/tools/rustfmt/tests/source/issue-3213/version_two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn foo() { match 0 { diff --git a/src/tools/rustfmt/tests/source/issue-3227/two.rs b/src/tools/rustfmt/tests/source/issue-3227/two.rs index c1572c00d57..50c0ad47dc1 100644 --- a/src/tools/rustfmt/tests/source/issue-3227/two.rs +++ b/src/tools/rustfmt/tests/source/issue-3227/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { thread::spawn(|| { diff --git a/src/tools/rustfmt/tests/source/issue-3270/one.rs b/src/tools/rustfmt/tests/source/issue-3270/one.rs index 3c2e27e2293..64861176b91 100644 --- a/src/tools/rustfmt/tests/source/issue-3270/one.rs +++ b/src/tools/rustfmt/tests/source/issue-3270/one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 pub fn main() { /* let s = String::from( diff --git a/src/tools/rustfmt/tests/source/issue-3270/two.rs b/src/tools/rustfmt/tests/source/issue-3270/two.rs index 0eb756471e7..1342cf03c39 100644 --- a/src/tools/rustfmt/tests/source/issue-3270/two.rs +++ b/src/tools/rustfmt/tests/source/issue-3270/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 pub fn main() { /* let s = String::from( diff --git a/src/tools/rustfmt/tests/source/issue-3272/v1.rs b/src/tools/rustfmt/tests/source/issue-3272/v1.rs index f4c1b7c992b..56dc048bf8a 100644 --- a/src/tools/rustfmt/tests/source/issue-3272/v1.rs +++ b/src/tools/rustfmt/tests/source/issue-3272/v1.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 fn main() { assert!(HAYSTACK diff --git a/src/tools/rustfmt/tests/source/issue-3272/v2.rs b/src/tools/rustfmt/tests/source/issue-3272/v2.rs index 0148368edc8..f3adbe37c76 100644 --- a/src/tools/rustfmt/tests/source/issue-3272/v2.rs +++ b/src/tools/rustfmt/tests/source/issue-3272/v2.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { assert!(HAYSTACK diff --git a/src/tools/rustfmt/tests/source/issue-3278/version_one.rs b/src/tools/rustfmt/tests/source/issue-3278/version_one.rs index 580679fbae3..718a32b4c7e 100644 --- a/src/tools/rustfmt/tests/source/issue-3278/version_one.rs +++ b/src/tools/rustfmt/tests/source/issue-3278/version_one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 pub fn parse_conditional<'a, I: 'a>( ) -> impl Parser<Input = I, Output = Expr, PartialState = ()> + 'a diff --git a/src/tools/rustfmt/tests/source/issue-3278/version_two.rs b/src/tools/rustfmt/tests/source/issue-3278/version_two.rs index c17b1742d39..eb605e509f9 100644 --- a/src/tools/rustfmt/tests/source/issue-3278/version_two.rs +++ b/src/tools/rustfmt/tests/source/issue-3278/version_two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 pub fn parse_conditional<'a, I: 'a>() -> impl Parser<Input = I, Output = Expr, PartialState = ()> + 'a diff --git a/src/tools/rustfmt/tests/source/issue-3295/two.rs b/src/tools/rustfmt/tests/source/issue-3295/two.rs index 0eaf022249b..ae3d2ec28c0 100644 --- a/src/tools/rustfmt/tests/source/issue-3295/two.rs +++ b/src/tools/rustfmt/tests/source/issue-3295/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 pub enum TestEnum { a, b, diff --git a/src/tools/rustfmt/tests/source/issue-3302.rs b/src/tools/rustfmt/tests/source/issue-3302.rs index c037584fd71..5e0862cb399 100644 --- a/src/tools/rustfmt/tests/source/issue-3302.rs +++ b/src/tools/rustfmt/tests/source/issue-3302.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 macro_rules! moo1 { () => { diff --git a/src/tools/rustfmt/tests/source/issue-3701/one.rs b/src/tools/rustfmt/tests/source/issue-3701/one.rs index a7f0bd3aa17..4e8518b6f18 100644 --- a/src/tools/rustfmt/tests/source/issue-3701/one.rs +++ b/src/tools/rustfmt/tests/source/issue-3701/one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 fn build_sorted_static_get_entry_names( mut entries: Vec<(u8, &'static str)>, diff --git a/src/tools/rustfmt/tests/source/issue-3701/two.rs b/src/tools/rustfmt/tests/source/issue-3701/two.rs index 8e15c58b8b2..d7cb790a754 100644 --- a/src/tools/rustfmt/tests/source/issue-3701/two.rs +++ b/src/tools/rustfmt/tests/source/issue-3701/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn build_sorted_static_get_entry_names( mut entries: Vec<(u8, &'static str)>, diff --git a/src/tools/rustfmt/tests/source/issue-3805.rs b/src/tools/rustfmt/tests/source/issue-3805.rs index a0289b57974..aadc4a9dddc 100644 --- a/src/tools/rustfmt/tests/source/issue-3805.rs +++ b/src/tools/rustfmt/tests/source/issue-3805.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // rustfmt-format_macro_matchers: true // From original issue example - Line length 101 diff --git a/src/tools/rustfmt/tests/source/issue-3840/version-two_hard-tabs.rs b/src/tools/rustfmt/tests/source/issue-3840/version-two_hard-tabs.rs index 7b505fda87c..8d009eabdec 100644 --- a/src/tools/rustfmt/tests/source/issue-3840/version-two_hard-tabs.rs +++ b/src/tools/rustfmt/tests/source/issue-3840/version-two_hard-tabs.rs @@ -1,5 +1,5 @@ // rustfmt-hard_tabs: true -// rustfmt-version: Two +// rustfmt-style_edition: 2024 impl<Target: FromEvent<A> + FromEvent<B>, A: Widget2<Ctx = C>, B: Widget2<Ctx = C>, C: for<'a> CtxFamily<'a>> Widget2 for WidgetEventLifter<Target, A, B> { diff --git a/src/tools/rustfmt/tests/source/issue-3840/version-two_soft-tabs.rs b/src/tools/rustfmt/tests/source/issue-3840/version-two_soft-tabs.rs index 39c8ef31292..9e283d3be0a 100644 --- a/src/tools/rustfmt/tests/source/issue-3840/version-two_soft-tabs.rs +++ b/src/tools/rustfmt/tests/source/issue-3840/version-two_soft-tabs.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 impl<Target: FromEvent<A> + FromEvent<B>, A: Widget2<Ctx = C>, B: Widget2<Ctx = C>, C: for<'a> CtxFamily<'a>> Widget2 for WidgetEventLifter<Target, A, B> { diff --git a/src/tools/rustfmt/tests/source/issue-4381/style_edition_2015.rs b/src/tools/rustfmt/tests/source/issue-4381/style_edition_2015.rs new file mode 100644 index 00000000000..bb4c9feae1d --- /dev/null +++ b/src/tools/rustfmt/tests/source/issue-4381/style_edition_2015.rs @@ -0,0 +1,3 @@ +// rustfmt-style_edition: 2015 + +use std::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64}; diff --git a/src/tools/rustfmt/tests/source/issue-4530.rs b/src/tools/rustfmt/tests/source/issue-4530.rs index 9d2882abb3c..6b92122f0c0 100644 --- a/src/tools/rustfmt/tests/source/issue-4530.rs +++ b/src/tools/rustfmt/tests/source/issue-4530.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { let [aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc, ddddddddddddddddddddddddd] = panic!(); } diff --git a/src/tools/rustfmt/tests/source/issue-4689/one.rs b/src/tools/rustfmt/tests/source/issue-4689/one.rs index d048eb10fb1..bff090a3525 100644 --- a/src/tools/rustfmt/tests/source/issue-4689/one.rs +++ b/src/tools/rustfmt/tests/source/issue-4689/one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 // Based on the issue description pub trait PrettyPrinter<'tcx>: diff --git a/src/tools/rustfmt/tests/source/issue-4689/two.rs b/src/tools/rustfmt/tests/source/issue-4689/two.rs index ea7feda825d..217535c046e 100644 --- a/src/tools/rustfmt/tests/source/issue-4689/two.rs +++ b/src/tools/rustfmt/tests/source/issue-4689/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // Based on the issue description pub trait PrettyPrinter<'tcx>: diff --git a/src/tools/rustfmt/tests/source/issue-5586.rs b/src/tools/rustfmt/tests/source/issue-5586.rs index 9cf6c1d58dd..061ad4bdaa4 100644 --- a/src/tools/rustfmt/tests/source/issue-5586.rs +++ b/src/tools/rustfmt/tests/source/issue-5586.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { // sample 1 { diff --git a/src/tools/rustfmt/tests/source/issue-5655/one.rs b/src/tools/rustfmt/tests/source/issue-5655/one.rs index 1758ec56f8b..62df2655c29 100644 --- a/src/tools/rustfmt/tests/source/issue-5655/one.rs +++ b/src/tools/rustfmt/tests/source/issue-5655/one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 fn foo<T>(_: T) where diff --git a/src/tools/rustfmt/tests/source/issue-5655/two.rs b/src/tools/rustfmt/tests/source/issue-5655/two.rs index e37ebbea8af..bfe1d3813bb 100644 --- a/src/tools/rustfmt/tests/source/issue-5655/two.rs +++ b/src/tools/rustfmt/tests/source/issue-5655/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn foo<T>(_: T) where diff --git a/src/tools/rustfmt/tests/source/issue-5801/comment_unexpectedly_wraps_before_max_width.rs b/src/tools/rustfmt/tests/source/issue-5801/comment_unexpectedly_wraps_before_max_width.rs index 5847afd9560..e61d34604a1 100644 --- a/src/tools/rustfmt/tests/source/issue-5801/comment_unexpectedly_wraps_before_max_width.rs +++ b/src/tools/rustfmt/tests/source/issue-5801/comment_unexpectedly_wraps_before_max_width.rs @@ -1,7 +1,7 @@ // rustfmt-comment_width: 120 // rustfmt-wrap_comments: true // rustfmt-max_width: 120 -// rustfmt-version: One +// rustfmt-style_edition: 2015 /// This function is 120 columns wide and is left alone. This comment is 120 columns wide and the formatter is also fine fn my_super_cool_function_name(my_very_cool_argument_name: String, my_other_very_cool_argument_name: String) -> String { diff --git a/src/tools/rustfmt/tests/source/issue-5987/two.rs b/src/tools/rustfmt/tests/source/issue-5987/two.rs index e20026b5565..98ed35c4f9a 100644 --- a/src/tools/rustfmt/tests/source/issue-5987/two.rs +++ b/src/tools/rustfmt/tests/source/issue-5987/two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn main() { trace!( diff --git a/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v1.rs b/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v1.rs index 2ac2e0361c3..bcae86aaff2 100644 --- a/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v1.rs +++ b/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v1.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 pub fn main() { let a = Some(12); diff --git a/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v2.rs b/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v2.rs index c1bf1ad4bf8..da612b213fc 100644 --- a/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v2.rs +++ b/src/tools/rustfmt/tests/source/issue-6147/case_rustfmt_v2.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 pub fn main() { let a = Some(12); diff --git a/src/tools/rustfmt/tests/source/issue_5027.rs b/src/tools/rustfmt/tests/source/issue_5027.rs index 67beeb23b71..a47d6df6f0f 100644 --- a/src/tools/rustfmt/tests/source/issue_5027.rs +++ b/src/tools/rustfmt/tests/source/issue_5027.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 pub type Iter<'a, D> = impl DoubleEndedIterator<Item = (SomethingSomethingSomethingLongType<D>)>+ ExactSizeIterator+ 'a; diff --git a/src/tools/rustfmt/tests/source/let_else_v2.rs b/src/tools/rustfmt/tests/source/let_else_v2.rs index a420fbcf95b..23be32d629a 100644 --- a/src/tools/rustfmt/tests/source/let_else_v2.rs +++ b/src/tools/rustfmt/tests/source/let_else_v2.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // rustfmt-single_line_let_else_max_width: 100 fn issue5901() { diff --git a/src/tools/rustfmt/tests/source/long-fn-1/version_one.rs b/src/tools/rustfmt/tests/source/long-fn-1/version_one.rs index d6832c2af09..60083024810 100644 --- a/src/tools/rustfmt/tests/source/long-fn-1/version_one.rs +++ b/src/tools/rustfmt/tests/source/long-fn-1/version_one.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 // Tests that a function which is almost short enough, but not quite, gets // formatted correctly. diff --git a/src/tools/rustfmt/tests/source/long-fn-1/version_two.rs b/src/tools/rustfmt/tests/source/long-fn-1/version_two.rs index f402a26e8b6..bce2c551c6a 100644 --- a/src/tools/rustfmt/tests/source/long-fn-1/version_two.rs +++ b/src/tools/rustfmt/tests/source/long-fn-1/version_two.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // Tests that a function which is almost short enough, but not quite, gets // formatted correctly. diff --git a/src/tools/rustfmt/tests/source/one_line_if_v1.rs b/src/tools/rustfmt/tests/source/one_line_if_v1.rs index d3dcbe6787a..bf7bc75fb88 100644 --- a/src/tools/rustfmt/tests/source/one_line_if_v1.rs +++ b/src/tools/rustfmt/tests/source/one_line_if_v1.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 fn plain_if(x: bool) -> u8 { if x { diff --git a/src/tools/rustfmt/tests/source/one_line_if_v2.rs b/src/tools/rustfmt/tests/source/one_line_if_v2.rs index 40c834959f9..f3c974b12db 100644 --- a/src/tools/rustfmt/tests/source/one_line_if_v2.rs +++ b/src/tools/rustfmt/tests/source/one_line_if_v2.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn plain_if(x: bool) -> u8 { if x { diff --git a/src/tools/rustfmt/tests/source/single-line-macro/v1.rs b/src/tools/rustfmt/tests/source/single-line-macro/v1.rs index a3aa631ed4a..fea146d8d33 100644 --- a/src/tools/rustfmt/tests/source/single-line-macro/v1.rs +++ b/src/tools/rustfmt/tests/source/single-line-macro/v1.rs @@ -1,4 +1,4 @@ -// rustfmt-version: One +// rustfmt-style_edition: 2015 // #2652 // Preserve trailing comma inside macro, even if it looks an array. diff --git a/src/tools/rustfmt/tests/source/single-line-macro/v2.rs b/src/tools/rustfmt/tests/source/single-line-macro/v2.rs index 51a665f7560..d9fba64ac70 100644 --- a/src/tools/rustfmt/tests/source/single-line-macro/v2.rs +++ b/src/tools/rustfmt/tests/source/single-line-macro/v2.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // #2652 // Preserve trailing comma inside macro, even if it looks an array. diff --git a/src/tools/rustfmt/tests/source/trailing_comments/hard_tabs.rs b/src/tools/rustfmt/tests/source/trailing_comments/hard_tabs.rs index 88249aa5fb9..c6d1b3f0ab7 100644 --- a/src/tools/rustfmt/tests/source/trailing_comments/hard_tabs.rs +++ b/src/tools/rustfmt/tests/source/trailing_comments/hard_tabs.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // rustfmt-wrap_comments: true // rustfmt-hard_tabs: true diff --git a/src/tools/rustfmt/tests/source/trailing_comments/soft_tabs.rs b/src/tools/rustfmt/tests/source/trailing_comments/soft_tabs.rs index 7845f713b8a..431875989f3 100644 --- a/src/tools/rustfmt/tests/source/trailing_comments/soft_tabs.rs +++ b/src/tools/rustfmt/tests/source/trailing_comments/soft_tabs.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 // rustfmt-wrap_comments: true pub const IFF_MULTICAST: ::c_int = 0x0000000800; // Supports multicast diff --git a/src/tools/rustfmt/tests/source/tuple_v2.rs b/src/tools/rustfmt/tests/source/tuple_v2.rs index 9223033832b..6dc18e00d7e 100644 --- a/src/tools/rustfmt/tests/source/tuple_v2.rs +++ b/src/tools/rustfmt/tests/source/tuple_v2.rs @@ -1,4 +1,4 @@ -// rustfmt-version: Two +// rustfmt-style_edition: 2024 fn issue_4355() { let _ = ((1,),).0 .0; diff --git a/src/tools/rustfmt/tests/source/type-alias-where-clauses-with-comments.rs b/src/tools/rustfmt/tests/source/type-alias-where-clauses-with-comments.rs new file mode 100644 index 00000000000..722ebac47ac --- /dev/null +++ b/src/tools/rustfmt/tests/source/type-alias-where-clauses-with-comments.rs @@ -0,0 +1,31 @@ +type Foo // comment1 + // interlinear1 +where // comment2 + // interlinear2 +A: B, // comment3 +C: D, // comment4 + // interlinear3 += E; // comment5 + +type Foo // comment6 + // interlinear4 +where// comment7 + // interlinear5 +A: B, // comment8 +C: D, // comment9 + // interlinear6 += E // comment10 + // interlinear7 +where // comment11 + // interlinear8 +F: G, // comment12 +H: I; // comment13 + +type Foo // comment14 + // interlinear9 += E // comment15 + // interlinear10 +where // comment16 + // interlinear11 +F: G,// comment17 +H: I;// comment18 diff --git a/src/tools/rustfmt/tests/source/type-alias-where-clauses.rs b/src/tools/rustfmt/tests/source/type-alias-where-clauses.rs new file mode 100644 index 00000000000..ad998caf308 --- /dev/null +++ b/src/tools/rustfmt/tests/source/type-alias-where-clauses.rs @@ -0,0 +1,20 @@ + type Foo + where + A: B, + C: D, + = E; + + type Foo + where + A: B, + C: D, + = E + where + F: G, + H: I; + + type Foo + = E + where + F: G, + H: I; \ No newline at end of file |
