Skip to content

Commit

Permalink
Inline visitor_expr of unit struct deserialize impl
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 10, 2023
1 parent 662fc38 commit f75426f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,6 @@ fn deserialize_unit_struct(params: &Parameters, cattrs: &attr::Container) -> Fra
let expecting = format!("unit struct {}", params.type_name());
let expecting = cattrs.expecting().unwrap_or(&expecting);

let visitor_expr = quote! {
__Visitor {
marker: _serde::__private::PhantomData::<#this_type #ty_generics>,
lifetime: _serde::__private::PhantomData,
}
};

quote_block! {
#[doc(hidden)]
struct __Visitor #de_impl_generics #where_clause {
Expand All @@ -447,7 +440,14 @@ fn deserialize_unit_struct(params: &Parameters, cattrs: &attr::Container) -> Fra
}
}

_serde::Deserializer::deserialize_unit_struct(__deserializer, #type_name, #visitor_expr)
_serde::Deserializer::deserialize_unit_struct(
__deserializer,
#type_name,
__Visitor {
marker: _serde::__private::PhantomData::<#this_type #ty_generics>,
lifetime: _serde::__private::PhantomData,
},
)
}
}

Expand Down

0 comments on commit f75426f

Please sign in to comment.