Skip to content

Commit 7807e34

Browse files
authored
chore: update syn crate to version 2 (#29)
1 parent 795100c commit 7807e34

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

msfs_derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ proc-macro = true
1212
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1313

1414
[dependencies]
15-
syn = { version = "1.0", features = ["full"] }
15+
syn = { version = "2.0", features = ["full"] }
1616
quote = "1.0"

msfs_derive/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,21 @@ fn parse_struct_fields(
181181

182182
let mut attrs = Vec::new();
183183
for a in &field.attrs {
184-
let simish = if let Some(i) = a.path.get_ident() {
184+
let simish = if let Some(i) = a.path().get_ident() {
185185
attributes.contains(&i.to_string().as_str())
186186
} else {
187187
false
188188
};
189189
if simish {
190-
let (name, value) = match a.parse_meta().unwrap() {
190+
let (name, value) = match &a.meta {
191191
Meta::NameValue(mnv) => {
192192
let name = mnv.path.get_ident().unwrap().to_string();
193-
let value = match mnv.lit {
194-
Lit::Str(s) => s.value(),
195-
Lit::Float(f) => f.base10_digits().to_string(),
193+
let value = match &mnv.value {
194+
Expr::Lit(l) => match &l.lit {
195+
Lit::Str(s) => s.value(),
196+
Lit::Float(f) => f.base10_digits().to_string(),
197+
_ => panic!("argument must be a string or float"),
198+
},
196199
_ => panic!("argument must be a string or float"),
197200
};
198201
(name, value)

0 commit comments

Comments
 (0)