Skip to content

Commit

Permalink
Rename fn_args_layout config option to fn_params_layout
Browse files Browse the repository at this point in the history
See rust-lang#4149 for more details. This change is targeted for rustfmt 2.0.

Closes rust-lang#4149
  • Loading branch information
ayazhafiz committed May 9, 2020
1 parent c83e729 commit 24e3297
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
6 changes: 3 additions & 3 deletions rustfmt-core/rustfmt-lib/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2613,7 +2613,7 @@ fn rewrite_params(
&param_items,
context
.config
.fn_args_layout()
.fn_params_layout()
.to_list_tactic(param_items.len()),
Separator::Comma,
one_line_budget,
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/tests/config/small_tabs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/tests/source/fn-custom-7.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/tests/source/fn-custom.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// rustfmt-fn_args_layout: Vertical
// rustfmt-fn_params_layout: Vertical

// Empty list should stay on one line.
fn do_bar(
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// rustfmt-fn_args_layout: Vertical
// Function arguments density
// rustfmt-fn_params_layout: Vertical
// Function parameter density

trait Lorem {
fn lorem(
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/tests/target/fn-custom-7.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/tests/target/fn-custom.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 24e3297

Please sign in to comment.