Skip to content

Commit 4cfaca3

Browse files
authored
Update syn to v2 (#239)
1 parent b622630 commit 4cfaca3

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

crates/macro/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Internal macros used by the `walrus` crate, not for public consumption.
1616
heck = "0.3.1"
1717
proc-macro2 = "1.0.1"
1818
quote = "1.0.2"
19-
syn = { version = "1.0.5", features = ['extra-traits'] }
19+
syn = { version = "2.0.0", features = ['extra-traits'] }
2020

2121
[lib]
2222
proc_macro = true

crates/macro/src/lib.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,16 @@ fn walrus_attrs(attrs: &mut Vec<syn::Attribute>) -> TokenStream {
154154
let mut ret = proc_macro2::TokenStream::new();
155155
let ident = syn::Path::from(syn::Ident::new("walrus", Span::call_site()));
156156
for i in (0..attrs.len()).rev() {
157-
if attrs[i].path != ident {
157+
if attrs[i].path() != &ident {
158158
continue;
159159
}
160160
let attr = attrs.remove(i);
161-
let group = match attr.tokens.into_iter().next().unwrap() {
162-
proc_macro2::TokenTree::Group(g) => g,
163-
_ => panic!("#[walrus(...)] expected"),
161+
let group = if let syn::Meta::List(syn::MetaList { tokens, .. }) = attr.meta {
162+
tokens
163+
} else {
164+
panic!("#[walrus(...)] expected")
164165
};
165-
ret.extend(group.stream());
166+
ret.extend(group);
166167
ret.extend(quote! { , });
167168
}
168169
return ret.into();

crates/tests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ serde_json = { version = "1.0.40", features = ['preserve_order'] }
1616
tempfile = "3.1.0"
1717
walrus = { path = "../.." }
1818
walrus-tests-utils = { path = "../tests-utils" }
19-
wasmprinter = "0.2.25"
19+
wasmprinter = "=0.2.59"
2020
wat = "1.0.36"
2121

2222
[features]

0 commit comments

Comments
 (0)