Skip to content

Commit 40c5666

Browse files
committed
Rename 'struct_lit_style' to 'struct_lit_indent'
1 parent d5d8740 commit 40c5666

15 files changed

+22
-22
lines changed

Configurations.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1868,9 +1868,9 @@ let lorem = Lorem {
18681868
};
18691869
```
18701870

1871-
See also: [`struct_lit_style`](#struct_lit_style), [`struct_lit_width`](#struct_lit_width).
1871+
See also: [`struct_lit_indent`](#struct_lit_indent), [`struct_lit_width`](#struct_lit_width).
18721872

1873-
## `struct_lit_style`
1873+
## `struct_lit_indent`
18741874

18751875
Style of struct definition
18761876

@@ -1893,7 +1893,7 @@ let lorem = Lorem { ipsum: dolor,
18931893
sit: amet, };
18941894
```
18951895

1896-
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1896+
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
18971897

18981898
## `struct_lit_width`
18991899

@@ -1910,9 +1910,9 @@ let lorem = Lorem { ipsum: dolor, sit: amet };
19101910
```
19111911

19121912
#### Lines longer than `struct_lit_width`:
1913-
See [`struct_lit_style`](#struct_lit_style).
1913+
See [`struct_lit_indent`](#struct_lit_indent).
19141914

1915-
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
1915+
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
19161916

19171917
## `struct_variant_width`
19181918

src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ create_config! {
578578
where_pred_indent: IndentStyle, IndentStyle::Visual, false,
579579
"Indentation style of a where predicate";
580580
generics_indent: IndentStyle, IndentStyle::Block, false, "Indentation of generics";
581-
struct_lit_style: IndentStyle, IndentStyle::Block, false, "Style of struct definition";
581+
struct_lit_indent: IndentStyle, IndentStyle::Block, false, "Style of struct definition";
582582
struct_lit_multiline_style: MultilineStyle, MultilineStyle::PreferSingle, false,
583583
"Multiline style on literal structs";
584584
fn_call_indent: IndentStyle, IndentStyle::Block, false, "Indentation for function calls, etc.";

src/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ fn rewrite_struct_lit<'a>(
26402640
let fields_str = wrap_struct_field(context, &fields_str, shape, v_shape, one_line_width);
26412641
Some(format!("{} {{{}}}", path_str, fields_str))
26422642

2643-
// FIXME if context.config.struct_lit_style() == Visual, but we run out
2643+
// FIXME if context.config.struct_lit_indent() == Visual, but we run out
26442644
// of space, we should fall back to BlockIndent.
26452645
}
26462646

@@ -2651,7 +2651,7 @@ pub fn wrap_struct_field(
26512651
nested_shape: Shape,
26522652
one_line_width: usize,
26532653
) -> String {
2654-
if context.config.struct_lit_style() == IndentStyle::Block
2654+
if context.config.struct_lit_indent() == IndentStyle::Block
26552655
&& (fields_str.contains('\n')
26562656
|| context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti
26572657
|| fields_str.len() > one_line_width)

src/lists.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ pub fn struct_lit_shape(
737737
prefix_width: usize,
738738
suffix_width: usize,
739739
) -> Option<(Option<Shape>, Shape)> {
740-
let v_shape = match context.config.struct_lit_style() {
740+
let v_shape = match context.config.struct_lit_indent() {
741741
IndentStyle::Visual => shape
742742
.visual_indent(0)
743743
.shrink_left(prefix_width)?
@@ -766,7 +766,7 @@ pub fn struct_lit_tactic(
766766
items: &[ListItem],
767767
) -> DefinitiveListTactic {
768768
if let Some(h_shape) = h_shape {
769-
let prelim_tactic = match (context.config.struct_lit_style(), items.len()) {
769+
let prelim_tactic = match (context.config.struct_lit_indent(), items.len()) {
770770
(IndentStyle::Visual, 1) => ListTactic::HorizontalVertical,
771771
_ => context.config.struct_lit_multiline_style().to_list_tactic(),
772772
};
@@ -797,7 +797,7 @@ pub fn struct_lit_formatting<'a>(
797797
context: &'a RewriteContext,
798798
force_no_trailing_comma: bool,
799799
) -> ListFormatting<'a> {
800-
let ends_with_newline = context.config.struct_lit_style() != IndentStyle::Visual
800+
let ends_with_newline = context.config.struct_lit_indent() != IndentStyle::Visual
801801
&& tactic == DefinitiveListTactic::Vertical;
802802
ListFormatting {
803803
tactic: tactic,

tests/config/small_tabs.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ where_layout = "Vertical"
1212
where_pred_indent = "Visual"
1313
generics_indent = "Visual"
1414
trailing_comma = "Vertical"
15-
struct_lit_style = "Block"
15+
struct_lit_indent = "Block"
1616
report_todo = "Always"
1717
report_fixme = "Never"
1818
reorder_imports = false

tests/source/configs-struct_lit_style-block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-struct_lit_style: Block
1+
// rustfmt-struct_lit_indent: Block
22
// Struct literal-style
33

44
fn main() {

tests/source/configs-struct_lit_style-visual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-struct_lit_style: Visual
1+
// rustfmt-struct_lit_indent: Visual
22
// Struct literal-style
33

44
fn main() {

tests/source/struct_lits_visual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-wrap_comments: true
3-
// rustfmt-struct_lit_style: Visual
3+
// rustfmt-struct_lit_indent: Visual
44
// rustfmt-error_on_line_overflow: false
55

66
// Struct literal expressions.

tests/source/struct_lits_visual_multiline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-wrap_comments: true
3-
// rustfmt-struct_lit_style: Visual
3+
// rustfmt-struct_lit_indent: Visual
44
// rustfmt-struct_lit_multiline_style: ForceMulti
55
// rustfmt-error_on_line_overflow: false
66

tests/source/struct_tuple_visual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-wrap_comments: true
33
// rustfmt-error_on_line_overflow: false
4-
// rustfmt-struct_lit_style: Visual
4+
// rustfmt-struct_lit_indent: Visual
55
fn foo() {
66
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b());
77

tests/target/configs-struct_lit_style-block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-struct_lit_style: Block
1+
// rustfmt-struct_lit_indent: Block
22
// Struct literal-style
33

44
fn main() {

tests/target/configs-struct_lit_style-visual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-struct_lit_style: Visual
1+
// rustfmt-struct_lit_indent: Visual
22
// Struct literal-style
33

44
fn main() {

tests/target/struct_lits_visual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-wrap_comments: true
3-
// rustfmt-struct_lit_style: Visual
3+
// rustfmt-struct_lit_indent: Visual
44
// rustfmt-error_on_line_overflow: false
55

66
// Struct literal expressions.

tests/target/struct_lits_visual_multiline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-wrap_comments: true
3-
// rustfmt-struct_lit_style: Visual
3+
// rustfmt-struct_lit_indent: Visual
44
// rustfmt-struct_lit_multiline_style: ForceMulti
55
// rustfmt-error_on_line_overflow: false
66

tests/target/struct_tuple_visual.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// rustfmt-normalize_comments: true
22
// rustfmt-wrap_comments: true
33
// rustfmt-error_on_line_overflow: false
4-
// rustfmt-struct_lit_style: Visual
4+
// rustfmt-struct_lit_indent: Visual
55
fn foo() {
66
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b());
77

0 commit comments

Comments
 (0)