mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-17 03:21:02 +00:00
Use iter::repeat to build phantom exprs
This commit is contained in:
@@ -5,6 +5,8 @@ use bound;
|
|||||||
use internals::ast::{Body, Field, Item, Style, Variant};
|
use internals::ast::{Body, Field, Item, Style, Variant};
|
||||||
use internals::{self, attr};
|
use internals::{self, attr};
|
||||||
|
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
pub fn expand_derive_deserialize(item: &syn::MacroInput) -> Result<Tokens, String> {
|
pub fn expand_derive_deserialize(item: &syn::MacroInput) -> Result<Tokens, String> {
|
||||||
let item = {
|
let item = {
|
||||||
let ctxt = internals::Ctxt::new();
|
let ctxt = internals::Ctxt::new();
|
||||||
@@ -186,7 +188,7 @@ fn deserialize_visitor(generics: &syn::Generics) -> (Tokens, Tokens, Tokens) {
|
|||||||
Some(quote!(::<#(ty_param_idents),*>))
|
Some(quote!(::<#(ty_param_idents),*>))
|
||||||
};
|
};
|
||||||
|
|
||||||
let phantom_exprs = (0 .. num_phantoms).map(|_| quote!(::std::marker::PhantomData));
|
let phantom_exprs = iter::repeat(quote!(::std::marker::PhantomData)).take(num_phantoms);
|
||||||
|
|
||||||
(
|
(
|
||||||
quote! {
|
quote! {
|
||||||
|
|||||||
Reference in New Issue
Block a user