mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-14 17:48:10 +00:00
Merge pull request #895 from erikjohnston/fn_arg_block_incorrect_indent
Fix incorrect indent with fn_args_layout: Block
This commit is contained in:
commit
c3cef52cde
@ -1339,6 +1339,7 @@ fn rewrite_fn_base(context: &RewriteContext,
|
||||
result.push_str(&arg_str);
|
||||
if context.config.fn_args_layout == StructLitStyle::Block {
|
||||
result.push('\n');
|
||||
result.push_str(&indent.to_string(context.config));
|
||||
}
|
||||
result.push(')');
|
||||
|
||||
|
@ -34,3 +34,9 @@ fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> String where T: UUUUUUUUUUU {
|
||||
fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) -> String where T: UUUUUUUUUUU {
|
||||
bar();
|
||||
}
|
||||
|
||||
trait Test {
|
||||
fn foo(a: u8) {}
|
||||
|
||||
fn bar(a: u8) -> String {}
|
||||
}
|
||||
|
@ -17,3 +17,9 @@ fn foo(a: u8 /* Comment 1 */, b: u8 /* Comment 2 */) -> u8 {
|
||||
fn foo(/* Comment 1 */ a: u8, /* Comment 2 */ b: u8) -> u8 {
|
||||
bar()
|
||||
}
|
||||
|
||||
trait Test {
|
||||
fn foo(a: u8) {}
|
||||
|
||||
fn bar(a: u8) -> String {}
|
||||
}
|
||||
|
24
tests/source/fn_args_layout-block.rs
Normal file
24
tests/source/fn_args_layout-block.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
|
||||
|
||||
fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) {
|
||||
foo();
|
||||
}
|
||||
|
||||
fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) {
|
||||
bar();
|
||||
}
|
||||
|
||||
fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> String {
|
||||
foo();
|
||||
}
|
||||
|
||||
fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) -> String {
|
||||
bar();
|
||||
}
|
||||
|
||||
trait Test {
|
||||
fn foo(a: u8) {}
|
||||
|
||||
fn bar(a: u8) -> String {}
|
||||
}
|
@ -68,3 +68,15 @@ fn bar(
|
||||
where T: UUUUUUUUUUU {
|
||||
bar();
|
||||
}
|
||||
|
||||
trait Test {
|
||||
fn foo(
|
||||
a: u8
|
||||
) {
|
||||
}
|
||||
|
||||
fn bar(
|
||||
a: u8
|
||||
) -> String {
|
||||
}
|
||||
}
|
||||
|
@ -30,3 +30,17 @@ fn foo(
|
||||
{
|
||||
bar()
|
||||
}
|
||||
|
||||
trait Test {
|
||||
fn foo(
|
||||
a: u8
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
fn bar(
|
||||
a: u8
|
||||
) -> String
|
||||
{
|
||||
}
|
||||
}
|
||||
|
46
tests/target/fn_args_layout-block.rs
Normal file
46
tests/target/fn_args_layout-block.rs
Normal file
@ -0,0 +1,46 @@
|
||||
// rustfmt-fn_args_layout: Block
|
||||
|
||||
|
||||
fn foo(
|
||||
a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb
|
||||
) {
|
||||
foo();
|
||||
}
|
||||
|
||||
fn bar(
|
||||
a: Aaaaaaaaaaaaaa,
|
||||
b: Bbbbbbbbbbbbbb,
|
||||
c: Cccccccccccccccccc,
|
||||
d: Dddddddddddddddd,
|
||||
e: Eeeeeeeeeeeeeee
|
||||
) {
|
||||
bar();
|
||||
}
|
||||
|
||||
fn foo(
|
||||
a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb
|
||||
) -> String {
|
||||
foo();
|
||||
}
|
||||
|
||||
fn bar(
|
||||
a: Aaaaaaaaaaaaaa,
|
||||
b: Bbbbbbbbbbbbbb,
|
||||
c: Cccccccccccccccccc,
|
||||
d: Dddddddddddddddd,
|
||||
e: Eeeeeeeeeeeeeee
|
||||
) -> String {
|
||||
bar();
|
||||
}
|
||||
|
||||
trait Test {
|
||||
fn foo(
|
||||
a: u8
|
||||
) {
|
||||
}
|
||||
|
||||
fn bar(
|
||||
a: u8
|
||||
) -> String {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user