Skip to content

Commit b286c65

Browse files
authored
Use Span::mixed_site directly from proc-macro2 (#254)
Since 1.0.19, `proc-macro2` now provides `Span::mixed_site` directly.
1 parent 37e11fc commit b286c65

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
[#238](https://github.com/lambda-fairy/maud/pull/238)
77
- [Changed] Generalize `impl Into<String> for PreEscaped<T>` to `impl From<PreEscaped<T>> for String`.
88
[#248](https://github.com/lambda-fairy/maud/pull/248)
9+
- [Fixed] Use `Span::mixed_site` directly from proc-macro2
10+
[#254](https://github.com/lambda-fairy/maud/pull/254)
911

1012
## [0.22.1] - 2020-11-02
1113

maud_macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edition = "2018"
1414
syn = "1.0.8"
1515
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
1616
quote = "1.0.7"
17-
proc-macro2 = "1.0.18"
17+
proc-macro2 = "1.0.19"
1818
proc-macro-error = "1.0.0"
1919

2020
[lib]

maud_macros/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod ast;
99
mod generate;
1010
mod parse;
1111

12-
use proc_macro2::{Ident, TokenStream, TokenTree};
12+
use proc_macro2::{Ident, Span, TokenStream, TokenTree};
1313
use proc_macro_error::proc_macro_error;
1414
use quote::quote;
1515

@@ -28,11 +28,7 @@ pub fn html_debug(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
2828
}
2929

3030
fn expand(input: TokenStream) -> TokenStream {
31-
// TODO: call `proc_macro2::Span::mixed_site()` directly when Rust 1.45 is stable
32-
let output_ident = TokenTree::Ident(Ident::new(
33-
"__maud_output",
34-
proc_macro::Span::mixed_site().into(),
35-
));
31+
let output_ident = TokenTree::Ident(Ident::new("__maud_output", Span::mixed_site()));
3632
// Heuristic: the size of the resulting markup tends to correlate with the
3733
// code size of the template itself
3834
let size_hint = input.to_string().len();

0 commit comments

Comments
 (0)