forked from rust-lang/rustfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement 2024 Style Edition for expr overflows
- Loading branch information
1 parent
676b64b
commit 4579a63
Showing
9 changed files
with
602 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
error_on_line_overflow = true | ||
error_on_unformatted = true | ||
style_edition = "2024" | ||
overflow_delimited_expr = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
style_edition = "2024" | ||
overflow_delimited_expr = false |
155 changes: 155 additions & 0 deletions
155
tests/source/configs/style_edition/overflow_delim_expr_2015.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
155 changes: 155 additions & 0 deletions
155
tests/source/configs/style_edition/overflow_delim_expr_2024.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
Oops, something went wrong.