Skip to content

Commit 5096cdf

Browse files
committed
Rename 'array_layout' to 'array_indent'
1 parent f15dd87 commit 5096cdf

16 files changed

+24
-24
lines changed

Configurations.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Rustfmt is designed to be very configurable. You can create a TOML file called `
55
A possible content of `rustfmt.toml` or `.rustfmt.toml` might look like this:
66

77
```toml
8-
array_layout = "Block"
8+
array_indent = "Block"
99
array_width = 80
1010
reorder_imported_names = true
1111
```
@@ -22,7 +22,7 @@ Use this option to prevent a huge array from being vertically formatted.
2222
- **Default value**: `0`
2323
- **Possible values**: any positive integer
2424

25-
**Note:** A value of `0` results in [`array_layout`](#array_layout) being applied regardless of a line's width.
25+
**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width.
2626

2727
#### `0` (default):
2828

@@ -50,7 +50,7 @@ let a = vec![
5050
];
5151
```
5252

53-
## `array_layout`
53+
## `array_indent`
5454

5555
Indent on arrays
5656

@@ -90,15 +90,15 @@ Maximum width of an array literal before falling back to vertical formatting
9090
- **Default value**: `60`
9191
- **Possible values**: any positive integer
9292

93-
**Note:** A value of `0` results in [`array_layout`](#array_layout) being applied regardless of a line's width.
93+
**Note:** A value of `0` results in [`array_indent`](#array_indent) being applied regardless of a line's width.
9494

9595
#### Lines shorter than `array_width`:
9696
```rust
9797
let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"];
9898
```
9999

100100
#### Lines longer than `array_width`:
101-
See [`array_layout`](#array_layout).
101+
See [`array_indent`](#array_indent).
102102

103103
## `attributes_on_same_line_as_field`
104104

legacy-rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn_args_layout = "Visual"
2-
array_layout = "Visual"
2+
array_indent = "Visual"
33
control_style = "Legacy"
44
where_style = "Legacy"
55
generics_indent = "Visual"

src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ create_config! {
561561
fn_args_density: Density, Density::Tall, false, "Argument density in functions";
562562
fn_args_layout: IndentStyle, IndentStyle::Block, false,
563563
"Layout of function arguments and tuple structs";
564-
array_layout: IndentStyle, IndentStyle::Block, false, "Indent on arrays";
564+
array_indent: IndentStyle, IndentStyle::Block, false, "Indent on arrays";
565565
array_width: usize, 60, false,
566566
"Maximum width of an array literal before falling back to vertical formatting";
567567
array_horizontal_layout_threshold: usize, 0, false,

src/expr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ where
419419
1 // "["
420420
};
421421

422-
let nested_shape = match context.config.array_layout() {
422+
let nested_shape = match context.config.array_indent() {
423423
IndentStyle::Block => shape
424424
.block()
425425
.block_indent(context.config.tab_spaces())
@@ -454,7 +454,7 @@ where
454454
.iter()
455455
.any(|li| li.item.as_ref().map(|s| s.len() > 10).unwrap_or(false));
456456

457-
let mut tactic = match context.config.array_layout() {
457+
let mut tactic = match context.config.array_indent() {
458458
IndentStyle::Block => {
459459
// FIXME wrong shape in one-line case
460460
match shape.width.checked_sub(2 * bracket_size) {
@@ -477,7 +477,7 @@ where
477477
DefinitiveListTactic::Mixed
478478
},
479479
};
480-
let ends_with_newline = tactic.ends_with_newline(context.config.array_layout());
480+
let ends_with_newline = tactic.ends_with_newline(context.config.array_indent());
481481
if context.config.array_horizontal_layout_threshold() > 0
482482
&& items.len() > context.config.array_horizontal_layout_threshold()
483483
{
@@ -489,7 +489,7 @@ where
489489
separator: ",",
490490
trailing_separator: if trailing_comma {
491491
SeparatorTactic::Always
492-
} else if context.inside_macro || context.config.array_layout() == IndentStyle::Visual {
492+
} else if context.inside_macro || context.config.array_indent() == IndentStyle::Visual {
493493
SeparatorTactic::Never
494494
} else {
495495
SeparatorTactic::Vertical
@@ -502,7 +502,7 @@ where
502502
};
503503
let list_str = write_list(&items, &fmt)?;
504504

505-
let result = if context.config.array_layout() == IndentStyle::Visual
505+
let result = if context.config.array_indent() == IndentStyle::Visual
506506
|| tactic == DefinitiveListTactic::Horizontal
507507
{
508508
if context.config.spaces_within_square_brackets() && !list_str.is_empty() {

tests/source/configs-array_horizontal_layout_threshold-1000-visual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-array_horizontal_layout_threshold: 1000
2-
// rustfmt-array_layout: Visual
2+
// rustfmt-array_indent: Visual
33

44
const ARRAY: [u8; 2048] =
55
[99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116,

tests/source/configs-array_layout-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-array_layout: Block
1+
// rustfmt-array_indent: Block
22
// Array layout
33

44
fn main() {

tests/source/configs-array_layout-visual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-array_layout: Visual
1+
// rustfmt-array_indent: Visual
22
// Array layout
33

44
fn main() {

tests/source/configs-tab_spaces-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-tab_spaces: 2
22
// rustfmt-max_width: 30
3-
// rustfmt-array_layout: Block
3+
// rustfmt-array_indent: Block
44
// Tab spaces
55

66
fn lorem() {

tests/source/configs-tab_spaces-4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-tab_spaces: 4
22
// rustfmt-max_width: 30
3-
// rustfmt-array_layout: Block
3+
// rustfmt-array_indent: Block
44
// Tab spaces
55

66
fn lorem() {

tests/source/expr-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-array_layout: Block
1+
// rustfmt-array_indent: Block
22
// rustfmt-fn_call_style: Block
33
// rustfmt-control_style: Rfc
44
// Test expressions with block formatting.

tests/target/configs-array_horizontal_layout_threshold-1000-visual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// rustfmt-array_horizontal_layout_threshold: 1000
2-
// rustfmt-array_layout: Visual
2+
// rustfmt-array_indent: Visual
33

44
const ARRAY: [u8; 2048] =
55
[99, 72, 48, 104, 44, 112, 38, 62, 40, 93, 23, 24, 32, 21, 102, 76, 65, 29, 116, 21, 18, 37,

tests/target/configs-array_layout-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-array_layout: Block
1+
// rustfmt-array_indent: Block
22
// Array layout
33

44
fn main() {

tests/target/configs-array_layout-visual.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-array_layout: Visual
1+
// rustfmt-array_indent: Visual
22
// Array layout
33

44
fn main() {

tests/target/configs-tab_spaces-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-tab_spaces: 2
22
// rustfmt-max_width: 30
3-
// rustfmt-array_layout: Block
3+
// rustfmt-array_indent: Block
44
// Tab spaces
55

66
fn lorem() {

tests/target/configs-tab_spaces-4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-tab_spaces: 4
22
// rustfmt-max_width: 30
3-
// rustfmt-array_layout: Block
3+
// rustfmt-array_indent: Block
44
// Tab spaces
55

66
fn lorem() {

tests/target/expr-block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-array_layout: Block
1+
// rustfmt-array_indent: Block
22
// rustfmt-fn_call_style: Block
33
// rustfmt-control_style: Rfc
44
// Test expressions with block formatting.

0 commit comments

Comments
 (0)