diff --git a/derive/src/from_row/structs/mod.rs b/derive/src/from_row/structs/mod.rs index d30ff8e..e80fdab 100644 --- a/derive/src/from_row/structs/mod.rs +++ b/derive/src/from_row/structs/mod.rs @@ -216,12 +216,10 @@ impl ToTokens for GenericStruct<'_> { let ty = &f.ty; if attrs.json { quote::quote!(#ident: #ident.commit().0) + } else if attrs.with.is_some() { + quote::quote!( #ident ) } else { - if attrs.with.is_some() { - quote::quote!( #ident ) - } else { - quote::quote!(#ident: <<#ty as FromValue>::Intermediate as std::convert::Into<#ty>>::into(#ident)) - } + quote::quote!(#ident: <<#ty as FromValue>::Intermediate as std::convert::Into<#ty>>::into(#ident)) } }) .collect::>(); diff --git a/derive/src/from_value/enums/mod.rs b/derive/src/from_value/enums/mod.rs index 9b297ff..227b847 100644 --- a/derive/src/from_value/enums/mod.rs +++ b/derive/src/from_value/enums/mod.rs @@ -333,7 +333,7 @@ impl ToTokens for Enum { impl std::convert::TryFrom<#crat::Value> for #ir_name { type Error = #crat::FromValueError; - fn try_from(v: #crat::Value) -> Result { + fn try_from(v: #crat::Value) -> std::result::Result { match v { #( #branches )* v => Err(#crat::FromValueError(v)), diff --git a/derive/src/from_value/structs/mod.rs b/derive/src/from_value/structs/mod.rs index 158485d..9b9d096 100644 --- a/derive/src/from_value/structs/mod.rs +++ b/derive/src/from_value/structs/mod.rs @@ -128,7 +128,7 @@ impl ToTokens for NewTypeNoGenerics<'_> { impl std::convert::TryFrom<#crat::Value> for #ir_name { type Error = #crat::FromValueError; - fn try_from(v: #crat::Value) -> Result { + fn try_from(v: #crat::Value) -> std::result::Result { #path(v).map(Self) } } @@ -162,7 +162,7 @@ impl ToTokens for NewTypeNoGenerics<'_> { impl TryFrom for #ir_name<#field_type> { type Error = <<#field_type as FromValue>::Intermediate as TryFrom>::Error; - fn try_from(value: Value) -> Result { + fn try_from(value: Value) -> std::result::Result { <#field_type as FromValue>::Intermediate::try_from(value).map(Self) } } @@ -279,7 +279,7 @@ impl ToTokens for NewType<'_> { where #additional_bounds { type Error = #crat::FromValueError; - fn try_from(v: #crat::Value) -> Result { + fn try_from(v: #crat::Value) -> std::result::Result { #path(v) } } @@ -305,7 +305,7 @@ impl ToTokens for NewType<'_> { { type Error = <<#field_type as #crat::prelude::FromValue>::Intermediate as std::convert::TryFrom<#crat::Value>>::Error; - fn try_from(value: #crat::Value) -> Result { + fn try_from(value: #crat::Value) -> std::result::Result { <#field_type as #crat::prelude::FromValue>::Intermediate::try_from(value).map(Self) } }