From df30a7a2e49e983a7547f23b15fcd3e6598645fd Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Tue, 19 Dec 2023 22:47:30 +0000 Subject: [PATCH] Give `VariantData::Struct` named fields, to clairfy `recovered`. --- src/items.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/items.rs b/src/items.rs index a4256730f19..6fb69d6b883 100644 --- a/src/items.rs +++ b/src/items.rs @@ -666,7 +666,7 @@ fn format_variant( let span = mk_sp(lo, field.span.lo()); let variant_body = match field.data { - ast::VariantData::Tuple(..) | ast::VariantData::Struct(..) => format_struct( + ast::VariantData::Tuple(..) | ast::VariantData::Struct { .. } => format_struct( &context, &StructParts::from_variant(field, &context), 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 { let span_before_consts = variant.span.until(anon_const.value.span); let hi = match &variant.data { - Struct(..) => context + Struct { .. } => context .snippet_provider .span_after_last(span_before_consts, "}"), Tuple(..) => context @@ -1112,12 +1112,12 @@ fn format_struct( offset: Indent, one_line_width: Option, ) -> Option { - match *struct_parts.def { + match struct_parts.def { 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) } - ast::VariantData::Struct(ref fields, _) => { + ast::VariantData::Struct { fields, .. } => { format_struct_struct(context, struct_parts, fields, offset, one_line_width) } }