Skip to content

Commit 539ffbe

Browse files
davidpdrsndavidbarskyhawkw
authored
attributes: update to syn 2.0 (#2516)
## Motivation syn 2.0 is out! ## Solution Update to syn 2.0 🚀 Co-authored-by: David Barsky <me@davidbarsky.com> Co-authored-by: Eliza Weisman <eliza@buoyant.io>
1 parent ca26746 commit 539ffbe

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

tracing-attributes/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ proc-macro = true
3535

3636
[dependencies]
3737
proc-macro2 = "1.0.40"
38-
syn = { version = "1.0.98", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"] }
38+
syn = { version = "2.0", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"] }
3939
quote = "1.0.20"
4040

4141
[dev-dependencies]
4242
tracing = { path = "../tracing", version = "0.2" }
4343
tracing-mock = { path = "../tracing-mock", features = ["tokio-test"] }
4444
tokio-test = "0.4.2"
4545
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3", features = ["env-filter"] }
46-
async-trait = "0.1.56"
46+
async-trait = "0.1.67"
4747
trybuild = "1.0.64"
4848
rustversion = "1.0.9"
4949

tracing-attributes/src/attr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl Parse for Skips {
239239
let _ = input.parse::<kw::skip>();
240240
let content;
241241
let _ = syn::parenthesized!(content in input);
242-
let names: Punctuated<Ident, Token![,]> = content.parse_terminated(Ident::parse_any)?;
242+
let names = content.parse_terminated(Ident::parse_any, Token![,])?;
243243
let mut skips = HashSet::new();
244244
for name in names {
245245
if skips.contains(&name) {
@@ -290,7 +290,7 @@ impl Parse for Fields {
290290
let _ = input.parse::<kw::fields>();
291291
let content;
292292
let _ = syn::parenthesized!(content in input);
293-
let fields: Punctuated<_, Token![,]> = content.parse_terminated(Field::parse)?;
293+
let fields = content.parse_terminated(Field::parse, Token![,])?;
294294
Ok(Self(fields))
295295
}
296296
}
@@ -335,7 +335,7 @@ impl ToTokens for Field {
335335
let name = &self.name;
336336
let kind = &self.kind;
337337
tokens.extend(quote! {
338-
#name = #kind#value
338+
#name = #kind #value
339339
})
340340
} else if self.kind == FieldKind::Value {
341341
// XXX(eliza): I don't like that fields without values produce

tracing-attributes/src/expand.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,7 @@ fn param_names(pat: Pat, record_type: RecordType) -> Box<dyn Iterator<Item = (Id
477477
.into_iter()
478478
.flat_map(|p| param_names(p, RecordType::Debug)),
479479
),
480-
Pat::TupleStruct(PatTupleStruct {
481-
pat: PatTuple { elems, .. },
482-
..
483-
}) => Box::new(
480+
Pat::TupleStruct(PatTupleStruct { elems, .. }) => Box::new(
484481
elems
485482
.into_iter()
486483
.flat_map(|p| param_names(p, RecordType::Debug)),
@@ -564,7 +561,7 @@ impl<'block> AsyncInfo<'block> {
564561
// last expression of the block: it determines the return value of the
565562
// block, this is quite likely a `Box::pin` statement or an async block
566563
let (last_expr_stmt, last_expr) = block.stmts.iter().rev().find_map(|stmt| {
567-
if let Stmt::Expr(expr) = stmt {
564+
if let Stmt::Expr(expr, _semi) = stmt {
568565
Some((stmt, expr))
569566
} else {
570567
None

0 commit comments

Comments
 (0)