Format with rustfmt 0.6.1
This commit is contained in:
parent
8c3b52e308
commit
0e1d065402
@ -54,8 +54,8 @@ fn pretend_fields_used(cont: &Container) -> Tokens {
|
||||
let (_, ty_generics, _) = cont.generics.split_for_impl();
|
||||
|
||||
let patterns = match cont.data {
|
||||
Data::Enum(ref variants) => {
|
||||
variants.iter()
|
||||
Data::Enum(ref variants) => variants
|
||||
.iter()
|
||||
.filter_map(|variant| match variant.style {
|
||||
Style::Struct => {
|
||||
let variant_ident = variant.ident;
|
||||
@ -64,8 +64,7 @@ fn pretend_fields_used(cont: &Container) -> Tokens {
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
.collect::<Vec<_>>(),
|
||||
Data::Struct(Style::Struct, ref fields) => {
|
||||
let pat = struct_pattern(fields);
|
||||
vec![quote!(#type_ident #pat)]
|
||||
@ -106,8 +105,7 @@ fn pretend_variants_used(cont: &Container) -> Tokens {
|
||||
let (_, ty_generics, _) = cont.generics.split_for_impl();
|
||||
let turbofish = ty_generics.as_turbofish();
|
||||
|
||||
let cases = variants.iter()
|
||||
.map(|variant| {
|
||||
let cases = variants.iter().map(|variant| {
|
||||
let variant_ident = variant.ident;
|
||||
let ref placeholders = (0..variant.fields.len())
|
||||
.map(|i| Ident::new(&format!("__v{}", i), Span::call_site()))
|
||||
@ -118,9 +116,7 @@ fn pretend_variants_used(cont: &Container) -> Tokens {
|
||||
let names = variant.fields.iter().map(|field| field.ident);
|
||||
quote!({ #(#names: #placeholders),* })
|
||||
}
|
||||
Style::Tuple | Style::Newtype => {
|
||||
quote!(( #(#placeholders),* ))
|
||||
}
|
||||
Style::Tuple | Style::Newtype => quote!(( #(#placeholders),* )),
|
||||
Style::Unit => quote!(),
|
||||
};
|
||||
|
||||
@ -139,7 +135,7 @@ fn pretend_variants_used(cont: &Container) -> Tokens {
|
||||
|
||||
fn struct_pattern(fields: &[Field]) -> Tokens {
|
||||
let names = fields.iter().map(|field| field.ident);
|
||||
let placeholders = (0..fields.len())
|
||||
.map(|i| Ident::new(&format!("__v{}", i), Span::call_site()));
|
||||
let placeholders =
|
||||
(0..fields.len()).map(|i| Ident::new(&format!("__v{}", i), Span::call_site()));
|
||||
quote!({ #(#names: ref #placeholders),* })
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user