From 496b55c25e194ecc29dce2fc93f95b0ea353ab5b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 24 Jul 2021 12:15:38 +0100 Subject: [PATCH] config, wip macro Signed-off-by: Ian Jackson --- macros/macros.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/macros.rs b/macros/macros.rs index 13c727c..142a0f7 100644 --- a/macros/macros.rs +++ b/macros/macros.rs @@ -7,7 +7,7 @@ #![allow(unused_mut)] // xxx use syn::{parse_macro_input, parse_quote, Data, DataStruct, DeriveInput, Meta, NestedMeta, Path}; -use quote::{quote, quote_spanned}; +use quote::{quote, quote_spanned, ToTokens}; use proc_macro2::{Literal, TokenStream}; use itertools::Itertools; @@ -41,7 +41,7 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream { for attr in &field.attrs { if attr.tokens.is_empty() { let atspan = attr.path.segments.last().unwrap().ident.span(); - method = quote!{ #attr.path }; + method = attr.path.to_token_stream(); if &attr.path == &parse_quote!{ limited } { skl = quote_spanned!{atspan=> SKL::Limited }; } @@ -53,7 +53,7 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let (tmethod, tskl) = meta.nested.iter().collect_tuple().unwrap(); fn get_path(meta: &NestedMeta) -> TokenStream { match meta { - NestedMeta::Meta(Meta::Path(ref path)) => quote!{ #path }, + NestedMeta::Meta(Meta::Path(ref path)) => path.to_token_stream(), _ => panic!(), } } -- 2.30.2