From a0527af225a9f7b2fd03f90f0cab8327d2422401 Mon Sep 17 00:00:00 2001 From: Hosshii Date: Sat, 15 Jun 2024 02:08:40 +0900 Subject: [PATCH] Use absolute path for Result in macro-generated code --- nutype_macros/src/common/gen/traits.rs | 8 ++++---- nutype_macros/src/float/models.rs | 2 +- nutype_macros/src/integer/models.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nutype_macros/src/common/gen/traits.rs b/nutype_macros/src/common/gen/traits.rs index 3756cc77..20b25d8e 100644 --- a/nutype_macros/src/common/gen/traits.rs +++ b/nutype_macros/src/common/gen/traits.rs @@ -169,7 +169,7 @@ pub fn gen_impl_trait_try_from( type Error = #error_type_name; #[inline] - fn try_from(raw_value: #inner_type) -> Result<#type_name #generics, Self::Error> { + fn try_from(raw_value: #inner_type) -> ::core::result::Result<#type_name #generics, Self::Error> { Self::new(raw_value) } } @@ -183,7 +183,7 @@ pub fn gen_impl_trait_try_from( type Error = ::core::convert::Infallible; #[inline] - fn try_from(raw_value: #inner_type) -> Result<#type_name #generics, Self::Error> { + fn try_from(raw_value: #inner_type) -> ::core::result::Result<#type_name #generics, Self::Error> { Ok(Self::new(raw_value)) } } @@ -286,7 +286,7 @@ pub fn gen_impl_trait_serde_deserialize( quote! { impl #all_generics ::serde::Deserialize<'de> for #type_name #type_generics { - fn deserialize>(deserializer: D) -> Result { + fn deserialize>(deserializer: D) -> ::core::result::Result { struct __Visitor #all_generics { marker: ::std::marker::PhantomData<#type_name #type_generics>, lifetime: ::std::marker::PhantomData<&'de ()>, @@ -299,7 +299,7 @@ pub fn gen_impl_trait_serde_deserialize( write!(formatter, #expecting_str) } - fn visit_newtype_struct(self, deserializer: DE) -> Result + fn visit_newtype_struct(self, deserializer: DE) -> ::core::result::Result where DE: ::serde::Deserializer<'de> { diff --git a/nutype_macros/src/float/models.rs b/nutype_macros/src/float/models.rs index bdc4fac7..6fe89ae1 100644 --- a/nutype_macros/src/float/models.rs +++ b/nutype_macros/src/float/models.rs @@ -101,7 +101,7 @@ macro_rules! define_float_inner_type { } impl ::core::fmt::Display for FloatInnerType { - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { $( Self::$variant => stringify!($tp).fmt(f), diff --git a/nutype_macros/src/integer/models.rs b/nutype_macros/src/integer/models.rs index 9fb3cd35..039b3449 100644 --- a/nutype_macros/src/integer/models.rs +++ b/nutype_macros/src/integer/models.rs @@ -101,7 +101,7 @@ macro_rules! define_integer_inner_type { } impl ::core::fmt::Display for IntegerInnerType { - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> { + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { $( Self::$variant => stringify!($tp).fmt(f),