Rename 'struct_lit_style' to 'struct_lit_indent'
This commit is contained in:
parent
d5d8740993
commit
40c5666af6
15 changed files with 22 additions and 22 deletions
|
@ -1868,9 +1868,9 @@ let lorem = Lorem {
|
|||
};
|
||||
```
|
||||
|
||||
See also: [`struct_lit_style`](#struct_lit_style), [`struct_lit_width`](#struct_lit_width).
|
||||
See also: [`struct_lit_indent`](#struct_lit_indent), [`struct_lit_width`](#struct_lit_width).
|
||||
|
||||
## `struct_lit_style`
|
||||
## `struct_lit_indent`
|
||||
|
||||
Style of struct definition
|
||||
|
||||
|
@ -1893,7 +1893,7 @@ let lorem = Lorem { ipsum: dolor,
|
|||
sit: amet, };
|
||||
```
|
||||
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
|
||||
|
||||
## `struct_lit_width`
|
||||
|
||||
|
@ -1910,9 +1910,9 @@ let lorem = Lorem { ipsum: dolor, sit: amet };
|
|||
```
|
||||
|
||||
#### Lines longer than `struct_lit_width`:
|
||||
See [`struct_lit_style`](#struct_lit_style).
|
||||
See [`struct_lit_indent`](#struct_lit_indent).
|
||||
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_style`](#struct_lit_style).
|
||||
See also: [`struct_lit_multiline_style`](#struct_lit_multiline_style), [`struct_lit_indent`](#struct_lit_indent).
|
||||
|
||||
## `struct_variant_width`
|
||||
|
||||
|
|
|
@ -578,7 +578,7 @@ create_config! {
|
|||
where_pred_indent: IndentStyle, IndentStyle::Visual, false,
|
||||
"Indentation style of a where predicate";
|
||||
generics_indent: IndentStyle, IndentStyle::Block, false, "Indentation of generics";
|
||||
struct_lit_style: IndentStyle, IndentStyle::Block, false, "Style of struct definition";
|
||||
struct_lit_indent: IndentStyle, IndentStyle::Block, false, "Style of struct definition";
|
||||
struct_lit_multiline_style: MultilineStyle, MultilineStyle::PreferSingle, false,
|
||||
"Multiline style on literal structs";
|
||||
fn_call_indent: IndentStyle, IndentStyle::Block, false, "Indentation for function calls, etc.";
|
||||
|
|
|
@ -2640,7 +2640,7 @@ fn rewrite_struct_lit<'a>(
|
|||
let fields_str = wrap_struct_field(context, &fields_str, shape, v_shape, one_line_width);
|
||||
Some(format!("{} {{{}}}", path_str, fields_str))
|
||||
|
||||
// FIXME if context.config.struct_lit_style() == Visual, but we run out
|
||||
// FIXME if context.config.struct_lit_indent() == Visual, but we run out
|
||||
// of space, we should fall back to BlockIndent.
|
||||
}
|
||||
|
||||
|
@ -2651,7 +2651,7 @@ pub fn wrap_struct_field(
|
|||
nested_shape: Shape,
|
||||
one_line_width: usize,
|
||||
) -> String {
|
||||
if context.config.struct_lit_style() == IndentStyle::Block
|
||||
if context.config.struct_lit_indent() == IndentStyle::Block
|
||||
&& (fields_str.contains('\n')
|
||||
|| context.config.struct_lit_multiline_style() == MultilineStyle::ForceMulti
|
||||
|| fields_str.len() > one_line_width)
|
||||
|
|
|
@ -737,7 +737,7 @@ pub fn struct_lit_shape(
|
|||
prefix_width: usize,
|
||||
suffix_width: usize,
|
||||
) -> Option<(Option<Shape>, Shape)> {
|
||||
let v_shape = match context.config.struct_lit_style() {
|
||||
let v_shape = match context.config.struct_lit_indent() {
|
||||
IndentStyle::Visual => shape
|
||||
.visual_indent(0)
|
||||
.shrink_left(prefix_width)?
|
||||
|
@ -766,7 +766,7 @@ pub fn struct_lit_tactic(
|
|||
items: &[ListItem],
|
||||
) -> DefinitiveListTactic {
|
||||
if let Some(h_shape) = h_shape {
|
||||
let prelim_tactic = match (context.config.struct_lit_style(), items.len()) {
|
||||
let prelim_tactic = match (context.config.struct_lit_indent(), items.len()) {
|
||||
(IndentStyle::Visual, 1) => ListTactic::HorizontalVertical,
|
||||
_ => context.config.struct_lit_multiline_style().to_list_tactic(),
|
||||
};
|
||||
|
@ -797,7 +797,7 @@ pub fn struct_lit_formatting<'a>(
|
|||
context: &'a RewriteContext,
|
||||
force_no_trailing_comma: bool,
|
||||
) -> ListFormatting<'a> {
|
||||
let ends_with_newline = context.config.struct_lit_style() != IndentStyle::Visual
|
||||
let ends_with_newline = context.config.struct_lit_indent() != IndentStyle::Visual
|
||||
&& tactic == DefinitiveListTactic::Vertical;
|
||||
ListFormatting {
|
||||
tactic: tactic,
|
||||
|
|
|
@ -12,7 +12,7 @@ where_layout = "Vertical"
|
|||
where_pred_indent = "Visual"
|
||||
generics_indent = "Visual"
|
||||
trailing_comma = "Vertical"
|
||||
struct_lit_style = "Block"
|
||||
struct_lit_indent = "Block"
|
||||
report_todo = "Always"
|
||||
report_fixme = "Never"
|
||||
reorder_imports = false
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-struct_lit_style: Block
|
||||
// rustfmt-struct_lit_indent: Block
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
// Struct literal expressions.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-struct_lit_multiline_style: ForceMulti
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
fn foo() {
|
||||
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-struct_lit_style: Block
|
||||
// rustfmt-struct_lit_indent: Block
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// Struct literal-style
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
// Struct literal expressions.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
// rustfmt-struct_lit_multiline_style: ForceMulti
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// rustfmt-normalize_comments: true
|
||||
// rustfmt-wrap_comments: true
|
||||
// rustfmt-error_on_line_overflow: false
|
||||
// rustfmt-struct_lit_style: Visual
|
||||
// rustfmt-struct_lit_indent: Visual
|
||||
fn foo() {
|
||||
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(f(), b());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue