events-macros: Fix unqualified usage of From

This commit is contained in:
Jonas Platte 2021-10-01 20:11:34 +02:00
parent 8df746d442
commit 651741f482
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
2 changed files with 6 additions and 4 deletions

View File

@ -410,7 +410,9 @@ fn expand_from_into(
let full_struct = kind.to_event_ident(&var.to_full_variation());
Some(quote! {
#[automatically_derived]
impl #impl_generics From<#full_struct #ty_gen> for #ident #ty_gen #where_clause {
impl #impl_generics ::std::convert::From<#full_struct #ty_gen>
for #ident #ty_gen #where_clause
{
fn from(event: #full_struct #ty_gen) -> Self {
let #full_struct { #( #fields, )* .. } = event;
Self { #( #fields, )* }

View File

@ -201,7 +201,7 @@ fn expand_from_impl(
quote! {
#[automatically_derived]
#(#attrs)*
impl From<#content> for #ty {
impl ::std::convert::From<#content> for #ty {
fn from(c: #content) -> Self {
Self::#ident(c)
}
@ -228,7 +228,7 @@ fn expand_conversion_impl(
let self_variants = variants.iter().map(|v| v.ctor(quote! { Self }));
Some(quote! {
impl From<#ident> for #sync {
impl ::std::convert::From<#ident> for #sync {
fn from(event: #ident) -> Self {
match event {
#(
@ -996,7 +996,7 @@ pub(crate) fn expand_from_impls_derived(input: DeriveInput) -> TokenStream {
let var_ident = &variant.ident;
let id = &input.ident;
quote! {
impl From<#inner_struct> for #id {
impl ::std::convert::From<#inner_struct> for #id {
fn from(c: #inner_struct) -> Self {
Self::#var_ident(c)
}