From 96f3c36c0479121c6cb4a48496f117e85997ba65 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:09:59 +0900 Subject: [PATCH 01/12] Replace '_indent' with 'indent_style' --- tests/config/small_tabs.toml | 5 +---- tests/source/big-impl-rfc.rs | 5 +---- tests/source/closure-block-inside-macro.rs | 2 +- ...nfigs-array_horizontal_layout_threshold-1000-visual.rs | 2 +- tests/source/configs-array_indent-block.rs | 2 +- tests/source/configs-array_indent-visual.rs | 2 +- tests/source/configs-fn_args_indent-block.rs | 2 +- tests/source/configs-fn_args_indent-visual.rs | 2 +- .../source/configs-fn_call_indent-block-trailing-comma.rs | 2 +- tests/source/configs-fn_call_indent-block.rs | 2 +- .../configs-fn_call_indent-visual-trailing-comma.rs | 2 +- tests/source/configs-fn_call_indent-visual.rs | 2 +- tests/source/configs-fn_call_width-zero.rs | 2 +- tests/source/configs-generics_indent-block.rs | 2 +- tests/source/configs-generics_indent-visual.rs | 2 +- tests/source/configs-struct_lit_indent-block.rs | 2 +- tests/source/configs-struct_lit_indent-visual.rs | 2 +- tests/source/configs-tab_spaces-2.rs | 2 +- tests/source/configs-tab_spaces-4.rs | 2 +- tests/source/configs-where_pred_indent-block.rs | 2 +- tests/source/configs-where_pred_indent-visual.rs | 2 +- tests/source/configs-where_style-default.rs | 2 +- tests/source/configs-where_style-rfc.rs | 2 +- tests/source/expr-block.rs | 4 +--- tests/source/fn-custom-2.rs | 3 +-- tests/source/fn-custom-3.rs | 3 +-- tests/source/fn-custom-4.rs | 2 +- tests/source/fn-custom-6.rs | 2 +- tests/source/fn-custom-7.rs | 2 +- tests/source/fn-custom-8.rs | 2 +- tests/source/fn_args_indent-block.rs | 2 +- tests/source/issue-1278.rs | 2 +- tests/source/struct_lits_visual.rs | 2 +- tests/source/struct_lits_visual_multiline.rs | 2 +- tests/source/struct_tuple_visual.rs | 2 +- tests/source/where-clause-rfc.rs | 3 +-- tests/target/big-impl-rfc.rs | 8 ++++---- tests/target/closure-block-inside-macro.rs | 2 +- ...nfigs-array_horizontal_layout_threshold-1000-visual.rs | 2 +- tests/target/configs-array_indent-block.rs | 2 +- tests/target/configs-array_indent-visual.rs | 2 +- tests/target/configs-combine_control_expr-false.rs | 2 +- tests/target/configs-combine_control_expr-true.rs | 2 +- tests/target/configs-control_style-rfc.rs | 2 +- tests/target/configs-fn_args_indent-block.rs | 2 +- tests/target/configs-fn_args_indent-visual.rs | 2 +- tests/target/configs-fn_call_indent-block-tab_spaces-2.rs | 2 +- .../target/configs-fn_call_indent-block-trailing-comma.rs | 2 +- tests/target/configs-fn_call_indent-block.rs | 2 +- .../configs-fn_call_indent-visual-trailing-comma.rs | 2 +- tests/target/configs-fn_call_indent-visual.rs | 2 +- tests/target/configs-fn_call_width-zero.rs | 2 +- tests/target/configs-generics_indent-block.rs | 2 +- tests/target/configs-generics_indent-visual.rs | 2 +- tests/target/configs-imports_indent-block.rs | 2 +- .../target/configs-imports_layout-horizontal_vertical.rs | 2 +- tests/target/configs-imports_layout-mixed.rs | 2 +- tests/target/configs-struct_lit_indent-block.rs | 2 +- tests/target/configs-struct_lit_indent-visual.rs | 2 +- tests/target/configs-tab_spaces-2.rs | 2 +- tests/target/configs-tab_spaces-4.rs | 2 +- tests/target/configs-where_pred_indent-block.rs | 2 +- tests/target/configs-where_pred_indent-visual.rs | 2 +- tests/target/configs-where_style-default.rs | 2 +- tests/target/configs-where_style-rfc.rs | 2 +- tests/target/expr-block.rs | 4 +--- tests/target/fn-custom-2.rs | 3 +-- tests/target/fn-custom-3.rs | 3 +-- tests/target/fn-custom-4.rs | 2 +- tests/target/fn-custom-6.rs | 2 +- tests/target/fn-custom-7.rs | 2 +- tests/target/fn-custom-8.rs | 2 +- tests/target/fn_args_indent-block.rs | 2 +- tests/target/issue-1278.rs | 2 +- tests/target/issue-1624.rs | 2 +- tests/target/struct_lits_visual.rs | 2 +- tests/target/struct_lits_visual_multiline.rs | 2 +- tests/target/struct_tuple_visual.rs | 2 +- tests/target/where-clause-rfc.rs | 3 +-- 79 files changed, 82 insertions(+), 98 deletions(-) diff --git a/tests/config/small_tabs.toml b/tests/config/small_tabs.toml index d48810bd5784..264591bc4008 100644 --- a/tests/config/small_tabs.toml +++ b/tests/config/small_tabs.toml @@ -6,13 +6,10 @@ fn_brace_style = "SameLineWhere" fn_return_indent = "WithArgs" fn_args_paren_newline = true fn_args_density = "Tall" -fn_args_indent = "Visual" where_density = "Tall" where_layout = "Vertical" -where_pred_indent = "Visual" -generics_indent = "Visual" trailing_comma = "Vertical" -struct_lit_indent = "Block" +indent_style = "Block" report_todo = "Always" report_fixme = "Never" reorder_imports = false diff --git a/tests/source/big-impl-rfc.rs b/tests/source/big-impl-rfc.rs index 86812fd5379d..737dd5aeb6a7 100644 --- a/tests/source/big-impl-rfc.rs +++ b/tests/source/big-impl-rfc.rs @@ -1,7 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-fn_call_indent: Block -// rustfmt-generics_indent: Block -// rustfmt-where_style: Rfc +// rustfmt-indent_style: Block // #1357 impl< diff --git a/tests/source/closure-block-inside-macro.rs b/tests/source/closure-block-inside-macro.rs index 2f7e04957e91..c1260592083a 100644 --- a/tests/source/closure-block-inside-macro.rs +++ b/tests/source/closure-block-inside-macro.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // #1547 fuzz_target!(|data: &[u8]| if let Some(first) = data.first() { diff --git a/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs b/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs index 84cfb06bcedb..3036f3598ef2 100644 --- a/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs +++ b/tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs @@ -1,5 +1,5 @@ // rustfmt-array_horizontal_layout_threshold: 1000 -// rustfmt-array_indent: Visual +// rustfmt-indent_style: Visual const ARRAY: [u8; 2048] = [99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, diff --git a/tests/source/configs-array_indent-block.rs b/tests/source/configs-array_indent-block.rs index 7aefa36c187d..8404f65f471c 100644 --- a/tests/source/configs-array_indent-block.rs +++ b/tests/source/configs-array_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-array_indent: Block +// rustfmt-indent_style: Block // Array layout fn main() { diff --git a/tests/source/configs-array_indent-visual.rs b/tests/source/configs-array_indent-visual.rs index f448e9607d70..05bbf00b1d27 100644 --- a/tests/source/configs-array_indent-visual.rs +++ b/tests/source/configs-array_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-array_indent: Visual +// rustfmt-indent_style: Visual // Array layout fn main() { diff --git a/tests/source/configs-fn_args_indent-block.rs b/tests/source/configs-fn_args_indent-block.rs index 169a538d70db..4d2d280a16bc 100644 --- a/tests/source/configs-fn_args_indent-block.rs +++ b/tests/source/configs-fn_args_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // Function arguments layout fn lorem() {} diff --git a/tests/source/configs-fn_args_indent-visual.rs b/tests/source/configs-fn_args_indent-visual.rs index adc1466bffcb..5aa28a62b9ce 100644 --- a/tests/source/configs-fn_args_indent-visual.rs +++ b/tests/source/configs-fn_args_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Visual +// rustfmt-indent_style: Visual // Function arguments layout fn lorem() {} diff --git a/tests/source/configs-fn_call_indent-block-trailing-comma.rs b/tests/source/configs-fn_call_indent-block-trailing-comma.rs index 9d948594d8b4..c907ec50d458 100644 --- a/tests/source/configs-fn_call_indent-block-trailing-comma.rs +++ b/tests/source/configs-fn_call_indent-block-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/source/configs-fn_call_indent-block.rs b/tests/source/configs-fn_call_indent-block.rs index 76ccb0015959..c82b6b8e38f8 100644 --- a/tests/source/configs-fn_call_indent-block.rs +++ b/tests/source/configs-fn_call_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // Function call style fn main() { diff --git a/tests/source/configs-fn_call_indent-visual-trailing-comma.rs b/tests/source/configs-fn_call_indent-visual-trailing-comma.rs index d6d1a86a631b..9738d397dbf6 100644 --- a/tests/source/configs-fn_call_indent-visual-trailing-comma.rs +++ b/tests/source/configs-fn_call_indent-visual-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_indent: Visual +// rustfmt-indent_style: Visual // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/source/configs-fn_call_indent-visual.rs b/tests/source/configs-fn_call_indent-visual.rs index 9561ffae23b8..9a679d6bb4c9 100644 --- a/tests/source/configs-fn_call_indent-visual.rs +++ b/tests/source/configs-fn_call_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Visual +// rustfmt-indent_style: Visual // Function call style fn main() { diff --git a/tests/source/configs-fn_call_width-zero.rs b/tests/source/configs-fn_call_width-zero.rs index da227dec4c78..e7db32615568 100644 --- a/tests/source/configs-fn_call_width-zero.rs +++ b/tests/source/configs-fn_call_width-zero.rs @@ -1,5 +1,5 @@ // rustfmt-fn_call_width: 0 -// rustfmt-fn_call_indent: block +// rustfmt-indent_style: block // #1508 fn a() { diff --git a/tests/source/configs-generics_indent-block.rs b/tests/source/configs-generics_indent-block.rs index 9bfde87e88b0..2cf17be56eff 100644 --- a/tests/source/configs-generics_indent-block.rs +++ b/tests/source/configs-generics_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-generics_indent: Block +// rustfmt-indent_style: Block // Generics indent fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, elit: Elit) -> T { diff --git a/tests/source/configs-generics_indent-visual.rs b/tests/source/configs-generics_indent-visual.rs index 3129dc1c3c76..1f910d32d87a 100644 --- a/tests/source/configs-generics_indent-visual.rs +++ b/tests/source/configs-generics_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-generics_indent: Visual +// rustfmt-indent_style: Visual // Generics indent fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, elit: Elit) -> T { diff --git a/tests/source/configs-struct_lit_indent-block.rs b/tests/source/configs-struct_lit_indent-block.rs index 4f66c192bbce..47a6994f40ca 100644 --- a/tests/source/configs-struct_lit_indent-block.rs +++ b/tests/source/configs-struct_lit_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-struct_lit_indent: Block +// rustfmt-indent_style: Block // Struct literal-style fn main() { diff --git a/tests/source/configs-struct_lit_indent-visual.rs b/tests/source/configs-struct_lit_indent-visual.rs index 837ae1b40cbe..45538e70482d 100644 --- a/tests/source/configs-struct_lit_indent-visual.rs +++ b/tests/source/configs-struct_lit_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual // Struct literal-style fn main() { diff --git a/tests/source/configs-tab_spaces-2.rs b/tests/source/configs-tab_spaces-2.rs index cd3d601e1b65..5c2667bc2c79 100644 --- a/tests/source/configs-tab_spaces-2.rs +++ b/tests/source/configs-tab_spaces-2.rs @@ -1,6 +1,6 @@ // rustfmt-tab_spaces: 2 // rustfmt-max_width: 30 -// rustfmt-array_indent: Block +// rustfmt-indent_style: Block // Tab spaces fn lorem() { diff --git a/tests/source/configs-tab_spaces-4.rs b/tests/source/configs-tab_spaces-4.rs index 3a18f9be0eee..da61bbd42a7c 100644 --- a/tests/source/configs-tab_spaces-4.rs +++ b/tests/source/configs-tab_spaces-4.rs @@ -1,6 +1,6 @@ // rustfmt-tab_spaces: 4 // rustfmt-max_width: 30 -// rustfmt-array_indent: Block +// rustfmt-indent_style: Block // Tab spaces fn lorem() { diff --git a/tests/source/configs-where_pred_indent-block.rs b/tests/source/configs-where_pred_indent-block.rs index 8474dc4dd01c..450491f02705 100644 --- a/tests/source/configs-where_pred_indent-block.rs +++ b/tests/source/configs-where_pred_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-where_pred_indent: Block +// rustfmt-indent_style: Block // Where predicate indent fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/source/configs-where_pred_indent-visual.rs b/tests/source/configs-where_pred_indent-visual.rs index 79b7a3710475..055806b68629 100644 --- a/tests/source/configs-where_pred_indent-visual.rs +++ b/tests/source/configs-where_pred_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-where_pred_indent: Visual +// rustfmt-indent_style: Visual // Where predicate indent fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/source/configs-where_style-default.rs b/tests/source/configs-where_style-default.rs index e082f863f330..34fa216cb804 100644 --- a/tests/source/configs-where_style-default.rs +++ b/tests/source/configs-where_style-default.rs @@ -1,4 +1,4 @@ -// rustfmt-where_style: Legacy +// rustfmt-indent_style: Legacy // Where style fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/source/configs-where_style-rfc.rs b/tests/source/configs-where_style-rfc.rs index 7b93cc9514a2..24f4a7c7ea86 100644 --- a/tests/source/configs-where_style-rfc.rs +++ b/tests/source/configs-where_style-rfc.rs @@ -1,4 +1,4 @@ -// rustfmt-where_style: Rfc +// rustfmt-indent_style: Rfc // Where style fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/source/expr-block.rs b/tests/source/expr-block.rs index 3d46e3a98014..a2e7ac8fc441 100644 --- a/tests/source/expr-block.rs +++ b/tests/source/expr-block.rs @@ -1,6 +1,4 @@ -// rustfmt-array_indent: Block -// rustfmt-fn_call_indent: Block -// rustfmt-control_style: Rfc +// rustfmt-indent_style: Block // Test expressions with block formatting. fn arrays() { diff --git a/tests/source/fn-custom-2.rs b/tests/source/fn-custom-2.rs index bdbbb45aaa05..4fb427a1b1ff 100644 --- a/tests/source/fn-custom-2.rs +++ b/tests/source/fn-custom-2.rs @@ -1,5 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-generics_indent: Block +// rustfmt-indent_style: Block // rustfmt-where_layout: Mixed // Test different indents. diff --git a/tests/source/fn-custom-3.rs b/tests/source/fn-custom-3.rs index 2d05b1138f2f..efaf559c9daa 100644 --- a/tests/source/fn-custom-3.rs +++ b/tests/source/fn-custom-3.rs @@ -1,5 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-generics_indent: Block +// rustfmt-indent_style: Block // rustfmt-where_layout: HorizontalVertical // Test different indents. diff --git a/tests/source/fn-custom-4.rs b/tests/source/fn-custom-4.rs index 009ceb87c2b7..668cdce382d3 100644 --- a/tests/source/fn-custom-4.rs +++ b/tests/source/fn-custom-4.rs @@ -1,4 +1,4 @@ -// rustfmt-where_pred_indent: Block +// rustfmt-indent_style: Block // rustfmt-where_density: Compressed // Test different indents. diff --git a/tests/source/fn-custom-6.rs b/tests/source/fn-custom-6.rs index b8677e4bbec1..f345e1cb3e98 100644 --- a/tests/source/fn-custom-6.rs +++ b/tests/source/fn-custom-6.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_brace_style: PreferSameLine // Test different indents. diff --git a/tests/source/fn-custom-7.rs b/tests/source/fn-custom-7.rs index fceb4152575f..03b9a895970c 100644 --- a/tests/source/fn-custom-7.rs +++ b/tests/source/fn-custom-7.rs @@ -1,5 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_args_density: Vertical // rustfmt-fn_brace_style: AlwaysNextLine diff --git a/tests/source/fn-custom-8.rs b/tests/source/fn-custom-8.rs index fbc411919c7a..40ea44f084ac 100644 --- a/tests/source/fn-custom-8.rs +++ b/tests/source/fn-custom-8.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_brace_style: PreferSameLine // Test different indents. diff --git a/tests/source/fn_args_indent-block.rs b/tests/source/fn_args_indent-block.rs index 4368274cc849..b056fcb56fe6 100644 --- a/tests/source/fn_args_indent-block.rs +++ b/tests/source/fn_args_indent-block.rs @@ -1,5 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block fn foo() { foo(); diff --git a/tests/source/issue-1278.rs b/tests/source/issue-1278.rs index d199773c8345..e25376561a94 100644 --- a/tests/source/issue-1278.rs +++ b/tests/source/issue-1278.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent = "block" +// rustfmt-indent_style = "block" #![feature(pub_restricted)] diff --git a/tests/source/struct_lits_visual.rs b/tests/source/struct_lits_visual.rs index de083183ab93..2c6cc6749605 100644 --- a/tests/source/struct_lits_visual.rs +++ b/tests/source/struct_lits_visual.rs @@ -1,6 +1,6 @@ // rustfmt-normalize_comments: true // rustfmt-wrap_comments: true -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual // rustfmt-error_on_line_overflow: false // Struct literal expressions. diff --git a/tests/source/struct_lits_visual_multiline.rs b/tests/source/struct_lits_visual_multiline.rs index e8af1486f366..074853cf3dae 100644 --- a/tests/source/struct_lits_visual_multiline.rs +++ b/tests/source/struct_lits_visual_multiline.rs @@ -1,6 +1,6 @@ // rustfmt-normalize_comments: true // rustfmt-wrap_comments: true -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual // rustfmt-struct_lit_multiline_style: ForceMulti // rustfmt-error_on_line_overflow: false diff --git a/tests/source/struct_tuple_visual.rs b/tests/source/struct_tuple_visual.rs index 2bc2c11d333c..369feae71d25 100644 --- a/tests/source/struct_tuple_visual.rs +++ b/tests/source/struct_tuple_visual.rs @@ -1,7 +1,7 @@ // rustfmt-normalize_comments: true // rustfmt-wrap_comments: true // rustfmt-error_on_line_overflow: false -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual fn foo() { Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b()); diff --git a/tests/source/where-clause-rfc.rs b/tests/source/where-clause-rfc.rs index 7dc5e87a9fe0..e41e9a6cea1c 100644 --- a/tests/source/where-clause-rfc.rs +++ b/tests/source/where-clause-rfc.rs @@ -1,5 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-where_style: Rfc +// rustfmt-indent_style: Block fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape) where T: FOo, U: Bar { let mut effects = HashMap::new(); diff --git a/tests/target/big-impl-rfc.rs b/tests/target/big-impl-rfc.rs index b5c7b376f785..6c21f8a22e43 100644 --- a/tests/target/big-impl-rfc.rs +++ b/tests/target/big-impl-rfc.rs @@ -1,7 +1,7 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-fn_call_indent: Block -// rustfmt-generics_indent: Block -// rustfmt-where_style: Rfc +// rustfmt-indent_style: Block +// rustfmt-indent_style: Block +// rustfmt-indent_style: Block +// rustfmt-indent_style: Rfc // #1357 impl<'a, Select, From, Distinct, Where, Order, Limit, Offset, Groupby, DB> InternalBoxedDsl<'a, DB> diff --git a/tests/target/closure-block-inside-macro.rs b/tests/target/closure-block-inside-macro.rs index 2f7e04957e91..c1260592083a 100644 --- a/tests/target/closure-block-inside-macro.rs +++ b/tests/target/closure-block-inside-macro.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // #1547 fuzz_target!(|data: &[u8]| if let Some(first) = data.first() { diff --git a/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs b/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs index a4a2f6a3d2c3..78a3c828c5d2 100644 --- a/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs +++ b/tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs @@ -1,5 +1,5 @@ // rustfmt-array_horizontal_layout_threshold: 1000 -// rustfmt-array_indent: Visual +// rustfmt-indent_style: Visual const ARRAY: [u8; 2048] = [99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, 21, 18, 37, diff --git a/tests/target/configs-array_indent-block.rs b/tests/target/configs-array_indent-block.rs index c6c220967595..5d458248c0b9 100644 --- a/tests/target/configs-array_indent-block.rs +++ b/tests/target/configs-array_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-array_indent: Block +// rustfmt-indent_style: Block // Array layout fn main() { diff --git a/tests/target/configs-array_indent-visual.rs b/tests/target/configs-array_indent-visual.rs index bd15f2a37378..1da6ff237387 100644 --- a/tests/target/configs-array_indent-visual.rs +++ b/tests/target/configs-array_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-array_indent: Visual +// rustfmt-indent_style: Visual // Array layout fn main() { diff --git a/tests/target/configs-combine_control_expr-false.rs b/tests/target/configs-combine_control_expr-false.rs index 432b2a03960c..81eff08660d1 100644 --- a/tests/target/configs-combine_control_expr-false.rs +++ b/tests/target/configs-combine_control_expr-false.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // rustfmt-combine_control_expr: false // Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61. diff --git a/tests/target/configs-combine_control_expr-true.rs b/tests/target/configs-combine_control_expr-true.rs index 58db874a8250..c5372c2ff376 100644 --- a/tests/target/configs-combine_control_expr-true.rs +++ b/tests/target/configs-combine_control_expr-true.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // rustfmt-combine_control_expr: true // Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61. diff --git a/tests/target/configs-control_style-rfc.rs b/tests/target/configs-control_style-rfc.rs index 37da727b2a1d..f2023bcbc5ba 100644 --- a/tests/target/configs-control_style-rfc.rs +++ b/tests/target/configs-control_style-rfc.rs @@ -1,4 +1,4 @@ -// rustfmt-control_style: Rfc +// rustfmt-indent_style: Rfc // #1618 fn main() { diff --git a/tests/target/configs-fn_args_indent-block.rs b/tests/target/configs-fn_args_indent-block.rs index 407a078596dd..80f4e133356c 100644 --- a/tests/target/configs-fn_args_indent-block.rs +++ b/tests/target/configs-fn_args_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // Function arguments layout fn lorem() {} diff --git a/tests/target/configs-fn_args_indent-visual.rs b/tests/target/configs-fn_args_indent-visual.rs index fedea41662ad..04c2eaee3cf2 100644 --- a/tests/target/configs-fn_args_indent-visual.rs +++ b/tests/target/configs-fn_args_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Visual +// rustfmt-indent_style: Visual // Function arguments layout fn lorem() {} diff --git a/tests/target/configs-fn_call_indent-block-tab_spaces-2.rs b/tests/target/configs-fn_call_indent-block-tab_spaces-2.rs index 238ab10060eb..5531e61ddc8c 100644 --- a/tests/target/configs-fn_call_indent-block-tab_spaces-2.rs +++ b/tests/target/configs-fn_call_indent-block-tab_spaces-2.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // rustfmt-max_width: 80 // rustfmt-tab_spaces: 2 diff --git a/tests/target/configs-fn_call_indent-block-trailing-comma.rs b/tests/target/configs-fn_call_indent-block-trailing-comma.rs index c7609d8e4621..a7e8590ed97a 100644 --- a/tests/target/configs-fn_call_indent-block-trailing-comma.rs +++ b/tests/target/configs-fn_call_indent-block-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/target/configs-fn_call_indent-block.rs b/tests/target/configs-fn_call_indent-block.rs index 0f9cbfcc0e30..905d34a09780 100644 --- a/tests/target/configs-fn_call_indent-block.rs +++ b/tests/target/configs-fn_call_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Block +// rustfmt-indent_style: Block // Function call style fn main() { diff --git a/tests/target/configs-fn_call_indent-visual-trailing-comma.rs b/tests/target/configs-fn_call_indent-visual-trailing-comma.rs index d6d1a86a631b..9738d397dbf6 100644 --- a/tests/target/configs-fn_call_indent-visual-trailing-comma.rs +++ b/tests/target/configs-fn_call_indent-visual-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_indent: Visual +// rustfmt-indent_style: Visual // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/target/configs-fn_call_indent-visual.rs b/tests/target/configs-fn_call_indent-visual.rs index 3a1e53a22746..5454c44ef965 100644 --- a/tests/target/configs-fn_call_indent-visual.rs +++ b/tests/target/configs-fn_call_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_indent: Visual +// rustfmt-indent_style: Visual // Function call style fn main() { diff --git a/tests/target/configs-fn_call_width-zero.rs b/tests/target/configs-fn_call_width-zero.rs index f91a03c81883..1455ecd967c8 100644 --- a/tests/target/configs-fn_call_width-zero.rs +++ b/tests/target/configs-fn_call_width-zero.rs @@ -1,5 +1,5 @@ // rustfmt-fn_call_width: 0 -// rustfmt-fn_call_indent: block +// rustfmt-indent_style: block // #1508 fn a() { diff --git a/tests/target/configs-generics_indent-block.rs b/tests/target/configs-generics_indent-block.rs index 0950a716fde7..c4fcaaf65d1c 100644 --- a/tests/target/configs-generics_indent-block.rs +++ b/tests/target/configs-generics_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-generics_indent: Block +// rustfmt-indent_style: Block // Generics indent fn lorem< diff --git a/tests/target/configs-generics_indent-visual.rs b/tests/target/configs-generics_indent-visual.rs index 1160772f29f5..5ea1c9143893 100644 --- a/tests/target/configs-generics_indent-visual.rs +++ b/tests/target/configs-generics_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-generics_indent: Visual +// rustfmt-indent_style: Visual // Generics indent fn lorem() -> T diff --git a/tests/target/configs-where_pred_indent-visual.rs b/tests/target/configs-where_pred_indent-visual.rs index 11da3a3ba859..b878d726dffd 100644 --- a/tests/target/configs-where_pred_indent-visual.rs +++ b/tests/target/configs-where_pred_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-where_pred_indent: Visual +// rustfmt-indent_style: Visual // Where predicate indent fn lorem() -> T diff --git a/tests/target/configs-where_style-default.rs b/tests/target/configs-where_style-default.rs index 2971ac4c5e6b..a4bdee0183da 100644 --- a/tests/target/configs-where_style-default.rs +++ b/tests/target/configs-where_style-default.rs @@ -1,4 +1,4 @@ -// rustfmt-where_style: Legacy +// rustfmt-indent_style: Legacy // Where style fn lorem() -> T diff --git a/tests/target/configs-where_style-rfc.rs b/tests/target/configs-where_style-rfc.rs index 0d5fe5ca51e5..5d4edfd107c4 100644 --- a/tests/target/configs-where_style-rfc.rs +++ b/tests/target/configs-where_style-rfc.rs @@ -1,4 +1,4 @@ -// rustfmt-where_style: Rfc +// rustfmt-indent_style: Rfc // Where style fn lorem() -> T diff --git a/tests/target/expr-block.rs b/tests/target/expr-block.rs index a76c761f1dc3..646569e15f19 100644 --- a/tests/target/expr-block.rs +++ b/tests/target/expr-block.rs @@ -1,6 +1,4 @@ -// rustfmt-array_indent: Block -// rustfmt-fn_call_indent: Block -// rustfmt-control_style: Rfc +// rustfmt-indent_style: Block // Test expressions with block formatting. fn arrays() { diff --git a/tests/target/fn-custom-2.rs b/tests/target/fn-custom-2.rs index cec0b29854f6..bf528989fd42 100644 --- a/tests/target/fn-custom-2.rs +++ b/tests/target/fn-custom-2.rs @@ -1,5 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-generics_indent: Block +// rustfmt-indent_style: Block // rustfmt-where_layout: Mixed // Test different indents. diff --git a/tests/target/fn-custom-3.rs b/tests/target/fn-custom-3.rs index 633ab05030d1..6561140196b1 100644 --- a/tests/target/fn-custom-3.rs +++ b/tests/target/fn-custom-3.rs @@ -1,5 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-generics_indent: Block +// rustfmt-indent_style: Block // rustfmt-where_layout: HorizontalVertical // Test different indents. diff --git a/tests/target/fn-custom-4.rs b/tests/target/fn-custom-4.rs index 297aae5123b9..35895f386d0d 100644 --- a/tests/target/fn-custom-4.rs +++ b/tests/target/fn-custom-4.rs @@ -1,4 +1,4 @@ -// rustfmt-where_pred_indent: Block +// rustfmt-indent_style: Block // rustfmt-where_density: Compressed // Test different indents. diff --git a/tests/target/fn-custom-6.rs b/tests/target/fn-custom-6.rs index f7bf2f04eaf2..2c86ade3c83d 100644 --- a/tests/target/fn-custom-6.rs +++ b/tests/target/fn-custom-6.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_brace_style: PreferSameLine // Test different indents. diff --git a/tests/target/fn-custom-7.rs b/tests/target/fn-custom-7.rs index b9f1820d0661..88c6ab10d800 100644 --- a/tests/target/fn-custom-7.rs +++ b/tests/target/fn-custom-7.rs @@ -1,5 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_args_density: Vertical // rustfmt-fn_brace_style: AlwaysNextLine diff --git a/tests/target/fn-custom-8.rs b/tests/target/fn-custom-8.rs index 78880206f34a..151f7f2a0f26 100644 --- a/tests/target/fn-custom-8.rs +++ b/tests/target/fn-custom-8.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_brace_style: PreferSameLine // Test different indents. diff --git a/tests/target/fn_args_indent-block.rs b/tests/target/fn_args_indent-block.rs index afe453ca2335..04c18816d0be 100644 --- a/tests/target/fn_args_indent-block.rs +++ b/tests/target/fn_args_indent-block.rs @@ -1,5 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block fn foo() { foo(); diff --git a/tests/target/issue-1278.rs b/tests/target/issue-1278.rs index d199773c8345..e25376561a94 100644 --- a/tests/target/issue-1278.rs +++ b/tests/target/issue-1278.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent = "block" +// rustfmt-indent_style = "block" #![feature(pub_restricted)] diff --git a/tests/target/issue-1624.rs b/tests/target/issue-1624.rs index a41fff2e7507..7385118528b5 100644 --- a/tests/target/issue-1624.rs +++ b/tests/target/issue-1624.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_indent: Block +// rustfmt-indent_style: Block // rustfmt-fn_args_paren_newline: false // #1624 diff --git a/tests/target/struct_lits_visual.rs b/tests/target/struct_lits_visual.rs index cef6e8b68c5b..7e93b91d8c10 100644 --- a/tests/target/struct_lits_visual.rs +++ b/tests/target/struct_lits_visual.rs @@ -1,6 +1,6 @@ // rustfmt-normalize_comments: true // rustfmt-wrap_comments: true -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual // rustfmt-error_on_line_overflow: false // Struct literal expressions. diff --git a/tests/target/struct_lits_visual_multiline.rs b/tests/target/struct_lits_visual_multiline.rs index 74dd654ac50f..936a4061cb43 100644 --- a/tests/target/struct_lits_visual_multiline.rs +++ b/tests/target/struct_lits_visual_multiline.rs @@ -1,6 +1,6 @@ // rustfmt-normalize_comments: true // rustfmt-wrap_comments: true -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual // rustfmt-struct_lit_multiline_style: ForceMulti // rustfmt-error_on_line_overflow: false diff --git a/tests/target/struct_tuple_visual.rs b/tests/target/struct_tuple_visual.rs index 7723f042e6f4..af5539422955 100644 --- a/tests/target/struct_tuple_visual.rs +++ b/tests/target/struct_tuple_visual.rs @@ -1,7 +1,7 @@ // rustfmt-normalize_comments: true // rustfmt-wrap_comments: true // rustfmt-error_on_line_overflow: false -// rustfmt-struct_lit_indent: Visual +// rustfmt-indent_style: Visual fn foo() { Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b()); diff --git a/tests/target/where-clause-rfc.rs b/tests/target/where-clause-rfc.rs index bf3a93e27fb3..1e83d5b3abc4 100644 --- a/tests/target/where-clause-rfc.rs +++ b/tests/target/where-clause-rfc.rs @@ -1,5 +1,4 @@ -// rustfmt-fn_args_indent: Block -// rustfmt-where_style: Rfc +// rustfmt-indent_style: Block fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape) where From f613c8fa0251d577382e8af0da4cac516191043e Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:20:44 +0900 Subject: [PATCH 02/12] Recover imports_indent --- tests/target/configs-imports_indent-block.rs | 2 +- tests/target/configs-imports_layout-horizontal_vertical.rs | 2 +- tests/target/configs-imports_layout-mixed.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/target/configs-imports_indent-block.rs b/tests/target/configs-imports_indent-block.rs index 871a4aab8e90..84c3b26bd6e1 100644 --- a/tests/target/configs-imports_indent-block.rs +++ b/tests/target/configs-imports_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Block +// rustfmt-imports_indent: Block use lists::{ definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape, diff --git a/tests/target/configs-imports_layout-horizontal_vertical.rs b/tests/target/configs-imports_layout-horizontal_vertical.rs index 5fbb5d1eacda..4a63556d45bc 100644 --- a/tests/target/configs-imports_layout-horizontal_vertical.rs +++ b/tests/target/configs-imports_layout-horizontal_vertical.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Block +// rustfmt-imports_indent: Block // rustfmt-imports_layout: HorizontalVertical use comment::{contains_comment, recover_comment_removed, rewrite_comment, FindUncommented}; diff --git a/tests/target/configs-imports_layout-mixed.rs b/tests/target/configs-imports_layout-mixed.rs index cf85ff8d79d4..5d3349a01bba 100644 --- a/tests/target/configs-imports_layout-mixed.rs +++ b/tests/target/configs-imports_layout-mixed.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Block +// rustfmt-imports_indent: Block // rustfmt-imports_layout: Mixed use comment::{contains_comment, recover_comment_removed, rewrite_comment, FindUncommented}; From 18a513b0c26553fbcadded93d24a3f6c58e24bff Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:22:09 +0900 Subject: [PATCH 03/12] Change Rfc to Block --- tests/source/configs-where_style-rfc.rs | 2 +- tests/target/big-impl-rfc.rs | 2 +- tests/target/configs-control_style-rfc.rs | 2 +- tests/target/configs-where_style-rfc.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/source/configs-where_style-rfc.rs b/tests/source/configs-where_style-rfc.rs index 24f4a7c7ea86..012840be28dc 100644 --- a/tests/source/configs-where_style-rfc.rs +++ b/tests/source/configs-where_style-rfc.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Rfc +// rustfmt-indent_style: Block // Where style fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/target/big-impl-rfc.rs b/tests/target/big-impl-rfc.rs index 6c21f8a22e43..a52757711f40 100644 --- a/tests/target/big-impl-rfc.rs +++ b/tests/target/big-impl-rfc.rs @@ -1,7 +1,7 @@ // rustfmt-indent_style: Block // rustfmt-indent_style: Block // rustfmt-indent_style: Block -// rustfmt-indent_style: Rfc +// rustfmt-indent_style: Block // #1357 impl<'a, Select, From, Distinct, Where, Order, Limit, Offset, Groupby, DB> InternalBoxedDsl<'a, DB> diff --git a/tests/target/configs-control_style-rfc.rs b/tests/target/configs-control_style-rfc.rs index f2023bcbc5ba..5e19681f90bb 100644 --- a/tests/target/configs-control_style-rfc.rs +++ b/tests/target/configs-control_style-rfc.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Rfc +// rustfmt-indent_style: Block // #1618 fn main() { diff --git a/tests/target/configs-where_style-rfc.rs b/tests/target/configs-where_style-rfc.rs index 5d4edfd107c4..a7b9a4f02b3d 100644 --- a/tests/target/configs-where_style-rfc.rs +++ b/tests/target/configs-where_style-rfc.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Rfc +// rustfmt-indent_style: Block // Where style fn lorem() -> T From 5e639cacdb0dc89f1d57ac283ad09de6631cf091 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:23:21 +0900 Subject: [PATCH 04/12] Change Legacy to Visual --- tests/source/configs-where_style-default.rs | 2 +- tests/target/configs-where_style-default.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/source/configs-where_style-default.rs b/tests/source/configs-where_style-default.rs index 34fa216cb804..f08f5c64460a 100644 --- a/tests/source/configs-where_style-default.rs +++ b/tests/source/configs-where_style-default.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Legacy +// rustfmt-indent_style: Visual // Where style fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { diff --git a/tests/target/configs-where_style-default.rs b/tests/target/configs-where_style-default.rs index a4bdee0183da..a8f0902b34ea 100644 --- a/tests/target/configs-where_style-default.rs +++ b/tests/target/configs-where_style-default.rs @@ -1,4 +1,4 @@ -// rustfmt-indent_style: Legacy +// rustfmt-indent_style: Visual // Where style fn lorem() -> T From 0d721241f4e5d3182a199b74554a5557341c1d5f Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:25:50 +0900 Subject: [PATCH 05/12] Change chain_indent to indent_style --- tests/source/chains-indent-tabbed.rs | 2 +- tests/source/chains-indent-visual.rs | 2 +- tests/source/chains-visual.rs | 2 +- tests/source/configs-chain_indent-block.rs | 2 +- tests/source/configs-chain_indent-visual.rs | 2 +- tests/target/chains-indent-tabbed.rs | 2 +- tests/target/chains-indent-visual.rs | 2 +- tests/target/chains-visual.rs | 2 +- tests/target/configs-chain_indent-block.rs | 2 +- tests/target/configs-chain_indent-visual.rs | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/source/chains-indent-tabbed.rs b/tests/source/chains-indent-tabbed.rs index 7a5afdfc9eff..6a9a40cb98f1 100644 --- a/tests/source/chains-indent-tabbed.rs +++ b/tests/source/chains-indent-tabbed.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Block +// rustfmt-indent_style: Block fn test() { let x = my_long_function().my_even_longer_function().my_nested_function().some_random_name().another_function().do_it(); diff --git a/tests/source/chains-indent-visual.rs b/tests/source/chains-indent-visual.rs index 7e7f0558ffe5..8fdd3c4cabf3 100644 --- a/tests/source/chains-indent-visual.rs +++ b/tests/source/chains-indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Visual +// rustfmt-indent_style: Visual fn test() { let x = my_long_function().my_even_longer_function().my_nested_function().some_random_name().another_function().do_it(); diff --git a/tests/source/chains-visual.rs b/tests/source/chains-visual.rs index 198691d82b59..99dfa921a71e 100644 --- a/tests/source/chains-visual.rs +++ b/tests/source/chains-visual.rs @@ -1,6 +1,6 @@ // rustfmt-normalize_comments: true // rustfmt-single_line_if_else_max_width: 0 -// rustfmt-chain_indent: Visual +// rustfmt-indent_style: Visual // Test chain formatting. fn main() { diff --git a/tests/source/configs-chain_indent-block.rs b/tests/source/configs-chain_indent-block.rs index d77709422b28..41d91469114c 100644 --- a/tests/source/configs-chain_indent-block.rs +++ b/tests/source/configs-chain_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Block +// rustfmt-indent_style: Block // Chain indent fn main() { diff --git a/tests/source/configs-chain_indent-visual.rs b/tests/source/configs-chain_indent-visual.rs index 67714d32045b..b74948753980 100644 --- a/tests/source/configs-chain_indent-visual.rs +++ b/tests/source/configs-chain_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Visual +// rustfmt-indent_style: Visual // Chain indent fn main() { diff --git a/tests/target/chains-indent-tabbed.rs b/tests/target/chains-indent-tabbed.rs index 8222b1c6ac74..ea6b5764e44e 100644 --- a/tests/target/chains-indent-tabbed.rs +++ b/tests/target/chains-indent-tabbed.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Block +// rustfmt-indent_style: Block fn test() { let x = my_long_function() diff --git a/tests/target/chains-indent-visual.rs b/tests/target/chains-indent-visual.rs index 66ef44fcd4ae..23814e3dbe1a 100644 --- a/tests/target/chains-indent-visual.rs +++ b/tests/target/chains-indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Visual +// rustfmt-indent_style: Visual fn test() { let x = my_long_function().my_even_longer_function() diff --git a/tests/target/chains-visual.rs b/tests/target/chains-visual.rs index c0fd18b44de8..abba2853a6b7 100644 --- a/tests/target/chains-visual.rs +++ b/tests/target/chains-visual.rs @@ -1,6 +1,6 @@ // rustfmt-normalize_comments: true // rustfmt-single_line_if_else_max_width: 0 -// rustfmt-chain_indent: Visual +// rustfmt-indent_style: Visual // Test chain formatting. fn main() { diff --git a/tests/target/configs-chain_indent-block.rs b/tests/target/configs-chain_indent-block.rs index b172e293b720..23340a4aba2f 100644 --- a/tests/target/configs-chain_indent-block.rs +++ b/tests/target/configs-chain_indent-block.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Block +// rustfmt-indent_style: Block // Chain indent fn main() { diff --git a/tests/target/configs-chain_indent-visual.rs b/tests/target/configs-chain_indent-visual.rs index ef7dac93f7f4..569f3d8b81d7 100644 --- a/tests/target/configs-chain_indent-visual.rs +++ b/tests/target/configs-chain_indent-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-chain_indent: Visual +// rustfmt-indent_style: Visual // Chain indent fn main() { From 6003eae6a3e7107a74f84e5d496df8542572d92c Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:41:51 +0900 Subject: [PATCH 06/12] Remove redundant options --- tests/target/big-impl-rfc.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/target/big-impl-rfc.rs b/tests/target/big-impl-rfc.rs index a52757711f40..2aa156df4bce 100644 --- a/tests/target/big-impl-rfc.rs +++ b/tests/target/big-impl-rfc.rs @@ -1,7 +1,4 @@ // rustfmt-indent_style: Block -// rustfmt-indent_style: Block -// rustfmt-indent_style: Block -// rustfmt-indent_style: Block // #1357 impl<'a, Select, From, Distinct, Where, Order, Limit, Offset, Groupby, DB> InternalBoxedDsl<'a, DB> From 664e03053456eed5e5a2de95fa987c839ce92aeb Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:42:04 +0900 Subject: [PATCH 07/12] Update tests --- tests/target/chains-visual.rs | 60 ++++++++----------- .../target/configs-generics_indent-visual.rs | 4 +- .../configs-where_pred_indent-visual.rs | 9 ++- tests/target/struct_tuple_visual.rs | 56 +++++++---------- 4 files changed, 53 insertions(+), 76 deletions(-) diff --git a/tests/target/chains-visual.rs b/tests/target/chains-visual.rs index abba2853a6b7..a581703b7e53 100644 --- a/tests/target/chains-visual.rs +++ b/tests/target/chains-visual.rs @@ -17,17 +17,15 @@ fn main() { // Test case where first chain element isn't a path, but is shorter than // the size of a tab. x().y(|| match cond() { - true => (), - false => (), - }); + true => (), + false => (), + }); - loong_func().quux(move || { - if true { - 1 - } else { - 2 - } - }); + loong_func().quux(move || if true { + 1 + } else { + 2 + }); some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| { let x = c; @@ -49,10 +47,10 @@ fn main() { }); }); - let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = - xxxxxxx.map(|x| x + 5) - .map(|x| x / 2) - .fold(0, |acc, x| acc + x); + let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = xxxxxxx.map(|x| x + 5) + .map(|x| x / 2) + .fold(0, + |acc, x| acc + x); aaaaaaaaaaaaaaaa.map(|x| { x += 1; @@ -62,15 +60,11 @@ fn main() { } fn floaters() { - let z = Foo { - field1: val1, - field2: val2, - }; + let z = Foo { field1: val1, + field2: val2, }; - let x = Foo { - field1: val1, - field2: val2, - }.method_call() + let x = Foo { field1: val1, + field2: val2, }.method_call() .method_call(); let y = if cond { @@ -83,12 +77,10 @@ fn floaters() { match x { PushParam => { // params are 1-indexed - stack.push( - mparams[match cur.to_digit(10) { - Some(d) => d as usize - 1, - None => return Err("bad param number".to_owned()), - }].clone(), - ); + stack.push(mparams[match cur.to_digit(10) { + Some(d) => d as usize - 1, + None => return Err("bad param number".to_owned()), + }].clone()); } } } @@ -106,10 +98,8 @@ fn floaters() { }) .quux(); - Foo { - y: i_am_multi_line, - z: ok, - }.baz(|| { + Foo { y: i_am_multi_line, + z: ok, }.baz(|| { force(); multiline(); }) @@ -157,10 +147,8 @@ fn issue1434() { for _ in 0..100 { let prototype_id = PrototypeIdData::from_reader::<_, B>(&mut self.file_cursor).chain_err(|| { - format!( - "could not read prototype ID at offset {:#010x}", - current_offset - ) + format!("could not read prototype ID at offset {:#010x}", + current_offset) })?; } } diff --git a/tests/target/configs-generics_indent-visual.rs b/tests/target/configs-generics_indent-visual.rs index 5ea1c9143893..491075a146d1 100644 --- a/tests/target/configs-generics_indent-visual.rs +++ b/tests/target/configs-generics_indent-visual.rs @@ -14,7 +14,7 @@ fn lorem T { + elit: Elit) + -> T { // body } diff --git a/tests/target/configs-where_pred_indent-visual.rs b/tests/target/configs-where_pred_indent-visual.rs index b878d726dffd..45799dcd5fcd 100644 --- a/tests/target/configs-where_pred_indent-visual.rs +++ b/tests/target/configs-where_pred_indent-visual.rs @@ -2,11 +2,10 @@ // Where predicate indent fn lorem() -> T -where - Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq, + where Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq { // body } diff --git a/tests/target/struct_tuple_visual.rs b/tests/target/struct_tuple_visual.rs index af5539422955..369feae71d25 100644 --- a/tests/target/struct_tuple_visual.rs +++ b/tests/target/struct_tuple_visual.rs @@ -5,43 +5,33 @@ fn foo() { Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b()); - Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo( - // Comment - foo(), // Comment - // Comment - bar(), // Comment - ); + Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(// Comment + foo(), /* Comment */ + // Comment + bar() /* Comment */); Foo(Bar, f()); - Quux( - if cond { - bar(); - }, - baz(), - ); + Quux(if cond { + bar(); + }, + baz()); - Baz( - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, - zzzzz, // test - ); + Baz(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, + zzzzz /* test */); - A( - // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit - // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante - // hendrerit. Donec et mollis dolor. - item(), - // Praesent et diam eget libero egestas mattis sit amet vitae augue. - // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. - Item, - ); + A(// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit + // amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante + // hendrerit. Donec et mollis dolor. + item(), + // Praesent et diam eget libero egestas mattis sit amet vitae augue. + // Nam tincidunt congue enim, ut porta lorem lacinia consectetur. + Item); - Diagram( - // o This graph demonstrates how - // / \ significant whitespace is - // o o preserved. - // /|\ \ - // o o o o - G, - ) + Diagram(// o This graph demonstrates how + // / \ significant whitespace is + // o o preserved. + // /|\ \ + // o o o o + G) } From a4e32b1853443ae0e1369bd61ad3baa01f7c8031 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:42:15 +0900 Subject: [PATCH 08/12] Update legacy-rustfmt.toml --- legacy-rustfmt.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/legacy-rustfmt.toml b/legacy-rustfmt.toml index 6adaf36b6b39..7c87391fef7a 100644 --- a/legacy-rustfmt.toml +++ b/legacy-rustfmt.toml @@ -1,8 +1,3 @@ -fn_args_indent = "Visual" -array_indent = "Visual" -control_style = "Legacy" -where_style = "Legacy" -generics_indent = "Visual" -fn_call_indent = "Visual" +indent_style = "Visual" combine_control_expr = false fn_args_paren_newline = true From 04f09c9d8548253bff2758a2b239302d574455ad Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:42:29 +0900 Subject: [PATCH 09/12] Replace '*_indent' with 'indent_style' in src --- src/chains.rs | 18 +++++++++--------- src/config.rs | 17 +---------------- src/expr.rs | 50 +++++++++++++++++++++++++------------------------- src/items.rs | 44 ++++++++++++++++++++++---------------------- src/lists.rs | 6 +++--- src/rewrite.rs | 2 +- src/types.rs | 14 +++++++------- 7 files changed, 68 insertions(+), 83 deletions(-) diff --git a/src/chains.rs b/src/chains.rs index 5ab538c8c4e5..1a3586cd0441 100644 --- a/src/chains.rs +++ b/src/chains.rs @@ -87,7 +87,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - // Parent is the first item in the chain, e.g., `foo` in `foo.bar.baz()`. let parent_shape = if is_block_expr(context, &parent, "\n") { - match context.config.chain_indent() { + match context.config.indent_style() { IndentStyle::Visual => shape.visual_indent(0), IndentStyle::Block => shape, } @@ -105,10 +105,10 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - let (nested_shape, extend) = if !parent_rewrite_contains_newline && is_continuable(&parent) { ( chain_indent(context, shape.add_offset(parent_rewrite.len())), - context.config.chain_indent() == IndentStyle::Visual || is_small_parent, + context.config.indent_style() == IndentStyle::Visual || is_small_parent, ) } else if is_block_expr(context, &parent, &parent_rewrite) { - match context.config.chain_indent() { + match context.config.indent_style() { // Try to put the first child on the same line with parent's last line IndentStyle::Block => (parent_shape.block_indent(context.config.tab_spaces()), true), // The parent is a block, so align the rest of the chain with the closing @@ -127,7 +127,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - let first_child_shape = if extend { let overhead = last_line_width(&parent_rewrite); let offset = trimmed_last_line_width(&parent_rewrite) + prefix_try_num; - match context.config.chain_indent() { + match context.config.indent_style() { IndentStyle::Visual => parent_shape.offset_left(overhead)?, IndentStyle::Block => parent_shape.block().offset_left(offset)?, } @@ -172,7 +172,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - } else { other_child_shape }; - match context.config.chain_indent() { + match context.config.indent_style() { IndentStyle::Visual => last_shape.sub_width(shape.rhs_overhead(context.config))?, IndentStyle::Block => last_shape, } @@ -262,7 +262,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - let first_connector = if is_small_parent || fits_single_line || last_line_extendable(&parent_rewrite) - || context.config.chain_indent() == IndentStyle::Visual + || context.config.indent_style() == IndentStyle::Visual { "" } else { @@ -272,7 +272,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - let result = if is_small_parent && rewrites.len() > 1 { let second_connector = if fits_single_line || rewrites[1] == "?" || last_line_extendable(&rewrites[0]) - || context.config.chain_indent() == IndentStyle::Visual + || context.config.indent_style() == IndentStyle::Visual { "" } else { @@ -295,7 +295,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) - ) }; let result = format!("{}{}", result, repeat_try(suffix_try_num)); - if context.config.chain_indent() == IndentStyle::Visual { + if context.config.indent_style() == IndentStyle::Visual { wrap_str(result, context.config.max_width(), shape) } else { Some(result) @@ -381,7 +381,7 @@ fn make_subexpr_list(expr: &ast::Expr, context: &RewriteContext) -> (ast::Expr, } fn chain_indent(context: &RewriteContext, shape: Shape) -> Shape { - match context.config.chain_indent() { + match context.config.indent_style() { IndentStyle::Visual => shape.visual_indent(0), IndentStyle::Block => shape .block_indent(context.config.tab_spaces()) diff --git a/src/config.rs b/src/config.rs index 98939e9e1918..b946d006a0b0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -40,11 +40,6 @@ macro_rules! configuration_option_enum{ } } -configuration_option_enum! { Style: - Rfc, // Follow the style RFCs style. - Legacy, // Follow the traditional Rustfmt style. -} - configuration_option_enum! { NewlineStyle: Windows, // \r\n Unix, // \n @@ -521,6 +516,7 @@ pub fn get_toml_path(dir: &Path) -> Result, Error> { create_config! { + indent_style: IndentStyle, IndentStyle::Block, false, "How do we indent expressions or items."; unstable_features: bool, false, true, "Enables unstable features. Only available on nightly channel"; verbose: bool, false, false, "Use verbose output"; @@ -545,7 +541,6 @@ create_config! { fn_brace_style: BraceStyle, BraceStyle::SameLineWhere, false, "Brace style for functions"; item_brace_style: BraceStyle, BraceStyle::SameLineWhere, false, "Brace style for structs and enums"; - control_style: Style, Style::Rfc, false, "Indent style for control flow statements"; control_brace_style: ControlBraceStyle, ControlBraceStyle::AlwaysSameLine, false, "Brace style for control flow constructs"; impl_empty_single_line: bool, true, false, "Put empty-body implementations on a single line"; @@ -559,16 +554,12 @@ create_config! { "Location of return type in function declaration"; fn_args_paren_newline: bool, false, false, "If function argument parenthesis goes on a newline"; fn_args_density: Density, Density::Tall, false, "Argument density in functions"; - fn_args_indent: IndentStyle, IndentStyle::Block, false, - "Layout of function arguments and tuple structs"; - array_indent: IndentStyle, IndentStyle::Block, false, "Indent on arrays"; array_width: usize, 60, false, "Maximum width of an array literal before falling back to vertical formatting"; array_horizontal_layout_threshold: usize, 0, false, "How many elements array must have before rustfmt uses horizontal layout."; type_punctuation_density: TypeDensity, TypeDensity::Wide, false, "Determines if '+' or '=' are wrapped in spaces in the punctuation of types"; - where_style: Style, Style::Rfc, false, "Overall strategy for where clauses"; // TODO: // 1. Should we at least try to put the where clause on the same line as the rest of the // function decl? @@ -576,18 +567,12 @@ create_config! { where_density: Density, Density::Vertical, false, "Density of a where clause"; where_single_line: bool, false, false, "To force single line where layout"; where_layout: ListTactic, ListTactic::Vertical, false, "Element layout inside a where clause"; - where_pred_indent: IndentStyle, IndentStyle::Visual, false, - "Indentation style of a where predicate"; - generics_indent: IndentStyle, IndentStyle::Block, false, "Indentation of generics"; - struct_lit_indent: IndentStyle, IndentStyle::Block, false, "Style of struct definition"; struct_lit_multiline_style: MultilineStyle, MultilineStyle::PreferSingle, false, "Multiline style on literal structs"; - fn_call_indent: IndentStyle, IndentStyle::Block, false, "Indentation for function calls, etc."; report_todo: ReportTactic, ReportTactic::Never, false, "Report all, none or unnumbered occurrences of TODO in source file comments"; report_fixme: ReportTactic, ReportTactic::Never, false, "Report all, none or unnumbered occurrences of FIXME in source file comments"; - chain_indent: IndentStyle, IndentStyle::Block, false, "Indentation of chain"; chain_width: usize, 60, false, "Maximum length of a chain to fit on a single line"; chain_split_single_child: bool, false, false, "Split a chain with a single child if its length \ exceeds `chain_width`"; diff --git a/src/expr.rs b/src/expr.rs index d6c025422af9..5aee87dbbb73 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -21,7 +21,7 @@ use closures; use codemap::{LineRangeUtils, SpanUtils}; use comment::{combine_strs_with_missing_comments, contains_comment, recover_comment_removed, rewrite_comment, rewrite_missing_comment, FindUncommented}; -use config::{Config, ControlBraceStyle, IndentStyle, MultilineStyle, Style}; +use config::{Config, ControlBraceStyle, IndentStyle, MultilineStyle}; use lists::{definitive_tactic, itemize_list, shape_for_tactic, struct_lit_formatting, struct_lit_shape, struct_lit_tactic, write_list, DefinitiveListTactic, ListFormatting, ListItem, ListTactic, Separator, SeparatorPlace, SeparatorTactic}; @@ -366,11 +366,11 @@ where // We have to use multiple lines. // Re-evaluate the rhs because we have more space now: - let mut rhs_shape = match context.config.control_style() { - Style::Legacy => shape + let mut rhs_shape = match context.config.indent_style() { + IndentStyle::Visual => shape .sub_width(pp.suffix.len() + pp.prefix.len())? .visual_indent(pp.prefix.len()), - Style::Rfc => { + IndentStyle::Block => { // Try to calculate the initial constraint on the right hand side. let rhs_overhead = shape.rhs_overhead(context.config); Shape::indented(shape.indent.block_indent(context.config), context.config) @@ -415,7 +415,7 @@ where 1 // "[" }; - let nested_shape = match context.config.array_indent() { + let nested_shape = match context.config.indent_style() { IndentStyle::Block => shape .block() .block_indent(context.config.tab_spaces()) @@ -450,7 +450,7 @@ where .iter() .any(|li| li.item.as_ref().map(|s| s.len() > 10).unwrap_or(false)); - let mut tactic = match context.config.array_indent() { + let mut tactic = match context.config.indent_style() { IndentStyle::Block => { // FIXME wrong shape in one-line case match shape.width.checked_sub(2 * bracket_size) { @@ -473,7 +473,7 @@ where DefinitiveListTactic::Mixed }, }; - let ends_with_newline = tactic.ends_with_newline(context.config.array_indent()); + let ends_with_newline = tactic.ends_with_newline(context.config.indent_style()); if context.config.array_horizontal_layout_threshold() > 0 && items.len() > context.config.array_horizontal_layout_threshold() { @@ -485,7 +485,7 @@ where separator: ",", trailing_separator: if trailing_comma { SeparatorTactic::Always - } else if context.inside_macro || context.config.array_indent() == IndentStyle::Visual { + } else if context.inside_macro || context.config.indent_style() == IndentStyle::Visual { SeparatorTactic::Never } else { SeparatorTactic::Vertical @@ -498,7 +498,7 @@ where }; let list_str = write_list(&items, &fmt)?; - let result = if context.config.array_indent() == IndentStyle::Visual + let result = if context.config.indent_style() == IndentStyle::Visual || tactic == DefinitiveListTactic::Horizontal { if context.config.spaces_within_square_brackets() && !list_str.is_empty() { @@ -677,9 +677,9 @@ pub fn rewrite_cond(context: &RewriteContext, expr: &ast::Expr, shape: Shape) -> match expr.node { ast::ExprKind::Match(ref cond, _) => { // `match `cond` {` - let cond_shape = match context.config.control_style() { - Style::Legacy => shape.shrink_left(6).and_then(|s| s.sub_width(2))?, - Style::Rfc => shape.offset_left(8)?, + let cond_shape = match context.config.indent_style() { + IndentStyle::Visual => shape.shrink_left(6).and_then(|s| s.sub_width(2))?, + IndentStyle::Block => shape.offset_left(8)?, }; cond.rewrite(context, cond_shape) } @@ -922,9 +922,9 @@ impl<'a> ControlFlow<'a> { let pat_expr_string = match self.cond { Some(cond) => { - let cond_shape = match context.config.control_style() { - Style::Legacy => constr_shape.shrink_left(offset)?, - Style::Rfc => constr_shape.offset_left(offset)?, + let cond_shape = match context.config.indent_style() { + IndentStyle::Visual => constr_shape.shrink_left(offset)?, + IndentStyle::Block => constr_shape.offset_left(offset)?, }; rewrite_pat_expr( context, @@ -951,7 +951,7 @@ impl<'a> ControlFlow<'a> { .max_width() .checked_sub(constr_shape.used_width() + offset + brace_overhead) .unwrap_or(0); - let force_newline_brace = context.config.control_style() == Style::Rfc + let force_newline_brace = context.config.indent_style() == IndentStyle::Block && (pat_expr_string.contains('\n') || pat_expr_string.len() > one_line_budget) && !last_line_extendable(&pat_expr_string); @@ -1236,9 +1236,9 @@ fn rewrite_match( ..shape }; // 6 = `match ` - let cond_shape = match context.config.control_style() { - Style::Legacy => cond_shape.shrink_left(6)?, - Style::Rfc => cond_shape.offset_left(6)?, + let cond_shape = match context.config.indent_style() { + IndentStyle::Visual => cond_shape.shrink_left(6)?, + IndentStyle::Block => cond_shape.offset_left(6)?, }; let cond_str = cond.rewrite(context, cond_shape)?; let alt_block_sep = String::from("\n") + &shape.indent.block_only().to_string(context.config); @@ -1809,7 +1809,7 @@ where let used_width = extra_offset(callee_str, shape); let one_line_width = shape.width.checked_sub(used_width + 2 * paren_overhead)?; - let nested_shape = shape_from_fn_call_indent( + let nested_shape = shape_from_indent_style( context, shape, used_width + 2 * paren_overhead, @@ -2058,7 +2058,7 @@ pub fn can_be_overflowed_expr(context: &RewriteContext, expr: &ast::Expr, args_l match expr.node { ast::ExprKind::Match(..) => { (context.use_block_indent() && args_len == 1) - || (context.config.fn_call_indent() == IndentStyle::Visual && args_len > 1) + || (context.config.indent_style() == IndentStyle::Visual && args_len > 1) } ast::ExprKind::If(..) | ast::ExprKind::IfLet(..) | @@ -2070,7 +2070,7 @@ pub fn can_be_overflowed_expr(context: &RewriteContext, expr: &ast::Expr, args_l } ast::ExprKind::Block(..) | ast::ExprKind::Closure(..) => { context.use_block_indent() - || context.config.fn_call_indent() == IndentStyle::Visual && args_len > 1 + || context.config.indent_style() == IndentStyle::Visual && args_len > 1 } ast::ExprKind::Array(..) | ast::ExprKind::Call(..) | @@ -2319,7 +2319,7 @@ fn rewrite_struct_lit<'a>( let fields_str = wrap_struct_field(context, &fields_str, shape, v_shape, one_line_width); Some(format!("{} {{{}}}", path_str, fields_str)) - // FIXME if context.config.struct_lit_indent() == Visual, but we run out + // FIXME if context.config.indent_style() == Visual, but we run out // of space, we should fall back to BlockIndent. } @@ -2330,7 +2330,7 @@ pub fn wrap_struct_field( nested_shape: Shape, one_line_width: usize, ) -> String { - if context.config.struct_lit_indent() == IndentStyle::Block + if context.config.indent_style() == IndentStyle::Block && (fields_str.contains('\n') || context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti || fields_str.len() > one_line_width) @@ -2401,7 +2401,7 @@ pub fn rewrite_field( } } -fn shape_from_fn_call_indent( +fn shape_from_indent_style( context: &RewriteContext, shape: Shape, overhead: usize, diff --git a/src/items.rs b/src/items.rs index de0dc763e1be..d5e02dde6e55 100644 --- a/src/items.rs +++ b/src/items.rs @@ -22,7 +22,7 @@ use spanned::Spanned; use codemap::{LineRangeUtils, SpanUtils}; use comment::{combine_strs_with_missing_comments, contains_comment, recover_comment_removed, recover_missing_comment_in_span, rewrite_missing_comment, FindUncommented}; -use config::{BraceStyle, Config, Density, IndentStyle, ReturnIndent, Style}; +use config::{BraceStyle, Config, Density, IndentStyle, ReturnIndent}; use expr::{format_expr, is_empty_block, is_simple_block_stmt, rewrite_assign_rhs, rewrite_call_inner, ExprType}; use lists::{definitive_tactic, itemize_list, write_list, DefinitiveListTactic, ListFormatting, @@ -815,9 +815,9 @@ fn format_impl_ref_and_type( result.push_str("for "); } let budget = context.budget(last_line_width(&result)); - let type_offset = match context.config.where_style() { - Style::Legacy => new_line_offset + trait_ref_overhead, - Style::Rfc => new_line_offset, + let type_offset = match context.config.indent_style() { + IndentStyle::Visual => new_line_offset + trait_ref_overhead, + IndentStyle::Block => new_line_offset, }; result.push_str(&*self_ty .rewrite(context, Shape::legacy(budget, type_offset))?); @@ -974,8 +974,8 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent) let has_body = !trait_items.is_empty(); let where_density = if (context.config.where_density() == Density::Compressed - && (!result.contains('\n') || context.config.fn_args_indent() == IndentStyle::Block)) - || (context.config.fn_args_indent() == IndentStyle::Block && result.is_empty()) + && (!result.contains('\n') || context.config.indent_style() == IndentStyle::Block)) + || (context.config.indent_style() == IndentStyle::Block && result.is_empty()) || (context.config.where_density() == Density::CompressedIfEmpty && !has_body && !result.contains('\n')) { @@ -1880,13 +1880,13 @@ fn rewrite_fn_base( } else if context.config.fn_args_paren_newline() { result.push('\n'); result.push_str(&arg_indent.to_string(context.config)); - if context.config.fn_args_indent() == IndentStyle::Visual { + if context.config.indent_style() == IndentStyle::Visual { arg_indent = arg_indent + 1; // extra space for `(` } result.push('('); } else { result.push_str("("); - if context.config.fn_args_indent() == IndentStyle::Visual { + if context.config.indent_style() == IndentStyle::Visual { result.push('\n'); result.push_str(&arg_indent.to_string(context.config)); } @@ -1933,7 +1933,7 @@ fn rewrite_fn_base( generics_str.contains('\n'), )?; - let put_args_in_block = match context.config.fn_args_indent() { + let put_args_in_block = match context.config.indent_style() { IndentStyle::Block => arg_str.contains('\n') || arg_str.len() > one_line_budget, _ => false, } && !fd.inputs.is_empty(); @@ -1974,7 +1974,7 @@ fn rewrite_fn_base( // Return type. if let ast::FunctionRetTy::Ty(..) = fd.output { - let ret_should_indent = match context.config.fn_args_indent() { + let ret_should_indent = match context.config.indent_style() { // If our args are block layout then we surely must have space. IndentStyle::Block if put_args_in_block || fd.inputs.is_empty() => false, _ if args_last_line_contains_comment => false, @@ -2266,7 +2266,7 @@ fn rewrite_args( .and_then(|item| item.post_comment.as_ref()) .map_or(false, |s| s.trim().starts_with("//")); - let (indent, trailing_comma) = match context.config.fn_args_indent() { + let (indent, trailing_comma) = match context.config.indent_style() { IndentStyle::Block if fits_in_one_line => { (indent.block_indent(context.config), SeparatorTactic::Never) } @@ -2303,7 +2303,7 @@ fn rewrite_args( }, separator_place: SeparatorPlace::Back, shape: Shape::legacy(budget, indent), - ends_with_newline: tactic.ends_with_newline(context.config.fn_args_indent()), + ends_with_newline: tactic.ends_with_newline(context.config.indent_style()), preserve_newline: true, config: context.config, }; @@ -2353,7 +2353,7 @@ fn compute_budgets_for_args( if one_line_budget > 0 { // 4 = "() {".len() - let (indent, multi_line_budget) = match context.config.fn_args_indent() { + let (indent, multi_line_budget) = match context.config.indent_style() { IndentStyle::Block => { let indent = indent.block_indent(context.config); (indent, context.budget(indent.width() + 1)) @@ -2371,7 +2371,7 @@ fn compute_budgets_for_args( // Didn't work. we must force vertical layout and put args on a newline. let new_indent = indent.block_indent(context.config); - let used_space = match context.config.fn_args_indent() { + let used_space = match context.config.indent_style() { // 1 = `,` IndentStyle::Block => new_indent.width() + 1, // Account for `)` and possibly ` {`. @@ -2464,7 +2464,7 @@ fn rewrite_generics_inner( } pub fn generics_shape_from_config(config: &Config, shape: Shape, offset: usize) -> Option { - match config.generics_indent() { + match config.indent_style() { IndentStyle::Visual => shape.visual_indent(1 + offset).sub_width(offset + 2), IndentStyle::Block => { // 1 = "," @@ -2497,14 +2497,14 @@ where let fmt = ListFormatting { tactic: tactic, separator: ",", - trailing_separator: if context.config.generics_indent() == IndentStyle::Visual { + trailing_separator: if context.config.indent_style() == IndentStyle::Visual { SeparatorTactic::Never } else { context.config.trailing_comma() }, separator_place: SeparatorPlace::Back, shape: shape, - ends_with_newline: tactic.ends_with_newline(context.config.generics_indent()), + ends_with_newline: tactic.ends_with_newline(context.config.indent_style()), preserve_newline: true, config: context.config, }; @@ -2523,7 +2523,7 @@ pub fn wrap_generics_with_angle_brackets( list_str: &str, list_offset: Indent, ) -> String { - if context.config.generics_indent() == IndentStyle::Block + if context.config.indent_style() == IndentStyle::Block && (list_str.contains('\n') || list_str.ends_with(',')) { format!( @@ -2674,7 +2674,7 @@ fn rewrite_where_clause( return Some(String::new()); } - if context.config.where_style() == Style::Rfc { + if context.config.indent_style() == IndentStyle::Block { return rewrite_where_clause_rfc_style( context, where_clause, @@ -2689,12 +2689,12 @@ fn rewrite_where_clause( let extra_indent = Indent::new(context.config.tab_spaces(), 0); - let offset = match context.config.where_pred_indent() { + let offset = match context.config.indent_style() { IndentStyle::Block => shape.indent + extra_indent.block_indent(context.config), // 6 = "where ".len() IndentStyle::Visual => shape.indent + extra_indent + 6, }; - // FIXME: if where_pred_indent != Visual, then the budgets below might + // FIXME: if indent_style != Visual, then the budgets below might // be out by a char or two. let budget = context.config.max_width() - offset.width(); @@ -2737,7 +2737,7 @@ fn rewrite_where_clause( trailing_separator: comma_tactic, separator_place: SeparatorPlace::Back, shape: Shape::legacy(budget, offset), - ends_with_newline: tactic.ends_with_newline(context.config.where_pred_indent()), + ends_with_newline: tactic.ends_with_newline(context.config.indent_style()), preserve_newline: true, config: context.config, }; diff --git a/src/lists.rs b/src/lists.rs index d560c88886ce..d7098d3a3974 100644 --- a/src/lists.rs +++ b/src/lists.rs @@ -737,7 +737,7 @@ pub fn struct_lit_shape( prefix_width: usize, suffix_width: usize, ) -> Option<(Option, Shape)> { - let v_shape = match context.config.struct_lit_indent() { + let v_shape = match context.config.indent_style() { IndentStyle::Visual => shape .visual_indent(0) .shrink_left(prefix_width)? @@ -766,7 +766,7 @@ pub fn struct_lit_tactic( items: &[ListItem], ) -> DefinitiveListTactic { if let Some(h_shape) = h_shape { - let prelim_tactic = match (context.config.struct_lit_indent(), items.len()) { + let prelim_tactic = match (context.config.indent_style(), items.len()) { (IndentStyle::Visual, 1) => ListTactic::HorizontalVertical, _ => context.config.struct_lit_multiline_style().to_list_tactic(), }; @@ -797,7 +797,7 @@ pub fn struct_lit_formatting<'a>( context: &'a RewriteContext, force_no_trailing_comma: bool, ) -> ListFormatting<'a> { - let ends_with_newline = context.config.struct_lit_indent() != IndentStyle::Visual + let ends_with_newline = context.config.indent_style() != IndentStyle::Visual && tactic == DefinitiveListTactic::Vertical; ListFormatting { tactic: tactic, diff --git a/src/rewrite.rs b/src/rewrite.rs index 823f69dc6ff2..1307f6731ff0 100644 --- a/src/rewrite.rs +++ b/src/rewrite.rs @@ -43,7 +43,7 @@ impl<'a> RewriteContext<'a> { /// Return true if we should use block indent style for rewriting function call. pub fn use_block_indent(&self) -> bool { - self.config.fn_call_indent() == IndentStyle::Block || self.use_block + self.config.indent_style() == IndentStyle::Block || self.use_block } pub fn budget(&self, used_width: usize) -> usize { diff --git a/src/types.rs b/src/types.rs index 59b4ac438b07..d2e782db1aa7 100644 --- a/src/types.rs +++ b/src/types.rs @@ -18,7 +18,7 @@ use syntax::symbol::keywords; use spanned::Spanned; use codemap::SpanUtils; -use config::{IndentStyle, Style, TypeDensity}; +use config::{IndentStyle, TypeDensity}; use expr::{rewrite_pair, rewrite_tuple, rewrite_unary_prefix, wrap_args_with_parens, PairParts}; use items::{format_generics_item_list, generics_shape_from_config}; use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListTactic, Separator, @@ -302,7 +302,7 @@ where // 2 for () let budget = shape.width.checked_sub(2)?; // 1 for ( - let offset = match context.config.fn_args_indent() { + let offset = match context.config.indent_style() { IndentStyle::Block => { shape .block() @@ -357,14 +357,14 @@ where }, separator_place: SeparatorPlace::Back, shape: list_shape, - ends_with_newline: tactic.ends_with_newline(context.config.fn_call_indent()), + ends_with_newline: tactic.ends_with_newline(context.config.indent_style()), preserve_newline: true, config: context.config, }; let list_str = write_list(&item_vec, &fmt)?; - let ty_shape = match context.config.fn_args_indent() { + let ty_shape = match context.config.indent_style() { IndentStyle::Block => shape.block().block_indent(context.config.tab_spaces()), IndentStyle::Visual => shape.block_left(4)?, }; @@ -447,9 +447,9 @@ impl Rewrite for ast::WherePredicate { } } else { let used_width = type_str.len() + colon.len(); - let ty_shape = match context.config.where_style() { - Style::Legacy => shape.block_left(used_width)?, - Style::Rfc => shape, + let ty_shape = match context.config.indent_style() { + IndentStyle::Visual => shape.block_left(used_width)?, + IndentStyle::Block => shape, }; let bounds = bounds .iter() From f3aba5d1df3166c572c651b5cd5a85265f452b8d Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 16:52:40 +0900 Subject: [PATCH 10/12] Update Configurations.md --- Configurations.md | 480 ++++++++++++++++++++-------------------------- 1 file changed, 210 insertions(+), 270 deletions(-) diff --git a/Configurations.md b/Configurations.md index 99f4f2dacbcd..433be8d98195 100644 --- a/Configurations.md +++ b/Configurations.md @@ -5,7 +5,7 @@ Rustfmt is designed to be very configurable. You can create a TOML file called ` A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this: ```toml -array_indent = "Block" +indent_style = "Block" array_width = 80 reorder_imported_names = true ``` @@ -22,7 +22,7 @@ Use this option to prevent a huge array from being vertically formatted. - **Default value**: `0` - **Possible values**: any positive integer -**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width. +**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width. #### `0` (default): @@ -50,13 +50,15 @@ let a = vec![ ]; ``` -## `array_indent` +## `indent_style` -Indent on arrays +Indent on expressions or items. - **Default value**: `"Block"` - **Possible values**: `"Block"`, `"Visual"` +### Array + #### `"Block"` (default): ```rust @@ -83,6 +85,200 @@ let lorem = vec!["ipsum", "elit"]; ``` +### Control flow + +#### `"Block"` (default): + +```rust +if lorem_ipsum && + dolor_sit && + amet_consectetur +{ + // ... +} +``` + +#### `"Visual"`: + +```rust +if lorem_ipsum && + dolor_sit && + amet_consectetur { + // ... +} +``` + +See also: [`control_brace_style`](#control_brace_style). + +### Function arguments + +#### `"Block"` (default): + +```rust +fn lorem() {} + +fn lorem(ipsum: usize) {} + +fn lorem( + ipsum: usize, + dolor: usize, + sit: usize, + amet: usize, + consectetur: usize, + adipiscing: usize, + elit: usize, +) { + // body +} +``` + +#### `"Visual"`: + +```rust +fn lorem() {} + +fn lorem(ipsum: usize) {} + +fn lorem(ipsum: usize, + dolor: usize, + sit: usize, + amet: usize, + consectetur: usize, + adipiscing: usize, + elit: usize) { + // body +} +``` + +### Functaion calls + +#### `"Block"` (default): + +```rust +lorem( + "lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit", +); +``` + +#### `"Visual"`: + +```rust +lorem("lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit"); +``` + +### Generics + +#### `"Block"` (default): + +```rust +fn lorem< + Ipsum: Eq = usize, + Dolor: Eq = usize, + Sit: Eq = usize, + Amet: Eq = usize, + Adipiscing: Eq = usize, + Consectetur: Eq = usize, + Elit: Eq = usize +>( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + adipiscing: Adipiscing, + consectetur: Consectetur, + elit: Elit, +) -> T { + // body +} +``` + +#### `"Visual"`: + +```rust +fn lorem + (ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + adipiscing: Adipiscing, + consectetur: Consectetur, + elit: Elit) + -> T { + // body +} +``` + +#### Struct + +#### `"Block"` (default): + +```rust +let lorem = Lorem { + ipsum: dolor, + sit: amet, +}; +``` + +#### `"Visual"`: + +```rust +let lorem = Lorem { ipsum: dolor, + sit: amet, }; +``` + +See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style). + +### Where predicates + +#### `"Block"` (default): + +```rust +fn lorem() -> T +where + Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq +{ + // body +} +``` + +#### `"Visual"`: + +```rust +fn lorem() -> T + where Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq +{ + // body +} +``` + +See also: [`where_density`](#where_density), [`where_layout`](#where_layout). + ## `array_width` Maximum width of an array literal before falling back to vertical formatting @@ -90,7 +286,7 @@ Maximum width of an array literal before falling back to vertical formatting - **Default value**: `60` - **Possible values**: any positive integer -**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width. +**Note:** A value of `0` results in [`indent_style`](#indent_style) being applied regardless of a line's width. #### Lines shorter than `array_width`: ```rust @@ -98,7 +294,7 @@ let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", " ``` #### Lines longer than `array_width`: -See [`array_indent`](#array_indent). +See [`indent_style`](#indent_style). ## `attributes_on_same_line_as_field` @@ -414,36 +610,13 @@ let (lorem, ipsum, _, _) = (1, 2, 3, 4); let (lorem, ipsum, ..) = (1, 2, 3, 4); ``` -## `control_style` +## `indent_style` Indent style for control flow statements - **Default value**: `"Rfc"` - **Possible values**: `"Rfc"`, `"Legacy"` -#### `"Rfc"` (default): - -```rust -if lorem_ipsum && - dolor_sit && - amet_consectetur -{ - // ... -} -``` - -#### `"Legacy"`: - -```rust -if lorem_ipsum && - dolor_sit && - amet_consectetur { - // ... -} -``` - -See also: [`control_brace_style`](#control_brace_style). - ## `control_brace_style` Brace style for control flow constructs @@ -640,51 +813,6 @@ trait Lorem { } ``` -## `fn_args_indent` - -Layout of function arguments and tuple structs - -- **Default value**: `"Block"` -- **Possible values**: `"Block"`, `"Visual"` - -#### `"Block"` (default): - -```rust -fn lorem() {} - -fn lorem(ipsum: usize) {} - -fn lorem( - ipsum: usize, - dolor: usize, - sit: usize, - amet: usize, - consectetur: usize, - adipiscing: usize, - elit: usize, -) { - // body -} -``` - -#### `"Visual"`: - -```rust -fn lorem() {} - -fn lorem(ipsum: usize) {} - -fn lorem(ipsum: usize, - dolor: usize, - sit: usize, - amet: usize, - consectetur: usize, - adipiscing: usize, - elit: usize) { - // body -} -``` - ## `fn_args_paren_newline` If function argument parenthesis goes on a newline @@ -784,41 +912,6 @@ where } ``` -## `fn_call_indent` - -Indentation for function calls, etc. - -- **Default value**: `"Block"` -- **Possible values**: `"Block"`, `"Visual"` - -#### `"Block"` (default): - -```rust -lorem( - "lorem", - "ipsum", - "dolor", - "sit", - "amet", - "consectetur", - "adipiscing", - "elit", -); -``` - -#### `"Visual"`: - -```rust -lorem("lorem", - "ipsum", - "dolor", - "sit", - "amet", - "consectetur", - "adipiscing", - "elit"); -``` - ## `fn_call_width` Maximum width of the args of a function call before falling back to vertical formatting @@ -835,7 +928,7 @@ lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "el #### Function call longer than `fn_call_width`: -See [`fn_call_indent`](#fn_call_indent). +See [`indent_style`](#indent_style). ## `fn_empty_single_line` @@ -900,7 +993,7 @@ fn lorem(ipsum: Ipsum, ``` -**Note**: This option only takes effect when `fn_call_indent` is set to `"Visual"`. +**Note**: This option only takes effect when `indent_style` is set to `"Visual"`. ## `fn_single_line` @@ -994,59 +1087,6 @@ let lorem = See also [`force_format_strings`](#force_format_strings), [`max_width`](#max_width). -## `generics_indent` - -Indentation of generics - -- **Default value**: `"Block"` -- **Possible values**: `"Block"`, `"Visual"` - -#### `"Block"` (default): - -```rust -fn lorem< - Ipsum: Eq = usize, - Dolor: Eq = usize, - Sit: Eq = usize, - Amet: Eq = usize, - Adipiscing: Eq = usize, - Consectetur: Eq = usize, - Elit: Eq = usize ->( - ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - adipiscing: Adipiscing, - consectetur: Consectetur, - elit: Elit, -) -> T { - // body -} -``` - -#### `"Visual"`: - -```rust -fn lorem - (ipsum: Ipsum, - dolor: Dolor, - sit: Sit, - amet: Amet, - adipiscing: Adipiscing, - consectetur: Consectetur, - elit: Elit) - -> T { - // body -} -``` - ## `hard_tabs` Use tab characters for indentation, spaces for alignment @@ -1982,32 +2022,7 @@ let lorem = Lorem { }; ``` -See also: [`struct_lit_indent`](#struct_lit_indent), [`struct_lit_width`](#struct_lit_width). - -## `struct_lit_indent` - -Style of struct definition - -- **Default value**: `"Block"` -- **Possible values**: `"Block"`, `"Visual"` - -#### `"Block"` (default): - -```rust -let lorem = Lorem { - ipsum: dolor, - sit: amet, -}; -``` - -#### `"Visual"`: - -```rust -let lorem = Lorem { ipsum: dolor, - sit: amet, }; -``` - -See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent). +See also: [`indent_style`](#indent_style), [`struct_lit_width`](#struct_lit_width). ## `struct_lit_width` @@ -2024,9 +2039,9 @@ let lorem = Lorem { ipsum: dolor, sit: amet }; ``` #### Lines longer than `struct_lit_width`: -See [`struct_lit_indent`](#struct_lit_indent). +See [`indent_style`](#indent_style). -See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent). +See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`indent_style`](#indent_style). ## `struct_variant_width` @@ -2308,7 +2323,7 @@ trait Lorem { **Note:** `where_density = "Tall"` currently produces the same output as `where_density = "Vertical"`. -See also: [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style). +See also: [`where_layout`](#where_layout), [`indent_style`](#indent_style). ## `where_layout` @@ -2389,82 +2404,7 @@ fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Am } ``` -**Note**: This option only takes effect when `where_style` is set to `"Legacy"`. - -See also: [`where_density`](#where_density), [`where_pred_indent`](#where_pred_indent), [`where_style`](#where_style). - -## `where_pred_indent` - -Indentation style of a where predicate - -- **Default value**: `"Visual"` -- **Possible values**: `"Block"`, `"Visual"` - -#### `"Visual"` (default): - -```rust -fn lorem() -> T - where Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq -{ - // body -} -``` - -#### `"Block"`: - -```rust -fn lorem() -> T - where Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq -{ - // body -} -``` - -**Note**: This option only takes effect when `where_style` is set to `"Legacy"`. - -See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_style`](#where_style). - -## `where_style` - -Overall strategy for where clauses - -- **Default value**: `"Rfc"` -- **Possible values**: `"Rfc"`, `"Legacy"` - -#### `"Rfc"` (default): - -```rust -fn lorem() -> T -where - Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq, -{ - // body -} -``` - -#### `"Legacy"`: - -```rust -fn lorem() -> T - where Ipsum: Eq, - Dolor: Eq, - Sit: Eq, - Amet: Eq -{ - // body -} -``` - -See also: [`where_density`](#where_density), [`where_layout`](#where_layout), [`where_pred_indent`](#where_pred_indent). +See also: [`where_density`](#where_density), [`indent_style`](#indent_style). ## `wrap_comments` From a770c0e34528004e2ce25f983538db1e156b8d2a Mon Sep 17 00:00:00 2001 From: topecongiro Date: Mon, 13 Nov 2017 17:37:56 +0900 Subject: [PATCH 11/12] Fix chains-visual test --- tests/target/chains-visual.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/target/chains-visual.rs b/tests/target/chains-visual.rs index a581703b7e53..9533e2f04b1d 100644 --- a/tests/target/chains-visual.rs +++ b/tests/target/chains-visual.rs @@ -43,8 +43,8 @@ fn main() { fffffffffffffffffffffffffffffffffff(a, { SCRIPT_TASK_ROOT.with(|root| { - *root.borrow_mut() = Some(&script_task); - }); + *root.borrow_mut() = Some(&script_task); + }); }); let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = xxxxxxx.map(|x| x + 5) @@ -53,9 +53,9 @@ fn main() { |acc, x| acc + x); aaaaaaaaaaaaaaaa.map(|x| { - x += 1; - x - }) + x += 1; + x + }) .filter(some_mod::some_filter) } @@ -93,16 +93,16 @@ fn floaters() { .baz(); Foo { x: val }.baz(|| { - force(); - multiline(); - }) + force(); + multiline(); + }) .quux(); Foo { y: i_am_multi_line, z: ok, }.baz(|| { - force(); - multiline(); - }) + force(); + multiline(); + }) .quux(); a + match x { From 9a58741f29b32c08be8f5a36fd0a3fcbf2a460a2 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Tue, 14 Nov 2017 09:31:50 +0900 Subject: [PATCH 12/12] Remove duplicated 'indent_style' section --- Configurations.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Configurations.md b/Configurations.md index 433be8d98195..6516784c481f 100644 --- a/Configurations.md +++ b/Configurations.md @@ -610,13 +610,6 @@ let (lorem, ipsum, _, _) = (1, 2, 3, 4); let (lorem, ipsum, ..) = (1, 2, 3, 4); ``` -## `indent_style` - -Indent style for control flow statements - -- **Default value**: `"Rfc"` -- **Possible values**: `"Rfc"`, `"Legacy"` - ## `control_brace_style` Brace style for control flow constructs