From dfdf354b0d0700dd18f110365b1b0420cc356216 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 8 Aug 2019 11:09:58 +0200 Subject: [PATCH] macro: more quote -> quote_spanned changes Signed-off-by: Wolfgang Bumiller --- proxmox-api-macro/src/api_def.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/proxmox-api-macro/src/api_def.rs b/proxmox-api-macro/src/api_def.rs index e21fc191..93545e6f 100644 --- a/proxmox-api-macro/src/api_def.rs +++ b/proxmox-api-macro/src/api_def.rs @@ -4,7 +4,7 @@ use proc_macro2::{Ident, TokenStream}; use derive_builder::Builder; use failure::{bail, Error}; -use quote::{quote, ToTokens}; +use quote::quote_spanned; use super::parsing::{Expression, Object}; @@ -44,14 +44,14 @@ impl TryFrom for CliMode { impl CliMode { pub fn quote(&self, name: &proc_macro2::Ident) -> TokenStream { match self { - CliMode::Disabled => quote! { None }, - CliMode::ParseCli => { - quote! { Some(<#name as ::proxmox::api::cli::ParseCli>::parse_cli) } - } - CliMode::FromStr => quote! { + CliMode::Disabled => quote_spanned! { name.span() => None }, + CliMode::ParseCli => quote_spanned! { name.span() => + Some(<#name as ::proxmox::api::cli::ParseCli>::parse_cli) + }, + CliMode::FromStr => quote_spanned! { name.span() => Some(<#name as ::proxmox::api::cli::ParseCliFromStr>::parse_cli) }, - CliMode::Function(func) => quote! { Some(#func) }, + CliMode::Function(func) => quote_spanned! { name.span() => Some(#func) }, } } }