From c0cccda41ae422c0786ea9bb6a8f5213672260ef Mon Sep 17 00:00:00 2001 From: Yacin Tmimi Date: Tue, 1 Apr 2025 20:04:47 -0400 Subject: [PATCH] revert `overflow_delimited_expr` default for style edition 2024 As of the stabalization of edition 2024 (including style edition 2024) the `overflow_delimited_expr` default was reverted back to `false`. rustfmt hasn't been synced with r-l/rust in a while and not having this config is causing massive diffs in rustfmt's `Diff Check` job. To make the next subtree push easier to verify I'm manually adding this change to the rustfmt tree before the `subtree push`. --- src/bin/main.rs | 9 +-- src/config/mod.rs | 2 +- src/config/options.rs | 2 +- .../style_edition/overflow_delim_expr_2024.rs | 73 +++++++++++-------- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index b72bad873d9..722f45571bf 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -818,7 +818,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] @@ -828,7 +827,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] @@ -873,7 +871,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] @@ -939,7 +936,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] @@ -949,7 +945,6 @@ mod test { let config_file = Some(Path::new("tests/config/style-edition/overrides")); let config = get_config(config_file, Some(options)); assert_eq!(config.style_edition(), StyleEdition::Edition2024); - assert_eq!(config.overflow_delimited_expr(), false); } #[nightly_only_test] @@ -958,9 +953,9 @@ mod test { let mut options = GetOptsOptions::default(); let config_file = Some(Path::new("tests/config/style-edition/just-style-edition")); options.inline_config = - HashMap::from([("overflow_delimited_expr".to_owned(), "false".to_owned())]); + HashMap::from([("overflow_delimited_expr".to_owned(), "true".to_owned())]); let config = get_config(config_file, Some(options)); assert_eq!(config.style_edition(), StyleEdition::Edition2024); - assert_eq!(config.overflow_delimited_expr(), false); + assert_eq!(config.overflow_delimited_expr(), true); } } diff --git a/src/config/mod.rs b/src/config/mod.rs index 742b99c15ef..e381165581e 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -889,7 +889,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/config/options.rs b/src/config/options.rs index 3f86999c30b..b997cff7919 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -660,7 +660,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/tests/target/configs/style_edition/overflow_delim_expr_2024.rs b/tests/target/configs/style_edition/overflow_delim_expr_2024.rs index ecd2e8ca797..1b2d12ce320 100644 --- a/tests/target/configs/style_edition/overflow_delim_expr_2024.rs +++ b/tests/target/configs/style_edition/overflow_delim_expr_2024.rs @@ -25,10 +25,13 @@ fn combine_blocklike() { y: value2, }); - do_thing(x, Bar { - x: value, - y: value2, - }); + do_thing( + x, + Bar { + x: value, + y: value2, + }, + ); do_thing( x, @@ -46,12 +49,15 @@ fn combine_blocklike() { 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, + &[ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); do_thing( x, @@ -71,12 +77,15 @@ fn combine_blocklike() { 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, + vec![ + value_with_longer_name, + value2_with_longer_name, + value3_with_longer_name, + value4_with_longer_name, + ], + ); do_thing( x, @@ -99,22 +108,28 @@ fn combine_blocklike() { } fn combine_struct_sample() { - let identity = verify(&ctx, VerifyLogin { - type_: LoginType::Username, - username: args.username.clone(), - password: Some(args.password.clone()), - domain: None, - })?; + 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, - ]) + .mount( + "/", + routes![ + http::auth::login, + http::auth::logout, + http::cors::options, + http::action::dance, + http::action::sleep, + ], + ) .launch(); }