Skip to content

Commit 346fef4

Browse files
Disable overflow_delimited_expr in edition 2024
1 parent e831877 commit 346fef4

File tree

4 files changed

+51
-37
lines changed

4 files changed

+51
-37
lines changed

Diff for: src/tools/rustfmt/src/bin/main.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,6 @@ mod test {
817817
options.inline_config = HashMap::from([("version".to_owned(), "Two".to_owned())]);
818818
let config = get_config(None, Some(options));
819819
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
820-
assert_eq!(config.overflow_delimited_expr(), true);
821820
}
822821

823822
#[nightly_only_test]
@@ -827,7 +826,6 @@ mod test {
827826
let config_file = Some(Path::new("tests/config/style-edition/just-version"));
828827
let config = get_config(config_file, Some(options));
829828
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
830-
assert_eq!(config.overflow_delimited_expr(), true);
831829
}
832830

833831
#[nightly_only_test]
@@ -872,7 +870,6 @@ mod test {
872870
]);
873871
let config = get_config(None, Some(options));
874872
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
875-
assert_eq!(config.overflow_delimited_expr(), true);
876873
}
877874

878875
#[nightly_only_test]
@@ -938,7 +935,6 @@ mod test {
938935
options.style_edition = Some(StyleEdition::Edition2024);
939936
let config = get_config(None, Some(options));
940937
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
941-
assert_eq!(config.overflow_delimited_expr(), true);
942938
}
943939

944940
#[nightly_only_test]
@@ -948,6 +944,8 @@ mod test {
948944
let config_file = Some(Path::new("tests/config/style-edition/overrides"));
949945
let config = get_config(config_file, Some(options));
950946
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
947+
// FIXME: this test doesn't really exercise anything, since
948+
// `overflow_delimited_expr` is disabled by default in edition 2024.
951949
assert_eq!(config.overflow_delimited_expr(), false);
952950
}
953951

@@ -959,7 +957,8 @@ mod test {
959957
options.inline_config =
960958
HashMap::from([("overflow_delimited_expr".to_owned(), "false".to_owned())]);
961959
let config = get_config(config_file, Some(options));
962-
assert_eq!(config.style_edition(), StyleEdition::Edition2024);
960+
// FIXME: this test doesn't really exercise anything, since
961+
// `overflow_delimited_expr` is disabled by default in edition 2024.
963962
assert_eq!(config.overflow_delimited_expr(), false);
964963
}
965964
}

Diff for: src/tools/rustfmt/src/config/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ binop_separator = "Front"
848848
remove_nested_parens = true
849849
combine_control_expr = true
850850
short_array_element_width_threshold = 10
851-
overflow_delimited_expr = true
851+
overflow_delimited_expr = false
852852
struct_field_align_threshold = 0
853853
enum_discrim_align_threshold = 0
854854
match_arm_blocks = true

Diff for: src/tools/rustfmt/src/config/options.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ config_option_with_style_edition_default!(
627627
RemoveNestedParens, bool, _ => true;
628628
CombineControlExpr, bool, _ => true;
629629
ShortArrayElementWidthThreshold, usize, _ => 10;
630-
OverflowDelimitedExpr, bool, Edition2024 => true, _ => false;
630+
OverflowDelimitedExpr, bool, _ => false;
631631
StructFieldAlignThreshold, usize, _ => 0;
632632
EnumDiscrimAlignThreshold, usize, _ => 0;
633633
MatchArmBlocks, bool, _ => true;
@@ -644,7 +644,7 @@ config_option_with_style_edition_default!(
644644
BlankLinesLowerBound, usize, _ => 0;
645645
EditionConfig, Edition, _ => Edition::Edition2015;
646646
StyleEditionConfig, StyleEdition,
647-
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
647+
Edition2024 => StyleEdition::Edition2024, _ => StyleEdition::Edition2015;
648648
VersionConfig, Version, Edition2024 => Version::Two, _ => Version::One;
649649
InlineAttributeWidth, usize, _ => 0;
650650
FormatGeneratedFiles, bool, _ => true;

Diff for: src/tools/rustfmt/tests/target/configs/style_edition/overflow_delim_expr_2024.rs

+44-29
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ fn combine_blocklike() {
2525
y: value2,
2626
});
2727

28-
do_thing(x, Bar {
29-
x: value,
30-
y: value2,
31-
});
28+
do_thing(
29+
x,
30+
Bar {
31+
x: value,
32+
y: value2,
33+
},
34+
);
3235

3336
do_thing(
3437
x,
@@ -46,12 +49,15 @@ fn combine_blocklike() {
4649
value4_with_longer_name,
4750
]);
4851

49-
do_thing(x, &[
50-
value_with_longer_name,
51-
value2_with_longer_name,
52-
value3_with_longer_name,
53-
value4_with_longer_name,
54-
]);
52+
do_thing(
53+
x,
54+
&[
55+
value_with_longer_name,
56+
value2_with_longer_name,
57+
value3_with_longer_name,
58+
value4_with_longer_name,
59+
],
60+
);
5561

5662
do_thing(
5763
x,
@@ -71,12 +77,15 @@ fn combine_blocklike() {
7177
value4_with_longer_name,
7278
]);
7379

74-
do_thing(x, vec![
75-
value_with_longer_name,
76-
value2_with_longer_name,
77-
value3_with_longer_name,
78-
value4_with_longer_name,
79-
]);
80+
do_thing(
81+
x,
82+
vec![
83+
value_with_longer_name,
84+
value2_with_longer_name,
85+
value3_with_longer_name,
86+
value4_with_longer_name,
87+
],
88+
);
8089

8190
do_thing(
8291
x,
@@ -99,22 +108,28 @@ fn combine_blocklike() {
99108
}
100109

101110
fn combine_struct_sample() {
102-
let identity = verify(&ctx, VerifyLogin {
103-
type_: LoginType::Username,
104-
username: args.username.clone(),
105-
password: Some(args.password.clone()),
106-
domain: None,
107-
})?;
111+
let identity = verify(
112+
&ctx,
113+
VerifyLogin {
114+
type_: LoginType::Username,
115+
username: args.username.clone(),
116+
password: Some(args.password.clone()),
117+
domain: None,
118+
},
119+
)?;
108120
}
109121

110122
fn combine_macro_sample() {
111123
rocket::ignite()
112-
.mount("/", routes![
113-
http::auth::login,
114-
http::auth::logout,
115-
http::cors::options,
116-
http::action::dance,
117-
http::action::sleep,
118-
])
124+
.mount(
125+
"/",
126+
routes![
127+
http::auth::login,
128+
http::auth::logout,
129+
http::cors::options,
130+
http::action::dance,
131+
http::action::sleep,
132+
],
133+
)
119134
.launch();
120135
}

0 commit comments

Comments
 (0)