Skip to content

Commit 55c2000

Browse files
committed
Rename 'fn_args_layout' to 'fn_args_indent'
1 parent 5096cdf commit 55c2000

29 files changed

+39
-39
lines changed

Configurations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ trait Lorem {
614614
}
615615
```
616616

617-
## `fn_args_layout`
617+
## `fn_args_indent`
618618

619619
Layout of function arguments and tuple structs
620620

legacy-rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn_args_layout = "Visual"
1+
fn_args_indent = "Visual"
22
array_indent = "Visual"
33
control_style = "Legacy"
44
where_style = "Legacy"

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ create_config! {
559559
"Location of return type in function declaration";
560560
fn_args_paren_newline: bool, false, false, "If function argument parenthesis goes on a newline";
561561
fn_args_density: Density, Density::Tall, false, "Argument density in functions";
562-
fn_args_layout: IndentStyle, IndentStyle::Block, false,
562+
fn_args_indent: IndentStyle, IndentStyle::Block, false,
563563
"Layout of function arguments and tuple structs";
564564
array_indent: IndentStyle, IndentStyle::Block, false, "Indent on arrays";
565565
array_width: usize, 60, false,

src/items.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -933,8 +933,8 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
933933
let has_body = !trait_items.is_empty();
934934

935935
let where_density = if (context.config.where_density() == Density::Compressed
936-
&& (!result.contains('\n') || context.config.fn_args_layout() == IndentStyle::Block))
937-
|| (context.config.fn_args_layout() == IndentStyle::Block && result.is_empty())
936+
&& (!result.contains('\n') || context.config.fn_args_indent() == IndentStyle::Block))
937+
|| (context.config.fn_args_indent() == IndentStyle::Block && result.is_empty())
938938
|| (context.config.where_density() == Density::CompressedIfEmpty && !has_body
939939
&& !result.contains('\n'))
940940
{
@@ -1746,13 +1746,13 @@ fn rewrite_fn_base(
17461746
} else if context.config.fn_args_paren_newline() {
17471747
result.push('\n');
17481748
result.push_str(&arg_indent.to_string(context.config));
1749-
if context.config.fn_args_layout() == IndentStyle::Visual {
1749+
if context.config.fn_args_indent() == IndentStyle::Visual {
17501750
arg_indent = arg_indent + 1; // extra space for `(`
17511751
}
17521752
result.push('(');
17531753
} else {
17541754
result.push_str("(");
1755-
if context.config.fn_args_layout() == IndentStyle::Visual {
1755+
if context.config.fn_args_indent() == IndentStyle::Visual {
17561756
result.push('\n');
17571757
result.push_str(&arg_indent.to_string(context.config));
17581758
}
@@ -1805,7 +1805,7 @@ fn rewrite_fn_base(
18051805
generics_str.contains('\n'),
18061806
)?;
18071807

1808-
let put_args_in_block = match context.config.fn_args_layout() {
1808+
let put_args_in_block = match context.config.fn_args_indent() {
18091809
IndentStyle::Block => arg_str.contains('\n') || arg_str.len() > one_line_budget,
18101810
_ => false,
18111811
} && !fd.inputs.is_empty();
@@ -1846,7 +1846,7 @@ fn rewrite_fn_base(
18461846

18471847
// Return type.
18481848
if let ast::FunctionRetTy::Ty(..) = fd.output {
1849-
let ret_should_indent = match context.config.fn_args_layout() {
1849+
let ret_should_indent = match context.config.fn_args_indent() {
18501850
// If our args are block layout then we surely must have space.
18511851
IndentStyle::Block if put_args_in_block || fd.inputs.is_empty() => false,
18521852
_ if args_last_line_contains_comment => false,
@@ -2131,7 +2131,7 @@ fn rewrite_args(
21312131
.and_then(|item| item.post_comment.as_ref())
21322132
.map_or(false, |s| s.trim().starts_with("//"));
21332133

2134-
let (indent, trailing_comma) = match context.config.fn_args_layout() {
2134+
let (indent, trailing_comma) = match context.config.fn_args_indent() {
21352135
IndentStyle::Block if fits_in_one_line => {
21362136
(indent.block_indent(context.config), SeparatorTactic::Never)
21372137
}
@@ -2168,7 +2168,7 @@ fn rewrite_args(
21682168
},
21692169
separator_place: SeparatorPlace::Back,
21702170
shape: Shape::legacy(budget, indent),
2171-
ends_with_newline: tactic.ends_with_newline(context.config.fn_args_layout()),
2171+
ends_with_newline: tactic.ends_with_newline(context.config.fn_args_indent()),
21722172
preserve_newline: true,
21732173
config: context.config,
21742174
};
@@ -2218,7 +2218,7 @@ fn compute_budgets_for_args(
22182218

22192219
if one_line_budget > 0 {
22202220
// 4 = "() {".len()
2221-
let (indent, multi_line_budget) = match context.config.fn_args_layout() {
2221+
let (indent, multi_line_budget) = match context.config.fn_args_indent() {
22222222
IndentStyle::Block => {
22232223
let indent = indent.block_indent(context.config);
22242224
(indent, context.budget(indent.width() + 1))
@@ -2236,7 +2236,7 @@ fn compute_budgets_for_args(
22362236

22372237
// Didn't work. we must force vertical layout and put args on a newline.
22382238
let new_indent = indent.block_indent(context.config);
2239-
let used_space = match context.config.fn_args_layout() {
2239+
let used_space = match context.config.fn_args_indent() {
22402240
// 1 = `,`
22412241
IndentStyle::Block => new_indent.width() + 1,
22422242
// Account for `)` and possibly ` {`.

src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ where
302302
// 2 for ()
303303
let budget = shape.width.checked_sub(2)?;
304304
// 1 for (
305-
let offset = match context.config.fn_args_layout() {
305+
let offset = match context.config.fn_args_indent() {
306306
IndentStyle::Block => {
307307
shape
308308
.block()
@@ -364,7 +364,7 @@ where
364364

365365
let list_str = write_list(&item_vec, &fmt)?;
366366

367-
let ty_shape = match context.config.fn_args_layout() {
367+
let ty_shape = match context.config.fn_args_indent() {
368368
IndentStyle::Block => shape.block().block_indent(context.config.tab_spaces()),
369369
IndentStyle::Visual => shape.block_left(4)?,
370370
};

tests/config/small_tabs.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fn_brace_style = "SameLineWhere"
66
fn_return_indent = "WithArgs"
77
fn_args_paren_newline = true
88
fn_args_density = "Tall"
9-
fn_args_layout = "Visual"
9+
fn_args_indent = "Visual"
1010
where_density = "Tall"
1111
where_layout = "Vertical"
1212
where_pred_indent = "Visual"

tests/source/big-impl-rfc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_call_style: Block
33
// rustfmt-generics_indent: Block
44
// rustfmt-where_style: Rfc

tests/source/configs-fn_args_layout-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// Function arguments layout
33

44
fn lorem() {}

tests/source/configs-fn_args_layout-visual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Visual
1+
// rustfmt-fn_args_indent: Visual
22
// Function arguments layout
33

44
fn lorem() {}

tests/source/fn-custom-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-generics_indent: Block
33
// rustfmt-where_layout: Mixed
44
// Test different indents.

tests/source/fn-custom-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-generics_indent: Block
33
// rustfmt-where_layout: HorizontalVertical
44
// Test different indents.

tests/source/fn-custom-6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_brace_style: PreferSameLine
33
// Test different indents.
44

tests/source/fn-custom-7.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-fn_args_layout: Block
2+
// rustfmt-fn_args_indent: Block
33
// rustfmt-fn_args_density: Vertical
44
// rustfmt-fn_brace_style: AlwaysNextLine
55

tests/source/fn-custom-8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_brace_style: PreferSameLine
33
// Test different indents.
44

tests/source/fn_args_layout-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-fn_args_layout: Block
2+
// rustfmt-fn_args_indent: Block
33

44
fn foo() {
55
foo();

tests/source/issue-1278.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout = "block"
1+
// rustfmt-fn_args_indent = "block"
22

33
#![feature(pub_restricted)]
44

tests/source/where-clause-rfc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-where_style: Rfc
33

44
fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape) where T: FOo, U: Bar {

tests/target/big-impl-rfc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_call_style: Block
33
// rustfmt-generics_indent: Block
44
// rustfmt-where_style: Rfc

tests/target/configs-fn_args_layout-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// Function arguments layout
33

44
fn lorem() {}

tests/target/configs-fn_args_layout-visual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Visual
1+
// rustfmt-fn_args_indent: Visual
22
// Function arguments layout
33

44
fn lorem() {}

tests/target/fn-custom-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-generics_indent: Block
33
// rustfmt-where_layout: Mixed
44
// Test different indents.

tests/target/fn-custom-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-generics_indent: Block
33
// rustfmt-where_layout: HorizontalVertical
44
// Test different indents.

tests/target/fn-custom-6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_brace_style: PreferSameLine
33
// Test different indents.
44

tests/target/fn-custom-7.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-fn_args_layout: Block
2+
// rustfmt-fn_args_indent: Block
33
// rustfmt-fn_args_density: Vertical
44
// rustfmt-fn_brace_style: AlwaysNextLine
55

tests/target/fn-custom-8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_brace_style: PreferSameLine
33
// Test different indents.
44

tests/target/fn_args_layout-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-normalize_comments: true
2-
// rustfmt-fn_args_layout: Block
2+
// rustfmt-fn_args_indent: Block
33

44
fn foo() {
55
foo();

tests/target/issue-1278.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout = "block"
1+
// rustfmt-fn_args_indent = "block"
22

33
#![feature(pub_restricted)]
44

tests/target/issue-1624.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-fn_args_paren_newline: false
33

44
// #1624

tests/target/where-clause-rfc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-fn_args_layout: Block
1+
// rustfmt-fn_args_indent: Block
22
// rustfmt-where_style: Rfc
33

44
fn reflow_list_node_with_rule(node: &CompoundNode, rule: &Rule, args: &[Arg], shape: &Shape)

0 commit comments

Comments
 (0)