mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
Try multi-line only when fn_call_style is Block and rewriting function call
This commit is contained in:
parent
18070f4041
commit
ba1a7b9e7f
@ -1779,7 +1779,12 @@ fn rewrite_call_args(context: &RewriteContext,
|
||||
};
|
||||
|
||||
match write_list(&item_vec, &fmt) {
|
||||
Some(ref s) if !s.contains('\n') && s.len() > one_line_width => {
|
||||
// If arguments do not fit in a single line and do not contain newline,
|
||||
// try to put it on the next line. Try this only when we are in block mode
|
||||
// and not rewriting macro.
|
||||
Some(ref s) if context.config.fn_call_style == IndentStyle::Block &&
|
||||
!force_no_trailing_comma &&
|
||||
(!s.contains('\n') && s.len() > one_line_width) => {
|
||||
fmt.trailing_separator = SeparatorTactic::Vertical;
|
||||
write_list(&item_vec, &fmt)
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Block
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
||||
panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Visual
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
||||
panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Block
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
||||
panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-fn_call_style: Visual
|
||||
|
||||
// rustfmt should not add trailing comma when rewriting macro. See #1528.
|
||||
fn a() {
|
||||
panic!("this is a long string that goes past the maximum line length causing rustfmt to insert a comma here:");
|
||||
}
|
Loading…
Reference in New Issue
Block a user