Disable overflow_delimited_expr in edition 2024

This commit is contained in:
Michael Goulet 2025-01-30 18:24:02 +00:00
parent e831877c4c
commit 346fef4b3b
4 changed files with 51 additions and 37 deletions

View file

@ -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]
@ -948,6 +944,8 @@ 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);
// FIXME: this test doesn't really exercise anything, since
// `overflow_delimited_expr` is disabled by default in edition 2024.
assert_eq!(config.overflow_delimited_expr(), false);
}
@ -959,7 +957,8 @@ mod test {
options.inline_config =
HashMap::from([("overflow_delimited_expr".to_owned(), "false".to_owned())]);
let config = get_config(config_file, Some(options));
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
// FIXME: this test doesn't really exercise anything, since
// `overflow_delimited_expr` is disabled by default in edition 2024.
assert_eq!(config.overflow_delimited_expr(), false);
}
}

View file

@ -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

View file

@ -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;
@ -644,7 +644,7 @@ config_option_with_style_edition_default!(
BlankLinesLowerBound, usize, _ => 0;
EditionConfig, Edition, _ => Edition::Edition2015;
StyleEditionConfig, StyleEdition,
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
VersionConfig, Version, Edition2024 => Version::Two, _ => Version::One;
InlineAttributeWidth, usize, _ => 0;
FormatGeneratedFiles, bool, _ => true;

View file

@ -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();
}