Skip to content

Commit 9badeba

Browse files
committed
update config_proc_macro to use syn 2.0
1 parent a3b2bfc commit 9badeba

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

config_proc_macro/Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config_proc_macro/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ proc-macro = true
1313
[dependencies]
1414
proc-macro2 = "1.0"
1515
quote = "1.0"
16-
syn = { version = "1.0", features = ["full", "visit"] }
16+
syn = { version = "2.0", features = ["full", "visit"] }
1717

1818
[dev-dependencies]
19-
serde = { version = "1.0", features = ["derive"] }
19+
serde = { version = "1.0.160", features = ["derive"] }
2020

2121
[features]
2222
default = []

config_proc_macro/src/attrs.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,26 @@ pub fn is_unstable_variant(attr: &syn::Attribute) -> bool {
5151
}
5252

5353
fn is_attr_name_value(attr: &syn::Attribute, name: &str) -> bool {
54-
attr.parse_meta().ok().map_or(false, |meta| match meta {
55-
syn::Meta::NameValue(syn::MetaNameValue { ref path, .. }) if path.is_ident(name) => true,
54+
match &attr.meta {
55+
syn::Meta::NameValue(syn::MetaNameValue { path, .. }) if path.is_ident(name) => true,
5656
_ => false,
57-
})
57+
}
5858
}
5959

6060
fn is_attr_path(attr: &syn::Attribute, name: &str) -> bool {
61-
attr.parse_meta().ok().map_or(false, |meta| match meta {
61+
match &attr.meta {
6262
syn::Meta::Path(path) if path.is_ident(name) => true,
6363
_ => false,
64-
})
64+
}
6565
}
6666

6767
fn get_name_value_str_lit(attr: &syn::Attribute, name: &str) -> Option<String> {
68-
attr.parse_meta().ok().and_then(|meta| match meta {
68+
match &attr.meta {
6969
syn::Meta::NameValue(syn::MetaNameValue {
70-
ref path,
71-
lit: syn::Lit::Str(ref lit_str),
70+
path,
71+
value: syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit_str), .. }),
7272
..
7373
}) if path.is_ident(name) => Some(lit_str.value()),
7474
_ => None,
75-
})
75+
}
7676
}

0 commit comments

Comments
 (0)