Skip to content

Commit 34f571b

Browse files
authored
Merge pull request #146 from Hosshii/absolute_path
Use absolute path for Result in macro-generated code
2 parents 05adaa1 + a0527af commit 34f571b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

nutype_macros/src/common/gen/traits.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub fn gen_impl_trait_try_from(
169169
type Error = #error_type_name;
170170

171171
#[inline]
172-
fn try_from(raw_value: #inner_type) -> Result<#type_name #generics, Self::Error> {
172+
fn try_from(raw_value: #inner_type) -> ::core::result::Result<#type_name #generics, Self::Error> {
173173
Self::new(raw_value)
174174
}
175175
}
@@ -183,7 +183,7 @@ pub fn gen_impl_trait_try_from(
183183
type Error = ::core::convert::Infallible;
184184

185185
#[inline]
186-
fn try_from(raw_value: #inner_type) -> Result<#type_name #generics, Self::Error> {
186+
fn try_from(raw_value: #inner_type) -> ::core::result::Result<#type_name #generics, Self::Error> {
187187
Ok(Self::new(raw_value))
188188
}
189189
}
@@ -286,7 +286,7 @@ pub fn gen_impl_trait_serde_deserialize(
286286

287287
quote! {
288288
impl #all_generics ::serde::Deserialize<'de> for #type_name #type_generics {
289-
fn deserialize<D: ::serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
289+
fn deserialize<D: ::serde::Deserializer<'de>>(deserializer: D) -> ::core::result::Result<Self, D::Error> {
290290
struct __Visitor #all_generics {
291291
marker: ::std::marker::PhantomData<#type_name #type_generics>,
292292
lifetime: ::std::marker::PhantomData<&'de ()>,
@@ -299,7 +299,7 @@ pub fn gen_impl_trait_serde_deserialize(
299299
write!(formatter, #expecting_str)
300300
}
301301

302-
fn visit_newtype_struct<DE>(self, deserializer: DE) -> Result<Self::Value, DE::Error>
302+
fn visit_newtype_struct<DE>(self, deserializer: DE) -> ::core::result::Result<Self::Value, DE::Error>
303303
where
304304
DE: ::serde::Deserializer<'de>
305305
{

nutype_macros/src/float/models.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ macro_rules! define_float_inner_type {
101101
}
102102

103103
impl ::core::fmt::Display for FloatInnerType {
104-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> {
104+
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
105105
match self {
106106
$(
107107
Self::$variant => stringify!($tp).fmt(f),

nutype_macros/src/integer/models.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ macro_rules! define_integer_inner_type {
101101
}
102102

103103
impl ::core::fmt::Display for IntegerInnerType {
104-
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> Result<(), ::core::fmt::Error> {
104+
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
105105
match self {
106106
$(
107107
Self::$variant => stringify!($tp).fmt(f),

0 commit comments

Comments
 (0)