Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

attributes: update to syn 2.0 #2516

Merged
merged 6 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tracing-attributes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ proc-macro = true

[dependencies]
proc-macro2 = "1.0.40"
syn = { version = "1.0.98", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"] }
syn = { version = "2.0", default-features = false, features = ["full", "parsing", "printing", "visit-mut", "clone-impls", "extra-traits", "proc-macro"]
hawkw marked this conversation as resolved.
Show resolved Hide resolved
quote = "1.0.20"

[dev-dependencies]
tracing = { path = "../tracing", version = "0.2" }
tracing-mock = { path = "../tracing-mock", features = ["tokio-test"] }
tokio-test = "0.4.2"
tracing-subscriber = { path = "../tracing-subscriber", version = "0.3", features = ["env-filter"] }
async-trait = "0.1.56"
async-trait = "0.1.67"
trybuild = "1.0.64"
rustversion = "1.0.9"

Expand Down
6 changes: 3 additions & 3 deletions tracing-attributes/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl Parse for Skips {
let _ = input.parse::<kw::skip>();
let content;
let _ = syn::parenthesized!(content in input);
let names: Punctuated<Ident, Token![,]> = content.parse_terminated(Ident::parse_any)?;
let names = content.parse_terminated(Ident::parse_any, Token![,])?;
let mut skips = HashSet::new();
for name in names {
if skips.contains(&name) {
Expand Down Expand Up @@ -290,7 +290,7 @@ impl Parse for Fields {
let _ = input.parse::<kw::fields>();
let content;
let _ = syn::parenthesized!(content in input);
let fields: Punctuated<_, Token![,]> = content.parse_terminated(Field::parse)?;
let fields = content.parse_terminated(Field::parse, Token![,])?;
Ok(Self(fields))
}
}
Expand Down Expand Up @@ -335,7 +335,7 @@ impl ToTokens for Field {
let name = &self.name;
let kind = &self.kind;
tokens.extend(quote! {
#name = #kind#value
#name = #kind #value
})
} else if self.kind == FieldKind::Value {
// XXX(eliza): I don't like that fields without values produce
Expand Down
7 changes: 2 additions & 5 deletions tracing-attributes/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,7 @@ fn param_names(pat: Pat, record_type: RecordType) -> Box<dyn Iterator<Item = (Id
.into_iter()
.flat_map(|p| param_names(p, RecordType::Debug)),
),
Pat::TupleStruct(PatTupleStruct {
pat: PatTuple { elems, .. },
..
}) => Box::new(
Pat::TupleStruct(PatTupleStruct { elems, .. }) => Box::new(
elems
.into_iter()
.flat_map(|p| param_names(p, RecordType::Debug)),
Expand Down Expand Up @@ -564,7 +561,7 @@ impl<'block> AsyncInfo<'block> {
// last expression of the block: it determines the return value of the
// block, this is quite likely a `Box::pin` statement or an async block
let (last_expr_stmt, last_expr) = block.stmts.iter().rev().find_map(|stmt| {
if let Stmt::Expr(expr) = stmt {
if let Stmt::Expr(expr, _semi) = stmt {
Some((stmt, expr))
} else {
None
Expand Down