From 7cfed02f8a4d75320db87334f2d49df3041ee65f Mon Sep 17 00:00:00 2001 From: Chris Wong Date: Sat, 9 Jan 2021 17:05:50 +1300 Subject: [PATCH] Use `Span::mixed_site` directly from proc-macro2 Since 1.0.19, `proc-macro2` now provides `Span::mixed_site` directly. --- maud_macros/Cargo.toml | 2 +- maud_macros/src/lib.rs | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/maud_macros/Cargo.toml b/maud_macros/Cargo.toml index 4a3ce8e4..0117e227 100644 --- a/maud_macros/Cargo.toml +++ b/maud_macros/Cargo.toml @@ -14,7 +14,7 @@ edition = "2018" syn = "1.0.8" maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" } quote = "1.0.7" -proc-macro2 = "1.0.18" +proc-macro2 = "1.0.19" proc-macro-error = "1.0.0" [lib] diff --git a/maud_macros/src/lib.rs b/maud_macros/src/lib.rs index c5565b2e..2493d704 100644 --- a/maud_macros/src/lib.rs +++ b/maud_macros/src/lib.rs @@ -9,7 +9,7 @@ mod ast; mod generate; mod parse; -use proc_macro2::{Ident, TokenStream, TokenTree}; +use proc_macro2::{Ident, Span, TokenStream, TokenTree}; use proc_macro_error::proc_macro_error; use quote::quote; @@ -28,11 +28,7 @@ pub fn html_debug(input: proc_macro::TokenStream) -> proc_macro::TokenStream { } fn expand(input: TokenStream) -> TokenStream { - // TODO: call `proc_macro2::Span::mixed_site()` directly when Rust 1.45 is stable - let output_ident = TokenTree::Ident(Ident::new( - "__maud_output", - proc_macro::Span::mixed_site().into(), - )); + let output_ident = TokenTree::Ident(Ident::new("__maud_output", Span::mixed_site())); // Heuristic: the size of the resulting markup tends to correlate with the // code size of the template itself let size_hint = input.to_string().len();