diff --git a/src/tools/rustfmt/rustfmt.toml b/src/tools/rustfmt/rustfmt.toml index 86447eac2e67b..52e4d728b641e 100644 --- a/src/tools/rustfmt/rustfmt.toml +++ b/src/tools/rustfmt/rustfmt.toml @@ -1,4 +1,3 @@ error_on_line_overflow = true error_on_unformatted = true style_edition = "2024" -overflow_delimited_expr = false diff --git a/src/tools/rustfmt/src/bin/main.rs b/src/tools/rustfmt/src/bin/main.rs index 34984798ae60e..67bc7c9782907 100644 --- a/src/tools/rustfmt/src/bin/main.rs +++ b/src/tools/rustfmt/src/bin/main.rs @@ -817,7 +817,6 @@ mod test { options.inline_config = HashMap::from([("version".to_owned(), "Two".to_owned())]); let config = get_config(None, Some(options)); assert_eq!(config.style_edition(), StyleEdition::Edition2024); - assert_eq!(config.overflow_delimited_expr(), true); } #[nightly_only_test] @@ -827,7 +826,6 @@ mod test { let config_file = Some(Path::new("tests/config/style-edition/just-version")); let config = get_config(config_file, Some(options)); assert_eq!(config.style_edition(), StyleEdition::Edition2024); - assert_eq!(config.overflow_delimited_expr(), true); } #[nightly_only_test] @@ -872,7 +870,6 @@ mod test { ]); let config = get_config(None, Some(options)); assert_eq!(config.style_edition(), StyleEdition::Edition2024); - assert_eq!(config.overflow_delimited_expr(), true); } #[nightly_only_test] @@ -938,7 +935,6 @@ mod test { options.style_edition = Some(StyleEdition::Edition2024); let config = get_config(None, Some(options)); assert_eq!(config.style_edition(), StyleEdition::Edition2024); - assert_eq!(config.overflow_delimited_expr(), true); } #[nightly_only_test] diff --git a/src/tools/rustfmt/src/config/mod.rs b/src/tools/rustfmt/src/config/mod.rs index 7355adc9f9df1..6b63108c037eb 100644 --- a/src/tools/rustfmt/src/config/mod.rs +++ b/src/tools/rustfmt/src/config/mod.rs @@ -848,7 +848,7 @@ binop_separator = "Front" remove_nested_parens = true combine_control_expr = true short_array_element_width_threshold = 10 -overflow_delimited_expr = true +overflow_delimited_expr = false struct_field_align_threshold = 0 enum_discrim_align_threshold = 0 match_arm_blocks = true diff --git a/src/tools/rustfmt/src/config/options.rs b/src/tools/rustfmt/src/config/options.rs index bbc99a2dced2b..4ae5405e72e5d 100644 --- a/src/tools/rustfmt/src/config/options.rs +++ b/src/tools/rustfmt/src/config/options.rs @@ -627,7 +627,7 @@ config_option_with_style_edition_default!( RemoveNestedParens, bool, _ => true; CombineControlExpr, bool, _ => true; ShortArrayElementWidthThreshold, usize, _ => 10; - OverflowDelimitedExpr, bool, Edition2024 => true, _ => false; + OverflowDelimitedExpr, bool, _ => false; StructFieldAlignThreshold, usize, _ => 0; EnumDiscrimAlignThreshold, usize, _ => 0; MatchArmBlocks, bool, _ => true; 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 deleted file mode 100644 index 5cb4a870fc10a..0000000000000 --- a/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2015.rs +++ /dev/null @@ -1,155 +0,0 @@ -// 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 deleted file mode 100644 index 66c95e71aa9a1..0000000000000 --- a/src/tools/rustfmt/tests/source/configs/style_edition/overflow_delim_expr_2024.rs +++ /dev/null @@ -1,155 +0,0 @@ -// 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/target/configs/style_edition/overflow_delim_expr_2015.rs b/src/tools/rustfmt/tests/target/configs/style_edition/overflow_delim_expr_2015.rs deleted file mode 100644 index 05d4b8b6d334f..0000000000000 --- a/src/tools/rustfmt/tests/target/configs/style_edition/overflow_delim_expr_2015.rs +++ /dev/null @@ -1,135 +0,0 @@ -// 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/target/configs/style_edition/overflow_delim_expr_2024.rs b/src/tools/rustfmt/tests/target/configs/style_edition/overflow_delim_expr_2024.rs deleted file mode 100644 index ecd2e8ca79708..0000000000000 --- a/src/tools/rustfmt/tests/target/configs/style_edition/overflow_delim_expr_2024.rs +++ /dev/null @@ -1,120 +0,0 @@ -// 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(); -}