mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 20:16:49 +00:00
Support where predicates on the same line
This commit is contained in:
parent
6f3c329500
commit
02a01350ff
@ -92,6 +92,7 @@ create_config! {
|
||||
fn_args_layout: Density,
|
||||
fn_arg_indent: BlockIndentStyle,
|
||||
where_indent: BlockIndentStyle, // Visual will be treated like Tabbed
|
||||
where_layout: ListTactic,
|
||||
generics_indent: BlockIndentStyle,
|
||||
struct_trailing_comma: SeparatorTactic,
|
||||
struct_lit_trailing_comma: SeparatorTactic,
|
||||
@ -120,6 +121,7 @@ impl Default for Config {
|
||||
fn_args_layout: Density::Tall,
|
||||
fn_arg_indent: BlockIndentStyle::Visual,
|
||||
where_indent: BlockIndentStyle::Tabbed,
|
||||
where_layout: ListTactic::Vertical,
|
||||
generics_indent: BlockIndentStyle::Visual,
|
||||
struct_trailing_comma: SeparatorTactic::Vertical,
|
||||
struct_lit_trailing_comma: SeparatorTactic::Vertical,
|
||||
|
@ -823,7 +823,7 @@ impl<'a> FmtVisitor<'a> {
|
||||
span_end);
|
||||
|
||||
let fmt = ListFormatting {
|
||||
tactic: ListTactic::Vertical,
|
||||
tactic: self.config.where_layout,
|
||||
separator: ",",
|
||||
trailing_separator: SeparatorTactic::Never,
|
||||
indent: offset,
|
||||
|
@ -28,6 +28,8 @@ pub enum ListTactic {
|
||||
Mixed,
|
||||
}
|
||||
|
||||
impl_enum_decodable!(ListTactic, Vertical, Horizontal, HorizontalVertical, Mixed);
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Copy, Clone)]
|
||||
pub enum SeparatorTactic {
|
||||
Always,
|
||||
|
@ -9,6 +9,7 @@ fn_args_paren_newline = true
|
||||
fn_args_layout = "Tall"
|
||||
fn_arg_indent = "Visual"
|
||||
where_indent = "Tabbed"
|
||||
where_layout = "Vertical"
|
||||
generics_indent = "Visual"
|
||||
struct_trailing_comma = "Vertical"
|
||||
struct_lit_trailing_comma = "Vertical"
|
||||
|
@ -1,6 +1,7 @@
|
||||
// rustfmt-fn_arg_indent: Inherit
|
||||
// rustfmt-generics_indent: Tabbed
|
||||
// rustfmt-where_indent: Inherit
|
||||
// rustfmt-where_layout: Mixed
|
||||
// Test different indents.
|
||||
|
||||
fn foo(a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee) {
|
||||
@ -15,6 +16,10 @@ fn baz() where X: TTTTTTTT {
|
||||
baz();
|
||||
}
|
||||
|
||||
fn qux() where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT {
|
||||
baz();
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn foo(self, a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee) {
|
||||
foo();
|
||||
|
@ -1,5 +1,6 @@
|
||||
// rustfmt-fn_arg_indent: Tabbed
|
||||
// rustfmt-generics_indent: Inherit
|
||||
// rustfmt-where_layout: HorizontalVertical
|
||||
// Test different indents.
|
||||
|
||||
fn foo(a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee) {
|
||||
@ -10,6 +11,14 @@ fn bar<'a: 'bbbbbbbbbbbbbbbbbbbbbbbbbbb, TTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUU: WW
|
||||
bar();
|
||||
}
|
||||
|
||||
fn qux() where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT {
|
||||
baz();
|
||||
}
|
||||
|
||||
fn qux() where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT {
|
||||
baz();
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn foo(self, a: Aaaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbbbb, c: Ccccccccccccccccc, d: Ddddddddddddddddddddddddd, e: Eeeeeeeeeeeeeeeeeee) {
|
||||
foo();
|
||||
|
@ -1,6 +1,7 @@
|
||||
// rustfmt-fn_arg_indent: Inherit
|
||||
// rustfmt-generics_indent: Tabbed
|
||||
// rustfmt-where_indent: Inherit
|
||||
// rustfmt-where_layout: Mixed
|
||||
// Test different indents.
|
||||
|
||||
fn foo(a: Aaaaaaaaaaaaaaa,
|
||||
@ -24,6 +25,13 @@ where X: TTTTTTTT
|
||||
baz();
|
||||
}
|
||||
|
||||
fn qux()
|
||||
where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT,
|
||||
X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
||||
{
|
||||
baz();
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn foo(self,
|
||||
a: Aaaaaaaaaaaaaaa,
|
||||
|
@ -1,5 +1,6 @@
|
||||
// rustfmt-fn_arg_indent: Tabbed
|
||||
// rustfmt-generics_indent: Inherit
|
||||
// rustfmt-where_layout: HorizontalVertical
|
||||
// Test different indents.
|
||||
|
||||
fn foo(a: Aaaaaaaaaaaaaaa,
|
||||
@ -17,6 +18,21 @@ UUUUUUUUUUUUUUUUUUUU: WWWWWWWWWWWWWWWWWWWWWWWW>
|
||||
bar();
|
||||
}
|
||||
|
||||
fn qux()
|
||||
where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT, X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
||||
{
|
||||
baz();
|
||||
}
|
||||
|
||||
fn qux()
|
||||
where X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT,
|
||||
X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT,
|
||||
X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT,
|
||||
X: TTTTTTTTTTTTTTTTTTTTTTTTTTTT
|
||||
{
|
||||
baz();
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn foo(self,
|
||||
a: Aaaaaaaaaaaaaaa,
|
||||
|
Loading…
Reference in New Issue
Block a user