Give VariantData::Struct
named fields, to clairfy recovered
.
This commit is contained in:
parent
ca2472edd7
commit
df30a7a2e4
10
src/items.rs
10
src/items.rs
@ -666,7 +666,7 @@ fn format_variant(
|
|||||||
let span = mk_sp(lo, field.span.lo());
|
let span = mk_sp(lo, field.span.lo());
|
||||||
|
|
||||||
let variant_body = match field.data {
|
let variant_body = match field.data {
|
||||||
ast::VariantData::Tuple(..) | ast::VariantData::Struct(..) => format_struct(
|
ast::VariantData::Tuple(..) | ast::VariantData::Struct { .. } => format_struct(
|
||||||
&context,
|
&context,
|
||||||
&StructParts::from_variant(field, &context),
|
&StructParts::from_variant(field, &context),
|
||||||
self.block_indent,
|
self.block_indent,
|
||||||
@ -1092,7 +1092,7 @@ fn enum_variant_span(variant: &ast::Variant, context: &RewriteContext<'_>) -> Sp
|
|||||||
if let Some(ref anon_const) = variant.disr_expr {
|
if let Some(ref anon_const) = variant.disr_expr {
|
||||||
let span_before_consts = variant.span.until(anon_const.value.span);
|
let span_before_consts = variant.span.until(anon_const.value.span);
|
||||||
let hi = match &variant.data {
|
let hi = match &variant.data {
|
||||||
Struct(..) => context
|
Struct { .. } => context
|
||||||
.snippet_provider
|
.snippet_provider
|
||||||
.span_after_last(span_before_consts, "}"),
|
.span_after_last(span_before_consts, "}"),
|
||||||
Tuple(..) => context
|
Tuple(..) => context
|
||||||
@ -1112,12 +1112,12 @@ fn format_struct(
|
|||||||
offset: Indent,
|
offset: Indent,
|
||||||
one_line_width: Option<usize>,
|
one_line_width: Option<usize>,
|
||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
match *struct_parts.def {
|
match struct_parts.def {
|
||||||
ast::VariantData::Unit(..) => format_unit_struct(context, struct_parts, offset),
|
ast::VariantData::Unit(..) => format_unit_struct(context, struct_parts, offset),
|
||||||
ast::VariantData::Tuple(ref fields, _) => {
|
ast::VariantData::Tuple(fields, _) => {
|
||||||
format_tuple_struct(context, struct_parts, fields, offset)
|
format_tuple_struct(context, struct_parts, fields, offset)
|
||||||
}
|
}
|
||||||
ast::VariantData::Struct(ref fields, _) => {
|
ast::VariantData::Struct { fields, .. } => {
|
||||||
format_struct_struct(context, struct_parts, fields, offset, one_line_width)
|
format_struct_struct(context, struct_parts, fields, offset, one_line_width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user