Skip to content

Commit

Permalink
Use absolute path for Result in macro-generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosshii committed Jun 14, 2024
1 parent 05adaa1 commit a0527af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions nutype_macros/src/common/gen/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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))
}
}
Expand Down Expand Up @@ -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<D: ::serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
fn deserialize<D: ::serde::Deserializer<'de>>(deserializer: D) -> ::core::result::Result<Self, D::Error> {
struct __Visitor #all_generics {
marker: ::std::marker::PhantomData<#type_name #type_generics>,
lifetime: ::std::marker::PhantomData<&'de ()>,
Expand All @@ -299,7 +299,7 @@ pub fn gen_impl_trait_serde_deserialize(
write!(formatter, #expecting_str)
}

fn visit_newtype_struct<DE>(self, deserializer: DE) -> Result<Self::Value, DE::Error>
fn visit_newtype_struct<DE>(self, deserializer: DE) -> ::core::result::Result<Self::Value, DE::Error>
where
DE: ::serde::Deserializer<'de>
{
Expand Down
2 changes: 1 addition & 1 deletion nutype_macros/src/float/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion nutype_macros/src/integer/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit a0527af

Please sign in to comment.