From d5d874099393203365f6f42cd29828c403d94660 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sat, 4 Nov 2017 22:46:40 +0900 Subject: [PATCH] Rename 'fn_call_style' to 'fn_call_indent' --- Configurations.md | 8 ++++---- legacy-rustfmt.toml | 2 +- src/config.rs | 2 +- src/expr.rs | 8 ++++---- src/rewrite.rs | 2 +- src/types.rs | 2 +- tests/source/big-impl-rfc.rs | 2 +- tests/source/closure-block-inside-macro.rs | 2 +- .../source/configs-fn_call_style-block-trailing-comma.rs | 2 +- tests/source/configs-fn_call_style-block.rs | 2 +- .../source/configs-fn_call_style-visual-trailing-comma.rs | 2 +- tests/source/configs-fn_call_style-visual.rs | 2 +- tests/source/configs-fn_call_width-zero.rs | 2 +- tests/source/expr-block.rs | 2 +- tests/target/big-impl-rfc.rs | 2 +- tests/target/closure-block-inside-macro.rs | 2 +- tests/target/configs-combine_control_expr-false.rs | 2 +- tests/target/configs-combine_control_expr-true.rs | 2 +- tests/target/configs-fn_call_style-block-tab_spaces-2.rs | 2 +- .../target/configs-fn_call_style-block-trailing-comma.rs | 2 +- tests/target/configs-fn_call_style-block.rs | 2 +- .../target/configs-fn_call_style-visual-trailing-comma.rs | 2 +- tests/target/configs-fn_call_style-visual.rs | 2 +- tests/target/configs-fn_call_width-zero.rs | 2 +- tests/target/expr-block.rs | 2 +- 25 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Configurations.md b/Configurations.md index f5d2cfa1df0..ae50daf7211 100644 --- a/Configurations.md +++ b/Configurations.md @@ -298,7 +298,7 @@ lorem_ipsum(|| { }); ``` -**Note**: This option only takes effect when `fn_call_style` is set to `"Visual"`. +**Note**: This option only takes effect when `fn_call_indent` is set to `"Visual"`. ## `combine_control_expr` @@ -758,7 +758,7 @@ where } ``` -## `fn_call_style` +## `fn_call_indent` Indentation for function calls, etc. @@ -809,7 +809,7 @@ lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "el #### Function call longer than `fn_call_width`: -See [`fn_call_style`](#fn_call_style). +See [`fn_call_indent`](#fn_call_indent). ## `fn_empty_single_line` @@ -874,7 +874,7 @@ fn lorem(ipsum: Ipsum, ``` -**Note**: This option only takes effect when `fn_call_style` is set to `"Visual"`. +**Note**: This option only takes effect when `fn_call_indent` is set to `"Visual"`. ## `fn_single_line` diff --git a/legacy-rustfmt.toml b/legacy-rustfmt.toml index 617791a2d25..6adaf36b6b3 100644 --- a/legacy-rustfmt.toml +++ b/legacy-rustfmt.toml @@ -3,6 +3,6 @@ array_indent = "Visual" control_style = "Legacy" where_style = "Legacy" generics_indent = "Visual" -fn_call_style = "Visual" +fn_call_indent = "Visual" combine_control_expr = false fn_args_paren_newline = true diff --git a/src/config.rs b/src/config.rs index d80019b998b..a0d1dda2126 100644 --- a/src/config.rs +++ b/src/config.rs @@ -581,7 +581,7 @@ create_config! { struct_lit_style: IndentStyle, IndentStyle::Block, false, "Style of struct definition"; struct_lit_multiline_style: MultilineStyle, MultilineStyle::PreferSingle, false, "Multiline style on literal structs"; - fn_call_style: IndentStyle, IndentStyle::Block, false, "Indentation for function calls, etc."; + 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, diff --git a/src/expr.rs b/src/expr.rs index 9888ffc3e00..0bc09c7a390 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -2033,7 +2033,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_style( + let nested_shape = shape_from_fn_call_indent( context, shape, used_width + 2 * paren_overhead, @@ -2379,7 +2379,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_style() == IndentStyle::Visual && args_len > 1) + || (context.config.fn_call_indent() == IndentStyle::Visual && args_len > 1) } ast::ExprKind::If(..) | ast::ExprKind::IfLet(..) | @@ -2391,7 +2391,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_style() == IndentStyle::Visual && args_len > 1 + || context.config.fn_call_indent() == IndentStyle::Visual && args_len > 1 } ast::ExprKind::Array(..) | ast::ExprKind::Call(..) | @@ -2722,7 +2722,7 @@ pub fn rewrite_field( } } -fn shape_from_fn_call_style( +fn shape_from_fn_call_indent( context: &RewriteContext, shape: Shape, overhead: usize, diff --git a/src/rewrite.rs b/src/rewrite.rs index e2be8ef086c..823f69dc6ff 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_style() == IndentStyle::Block || self.use_block + self.config.fn_call_indent() == IndentStyle::Block || self.use_block } pub fn budget(&self, used_width: usize) -> usize { diff --git a/src/types.rs b/src/types.rs index e3f97cc6b70..fd41fedabb6 100644 --- a/src/types.rs +++ b/src/types.rs @@ -357,7 +357,7 @@ where }, separator_place: SeparatorPlace::Back, shape: list_shape, - ends_with_newline: tactic.ends_with_newline(context.config.fn_call_style()), + ends_with_newline: tactic.ends_with_newline(context.config.fn_call_indent()), preserve_newline: true, config: context.config, }; diff --git a/tests/source/big-impl-rfc.rs b/tests/source/big-impl-rfc.rs index 2b3928f431f..86812fd5379 100644 --- a/tests/source/big-impl-rfc.rs +++ b/tests/source/big-impl-rfc.rs @@ -1,5 +1,5 @@ // rustfmt-fn_args_indent: Block -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt-generics_indent: Block // rustfmt-where_style: Rfc diff --git a/tests/source/closure-block-inside-macro.rs b/tests/source/closure-block-inside-macro.rs index d567008c2ad..2f7e04957e9 100644 --- a/tests/source/closure-block-inside-macro.rs +++ b/tests/source/closure-block-inside-macro.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // #1547 fuzz_target!(|data: &[u8]| if let Some(first) = data.first() { diff --git a/tests/source/configs-fn_call_style-block-trailing-comma.rs b/tests/source/configs-fn_call_style-block-trailing-comma.rs index ad813f6b98a..9d948594d8b 100644 --- a/tests/source/configs-fn_call_style-block-trailing-comma.rs +++ b/tests/source/configs-fn_call_style-block-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/source/configs-fn_call_style-block.rs b/tests/source/configs-fn_call_style-block.rs index ee6178c1902..76ccb001595 100644 --- a/tests/source/configs-fn_call_style-block.rs +++ b/tests/source/configs-fn_call_style-block.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // Function call style fn main() { diff --git a/tests/source/configs-fn_call_style-visual-trailing-comma.rs b/tests/source/configs-fn_call_style-visual-trailing-comma.rs index 61be7c5ea93..d6d1a86a631 100644 --- a/tests/source/configs-fn_call_style-visual-trailing-comma.rs +++ b/tests/source/configs-fn_call_style-visual-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_style: Visual +// rustfmt-fn_call_indent: Visual // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/source/configs-fn_call_style-visual.rs b/tests/source/configs-fn_call_style-visual.rs index 1cb48cfadd6..9561ffae23b 100644 --- a/tests/source/configs-fn_call_style-visual.rs +++ b/tests/source/configs-fn_call_style-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Visual +// rustfmt-fn_call_indent: 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 ee79c4ce805..da227dec4c7 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_style: block +// rustfmt-fn_call_indent: block // #1508 fn a() { diff --git a/tests/source/expr-block.rs b/tests/source/expr-block.rs index 2b899151535..3d46e3a9801 100644 --- a/tests/source/expr-block.rs +++ b/tests/source/expr-block.rs @@ -1,5 +1,5 @@ // rustfmt-array_indent: Block -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt-control_style: Rfc // Test expressions with block formatting. diff --git a/tests/target/big-impl-rfc.rs b/tests/target/big-impl-rfc.rs index 5ce1613d23b..b5c7b376f78 100644 --- a/tests/target/big-impl-rfc.rs +++ b/tests/target/big-impl-rfc.rs @@ -1,5 +1,5 @@ // rustfmt-fn_args_indent: Block -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt-generics_indent: Block // rustfmt-where_style: Rfc diff --git a/tests/target/closure-block-inside-macro.rs b/tests/target/closure-block-inside-macro.rs index d567008c2ad..2f7e04957e9 100644 --- a/tests/target/closure-block-inside-macro.rs +++ b/tests/target/closure-block-inside-macro.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // #1547 fuzz_target!(|data: &[u8]| if let Some(first) = data.first() { diff --git a/tests/target/configs-combine_control_expr-false.rs b/tests/target/configs-combine_control_expr-false.rs index 0d9ab24a6ed..432b2a03960 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_style: Block +// rustfmt-fn_call_indent: 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 925d2233539..58db874a825 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_style: Block +// rustfmt-fn_call_indent: 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-fn_call_style-block-tab_spaces-2.rs b/tests/target/configs-fn_call_style-block-tab_spaces-2.rs index 482c5c0e82a..238ab10060e 100644 --- a/tests/target/configs-fn_call_style-block-tab_spaces-2.rs +++ b/tests/target/configs-fn_call_style-block-tab_spaces-2.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt-max_width: 80 // rustfmt-tab_spaces: 2 diff --git a/tests/target/configs-fn_call_style-block-trailing-comma.rs b/tests/target/configs-fn_call_style-block-trailing-comma.rs index 4405f89f2af..f54715aea55 100644 --- a/tests/target/configs-fn_call_style-block-trailing-comma.rs +++ b/tests/target/configs-fn_call_style-block-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/target/configs-fn_call_style-block.rs b/tests/target/configs-fn_call_style-block.rs index 75d6b6765fb..0f9cbfcc0e3 100644 --- a/tests/target/configs-fn_call_style-block.rs +++ b/tests/target/configs-fn_call_style-block.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // Function call style fn main() { diff --git a/tests/target/configs-fn_call_style-visual-trailing-comma.rs b/tests/target/configs-fn_call_style-visual-trailing-comma.rs index 61be7c5ea93..d6d1a86a631 100644 --- a/tests/target/configs-fn_call_style-visual-trailing-comma.rs +++ b/tests/target/configs-fn_call_style-visual-trailing-comma.rs @@ -1,5 +1,5 @@ // rustfmt-error_on_line_overflow: false -// rustfmt-fn_call_style: Visual +// rustfmt-fn_call_indent: Visual // rustfmt should not add trailing comma when rewriting macro. See #1528. fn a() { diff --git a/tests/target/configs-fn_call_style-visual.rs b/tests/target/configs-fn_call_style-visual.rs index 598c2fff280..3a1e53a2274 100644 --- a/tests/target/configs-fn_call_style-visual.rs +++ b/tests/target/configs-fn_call_style-visual.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_call_style: Visual +// rustfmt-fn_call_indent: 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 3193bc228f7..f91a03c8188 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_style: block +// rustfmt-fn_call_indent: block // #1508 fn a() { diff --git a/tests/target/expr-block.rs b/tests/target/expr-block.rs index 75d15418ba2..a76c761f1dc 100644 --- a/tests/target/expr-block.rs +++ b/tests/target/expr-block.rs @@ -1,5 +1,5 @@ // rustfmt-array_indent: Block -// rustfmt-fn_call_style: Block +// rustfmt-fn_call_indent: Block // rustfmt-control_style: Rfc // Test expressions with block formatting.