diff --git a/Configurations.md b/Configurations.md index aea2673f567..e013c711c2c 100644 --- a/Configurations.md +++ b/Configurations.md @@ -637,9 +637,9 @@ trailing whitespaces. - **Possible values**: `true`, `false` - **Stable**: No (tracking issue: [#3392](https://github.com/rust-lang/rustfmt/issues/3392)) -## `fn_args_layout` +## `fn_params_layout` -Control the layout of arguments in a function +Control the layout of parameters in a function signature - **Default value**: `"Tall"` - **Possible values**: `"Compressed"`, `"Tall"`, `"Vertical"` diff --git a/rustfmt-core/rustfmt-lib/src/config.rs b/rustfmt-core/rustfmt-lib/src/config.rs index e479608841a..c321bea0686 100644 --- a/rustfmt-core/rustfmt-lib/src/config.rs +++ b/rustfmt-core/rustfmt-lib/src/config.rs @@ -108,8 +108,8 @@ create_config! { the same line with the pattern of arms"; force_multiline_blocks: bool, false, false, "Force multiline closure bodies and match arms to be wrapped in a block"; - fn_args_layout: Density, Density::Tall, true, - "Control the layout of arguments in a function"; + fn_params_layout: Density, Density::Tall, true, + "Control the layout of parameters in a function signature"; brace_style: BraceStyle, BraceStyle::SameLineWhere, false, "Brace style for items"; control_brace_style: ControlBraceStyle, ControlBraceStyle::AlwaysSameLine, false, "Brace style for control flow constructs"; @@ -552,7 +552,7 @@ struct_field_align_threshold = 0 enum_discrim_align_threshold = 0 match_arm_blocks = true force_multiline_blocks = false -fn_args_layout = "Tall" +fn_params_layout = "Tall" brace_style = "SameLineWhere" control_brace_style = "AlwaysSameLine" trailing_semicolon = true diff --git a/rustfmt-core/rustfmt-lib/src/items.rs b/rustfmt-core/rustfmt-lib/src/items.rs index 3b71f1bb19d..78385151a7b 100644 --- a/rustfmt-core/rustfmt-lib/src/items.rs +++ b/rustfmt-core/rustfmt-lib/src/items.rs @@ -2613,7 +2613,7 @@ fn rewrite_params( ¶m_items, context .config - .fn_args_layout() + .fn_params_layout() .to_list_tactic(param_items.len()), Separator::Comma, one_line_budget, diff --git a/rustfmt-core/rustfmt-lib/tests/config/small_tabs.toml b/rustfmt-core/rustfmt-lib/tests/config/small_tabs.toml index c3cfd34317a..4c37100894f 100644 --- a/rustfmt-core/rustfmt-lib/tests/config/small_tabs.toml +++ b/rustfmt-core/rustfmt-lib/tests/config/small_tabs.toml @@ -3,7 +3,7 @@ comment_width = 80 tab_spaces = 2 newline_style = "Unix" brace_style = "SameLineWhere" -fn_args_layout = "Tall" +fn_params_layout = "Tall" trailing_comma = "Vertical" indent_style = "Block" reorder_imports = false diff --git a/rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/compressed.rs b/rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/compressed.rs similarity index 86% rename from rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/compressed.rs rename to rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/compressed.rs index 66a371c259f..ee2a21a3ee6 100644 --- a/rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/compressed.rs +++ b/rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/compressed.rs @@ -1,5 +1,5 @@ -// rustfmt-fn_args_layout: Compressed -// Function arguments density +// rustfmt-fn_params_layout: Compressed +// Function parameter density trait Lorem { fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); diff --git a/rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/tall.rs b/rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/tall.rs similarity index 87% rename from rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/tall.rs rename to rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/tall.rs index f11e86fd313..9cf02df7d05 100644 --- a/rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/tall.rs +++ b/rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/tall.rs @@ -1,5 +1,5 @@ -// rustfmt-fn_args_layout: Tall -// Function arguments density +// rustfmt-fn_params_layout: Tall +// Function parameter density trait Lorem { fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); diff --git a/rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/vertical.rs b/rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/vertical.rs similarity index 86% rename from rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/vertical.rs rename to rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/vertical.rs index a23cc025225..8eca5c72a55 100644 --- a/rustfmt-core/rustfmt-lib/tests/source/configs/fn_args_layout/vertical.rs +++ b/rustfmt-core/rustfmt-lib/tests/source/configs/fn_params_layout/vertical.rs @@ -1,5 +1,5 @@ -// rustfmt-fn_args_layout: Vertical -// Function arguments density +// rustfmt-fn_params_layout: Vertical +// Function parameter density trait Lorem { fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); diff --git a/rustfmt-core/rustfmt-lib/tests/source/fn-custom-7.rs b/rustfmt-core/rustfmt-lib/tests/source/fn-custom-7.rs index d5330196bf7..3ecd8701727 100644 --- a/rustfmt-core/rustfmt-lib/tests/source/fn-custom-7.rs +++ b/rustfmt-core/rustfmt-lib/tests/source/fn-custom-7.rs @@ -1,5 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-fn_args_layout: Vertical +// rustfmt-fn_params_layout: Vertical // rustfmt-brace_style: AlwaysNextLine // Case with only one variable. diff --git a/rustfmt-core/rustfmt-lib/tests/source/fn-custom.rs b/rustfmt-core/rustfmt-lib/tests/source/fn-custom.rs index 77ced4c5e0e..64ef0ecfaae 100644 --- a/rustfmt-core/rustfmt-lib/tests/source/fn-custom.rs +++ b/rustfmt-core/rustfmt-lib/tests/source/fn-custom.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_layout: Compressed +// rustfmt-fn_params_layout: Compressed // Test some of the ways function signatures can be customised. // Test compressed layout of args. diff --git a/rustfmt-core/rustfmt-lib/tests/source/fn_args_layout-vertical.rs b/rustfmt-core/rustfmt-lib/tests/source/fn_params_layout-vertical.rs similarity index 95% rename from rustfmt-core/rustfmt-lib/tests/source/fn_args_layout-vertical.rs rename to rustfmt-core/rustfmt-lib/tests/source/fn_params_layout-vertical.rs index 759bc83d015..fd6e3f0442e 100644 --- a/rustfmt-core/rustfmt-lib/tests/source/fn_args_layout-vertical.rs +++ b/rustfmt-core/rustfmt-lib/tests/source/fn_params_layout-vertical.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_layout: Vertical +// rustfmt-fn_params_layout: Vertical // Empty list should stay on one line. fn do_bar( diff --git a/rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/compressed.rs b/rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/compressed.rs similarity index 87% rename from rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/compressed.rs rename to rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/compressed.rs index f189446e25d..6274b4431ac 100644 --- a/rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/compressed.rs +++ b/rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/compressed.rs @@ -1,5 +1,5 @@ -// rustfmt-fn_args_layout: Compressed -// Function arguments density +// rustfmt-fn_params_layout: Compressed +// Function parameter density trait Lorem { fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); diff --git a/rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/tall.rs b/rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/tall.rs similarity index 89% rename from rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/tall.rs rename to rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/tall.rs index 20f308973ac..c45cd4455b3 100644 --- a/rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/tall.rs +++ b/rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/tall.rs @@ -1,5 +1,5 @@ -// rustfmt-fn_args_layout: Tall -// Function arguments density +// rustfmt-fn_params_layout: Tall +// Function parameter density trait Lorem { fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); diff --git a/rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/vertical.rs b/rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/vertical.rs similarity index 90% rename from rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/vertical.rs rename to rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/vertical.rs index 6c695a75df9..ae98de097f3 100644 --- a/rustfmt-core/rustfmt-lib/tests/target/configs/fn_args_layout/vertical.rs +++ b/rustfmt-core/rustfmt-lib/tests/target/configs/fn_params_layout/vertical.rs @@ -1,5 +1,5 @@ -// rustfmt-fn_args_layout: Vertical -// Function arguments density +// rustfmt-fn_params_layout: Vertical +// Function parameter density trait Lorem { fn lorem( diff --git a/rustfmt-core/rustfmt-lib/tests/target/fn-custom-7.rs b/rustfmt-core/rustfmt-lib/tests/target/fn-custom-7.rs index 2c20ac5a752..f6a1a90c3fc 100644 --- a/rustfmt-core/rustfmt-lib/tests/target/fn-custom-7.rs +++ b/rustfmt-core/rustfmt-lib/tests/target/fn-custom-7.rs @@ -1,5 +1,5 @@ // rustfmt-normalize_comments: true -// rustfmt-fn_args_layout: Vertical +// rustfmt-fn_params_layout: Vertical // rustfmt-brace_style: AlwaysNextLine // Case with only one variable. diff --git a/rustfmt-core/rustfmt-lib/tests/target/fn-custom.rs b/rustfmt-core/rustfmt-lib/tests/target/fn-custom.rs index 2eb2a973d24..506d9de3437 100644 --- a/rustfmt-core/rustfmt-lib/tests/target/fn-custom.rs +++ b/rustfmt-core/rustfmt-lib/tests/target/fn-custom.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_layout: Compressed +// rustfmt-fn_params_layout: Compressed // Test some of the ways function signatures can be customised. // Test compressed layout of args. diff --git a/rustfmt-core/rustfmt-lib/tests/target/fn_args_layout-vertical.rs b/rustfmt-core/rustfmt-lib/tests/target/fn_params_layout-vertical.rs similarity index 96% rename from rustfmt-core/rustfmt-lib/tests/target/fn_args_layout-vertical.rs rename to rustfmt-core/rustfmt-lib/tests/target/fn_params_layout-vertical.rs index da0ac981d87..bfeca15c967 100644 --- a/rustfmt-core/rustfmt-lib/tests/target/fn_args_layout-vertical.rs +++ b/rustfmt-core/rustfmt-lib/tests/target/fn_params_layout-vertical.rs @@ -1,4 +1,4 @@ -// rustfmt-fn_args_layout: Vertical +// rustfmt-fn_params_layout: Vertical // Empty list should stay on one line. fn do_bar() -> u8 {