Skip to content

Commit 0a2489c

Browse files
authored
Bump syn to v2.0.38 (#46)
1 parent acfe95c commit 0a2489c

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

spdlog-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ proc-macro = true
1717
nom = "7.1.1"
1818
proc-macro2 = "1.0.47"
1919
quote = "1.0.21"
20-
syn = { version = "1.0.103", features = ["full"] }
20+
syn = { version = "2.0.38", features = ["full"] }

spdlog-macros/src/parse.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ pub(crate) struct CustomPatternMapping {
194194

195195
impl Parse for CustomPatternMapping {
196196
fn parse(input: ParseStream) -> syn::Result<Self> {
197-
let items: Punctuated<_, Token![,]> =
198-
input.parse_terminated(CustomPatternMappingItem::parse)?;
197+
let items = Punctuated::<CustomPatternMappingItem, Token![,]>::parse_terminated(input)?;
199198

200199
let mapping_pairs = items.into_iter().fold(vec![], |mut prev, item| {
201200
prev.push((item.name, item.factory));

spdlog-macros/src/synthesis.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66

77
use proc_macro2::{Span, TokenStream};
88
use quote::ToTokens;
9-
use syn::{punctuated::Punctuated, token::Paren, Expr, ExprLit, ExprTuple, Lit, LitStr, Path};
9+
use syn::{Expr, ExprLit, Lit, LitStr, Path};
1010

1111
use crate::parse::{
1212
PatternTemplate, PatternTemplateFormatter, PatternTemplateLiteral, PatternTemplateStyleRange,
@@ -126,14 +126,7 @@ impl Synthesiser {
126126
template: &PatternTemplate,
127127
mut style_range_seen: bool,
128128
) -> Result<Expr, SynthesisError> {
129-
let mut template_expr = ExprTuple {
130-
attrs: Vec::new(),
131-
paren_token: Paren {
132-
span: Span::mixed_site(),
133-
},
134-
elems: Punctuated::new(),
135-
};
136-
129+
let mut tuple_elems = Vec::with_capacity(template.tokens.len());
137130
for token in &template.tokens {
138131
let token_template_expr = match token {
139132
PatternTemplateToken::Literal(literal_token) => {
@@ -150,10 +143,12 @@ impl Synthesiser {
150143
self.build_style_range_template_pattern_expr(style_range_token)?
151144
}
152145
};
153-
template_expr.elems.push(token_template_expr);
146+
tuple_elems.push(token_template_expr);
154147
}
155148

156-
Ok(Expr::Tuple(template_expr))
149+
let stream = quote::quote! { ( #(#tuple_elems ,)* ) };
150+
let expr = syn::parse2(stream).unwrap();
151+
Ok(Expr::Tuple(expr))
157152
}
158153

159154
fn build_literal_template_pattern_expr(

0 commit comments

Comments
 (0)