Skip to content

Commit a066c36

Browse files
davidpdrsndavidbarskyhawkw
committed
attributes: update to syn 2.0 (#2516)
## Motivation syn 2.0 is out! ## Solution Update to syn 2.0 🚀 Co-authored-by: David Barsky <[email protected]> Co-authored-by: Eliza Weisman <[email protected]>
1 parent 27eecd5 commit a066c36

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

tracing-attributes/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,15 @@ async-await = []
4040

4141
[dependencies]
4242
proc-macro2 = "1.0.40"
43-
syn = { version = "1.0.98", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"] }
43+
syn = { version = "2.0", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"] }
4444
quote = "1.0.20"
4545

4646
[dev-dependencies]
4747
tracing = { path = "../tracing", version = "0.1.35" }
4848
tracing-mock = { path = "../tracing-mock", features = ["tokio-test"] }
4949
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3.0", features = ["env-filter"] }
5050
tokio-test = "0.4.2"
51-
tracing-core = { path = "../tracing-core", version = "0.1.28"}
52-
async-trait = "0.1.56"
51+
async-trait = "0.1.67"
5352
trybuild = "1.0.64"
5453
rustversion = "1.0.9"
5554

tracing-attributes/src/attr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl Parse for Skips {
252252
let _ = input.parse::<kw::skip>();
253253
let content;
254254
let _ = syn::parenthesized!(content in input);
255-
let names: Punctuated<Ident, Token![,]> = content.parse_terminated(Ident::parse_any)?;
255+
let names = content.parse_terminated(Ident::parse_any, Token![,])?;
256256
let mut skips = HashSet::new();
257257
for name in names {
258258
if skips.contains(&name) {
@@ -303,7 +303,7 @@ impl Parse for Fields {
303303
let _ = input.parse::<kw::fields>();
304304
let content;
305305
let _ = syn::parenthesized!(content in input);
306-
let fields: Punctuated<_, Token![,]> = content.parse_terminated(Field::parse)?;
306+
let fields = content.parse_terminated(Field::parse, Token![,])?;
307307
Ok(Self(fields))
308308
}
309309
}
@@ -348,7 +348,7 @@ impl ToTokens for Field {
348348
let name = &self.name;
349349
let kind = &self.kind;
350350
tokens.extend(quote! {
351-
#name = #kind#value
351+
#name = #kind #value
352352
})
353353
} else if self.kind == FieldKind::Value {
354354
// 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)