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