parent
2bf67b6e5c
commit
950b288d6f
32
src/items.rs
32
src/items.rs
@ -557,24 +557,20 @@ impl<'a> FmtVisitor<'a> {
|
||||
self.block_indent,
|
||||
Some(one_line_width),
|
||||
)?,
|
||||
ast::VariantData::Unit(..) => {
|
||||
if let Some(ref expr) = field.node.disr_expr {
|
||||
let lhs = format!(
|
||||
"{:1$} =",
|
||||
rewrite_ident(&context, field.node.ident),
|
||||
pad_discrim_ident_to
|
||||
);
|
||||
rewrite_assign_rhs_with(
|
||||
&context,
|
||||
lhs,
|
||||
&*expr.value,
|
||||
shape,
|
||||
RhsTactics::AllowOverflow,
|
||||
)?
|
||||
} else {
|
||||
rewrite_ident(&context, field.node.ident).to_owned()
|
||||
}
|
||||
}
|
||||
ast::VariantData::Unit(..) => rewrite_ident(&context, field.node.ident).to_owned(),
|
||||
};
|
||||
|
||||
let variant_body = if let Some(ref expr) = field.node.disr_expr {
|
||||
let lhs = format!("{:1$} =", variant_body, pad_discrim_ident_to);
|
||||
rewrite_assign_rhs_with(
|
||||
&context,
|
||||
lhs,
|
||||
&*expr.value,
|
||||
shape,
|
||||
RhsTactics::AllowOverflow,
|
||||
)?
|
||||
} else {
|
||||
variant_body
|
||||
};
|
||||
|
||||
combine_strs_with_missing_comments(&context, &attrs_str, &variant_body, span, shape, false)
|
||||
|
@ -202,3 +202,11 @@ enum PublishedFileVisibility {
|
||||
FriendsOnly = sys::ERemoteStoragePublishedFileVisibility_k_ERemoteStoragePublishedFileVisibilityFriendsOnly,
|
||||
Private = sys::ERemoteStoragePublishedFileVisibility_k_ERemoteStoragePublishedFileVisibilityPrivate,
|
||||
}
|
||||
|
||||
// #3771
|
||||
//#![feature(arbitrary_enum_discriminant)]
|
||||
#[repr(u32)]
|
||||
pub enum E {
|
||||
A { a: u32 } = 0x100,
|
||||
B { field1: u32, field2: u8, field3: m::M } = 0x300 // comment
|
||||
}
|
||||
|
@ -273,3 +273,17 @@ enum PublishedFileVisibility {
|
||||
Private =
|
||||
sys::ERemoteStoragePublishedFileVisibility_k_ERemoteStoragePublishedFileVisibilityPrivate,
|
||||
}
|
||||
|
||||
// #3771
|
||||
//#![feature(arbitrary_enum_discriminant)]
|
||||
#[repr(u32)]
|
||||
pub enum E {
|
||||
A {
|
||||
a: u32,
|
||||
} = 0x100,
|
||||
B {
|
||||
field1: u32,
|
||||
field2: u8,
|
||||
field3: m::M,
|
||||
} = 0x300, // comment
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user