From f75426f47e788e92cc58d94bb76074314810b590 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 9 Jul 2023 18:03:58 -0700 Subject: [PATCH] Inline visitor_expr of unit struct deserialize impl --- serde_derive/src/de.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index 67193b3e..cb98b8ea 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -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 { @@ -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, + }, + ) } }