events-macros: Get rid of duplicate helper functions
This commit is contained in:
parent
d77f58dc46
commit
2536fdbe54
@ -407,7 +407,7 @@ fn expand_from_into(
|
|||||||
let fields: Vec<_> = fields.iter().flat_map(|f| &f.ident).collect();
|
let fields: Vec<_> = fields.iter().flat_map(|f| &f.ident).collect();
|
||||||
|
|
||||||
if let EventKindVariation::Sync | EventKindVariation::RedactedSync = var {
|
if let EventKindVariation::Sync | EventKindVariation::RedactedSync = var {
|
||||||
let full_struct = kind.to_event_ident(&var.to_full_variation());
|
let full_struct = kind.to_event_ident(&var.to_full().unwrap());
|
||||||
Some(quote! {
|
Some(quote! {
|
||||||
#[automatically_derived]
|
#[automatically_derived]
|
||||||
impl #impl_generics ::std::convert::From<#full_struct #ty_gen>
|
impl #impl_generics ::std::convert::From<#full_struct #ty_gen>
|
||||||
|
@ -60,18 +60,6 @@ impl EventKindVariation {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_full_variation(self) -> Self {
|
|
||||||
match self {
|
|
||||||
EventKindVariation::Redacted | EventKindVariation::RedactedSync => {
|
|
||||||
EventKindVariation::Redacted
|
|
||||||
}
|
|
||||||
EventKindVariation::Full
|
|
||||||
| EventKindVariation::Sync
|
|
||||||
| EventKindVariation::Stripped
|
|
||||||
| EventKindVariation::Initial => EventKindVariation::Full,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the variants of this enum change `to_event_path` needs to be updated as well.
|
// If the variants of this enum change `to_event_path` needs to be updated as well.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user