Skip to content

Commit c83e68e

Browse files
committed
update derive
1 parent 1381a1d commit c83e68e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

bolos-derive/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ edition = "2018"
99
proc-macro = true
1010

1111
[dependencies]
12-
syn = { version = "1.0", features = ["full", "extra-traits", "visit"] }
13-
quote = "1.0"
14-
proc-macro2 = "1"
15-
proc-macro-error = { version = "1" }
12+
syn = { version = "2.0.106", features = ["full", "extra-traits", "visit"] }
13+
quote = "1.0.40"
14+
proc-macro2 = "1.0.101"
1615

17-
convert_case = "0.6"
16+
convert_case = "0.8.0"
1817

1918
[dev-dependencies]
2019
bolos = { path = "../bolos" }

bolos-derive/src/enum_init.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ pub fn enum_init(_metadata: TokenStream, input: TokenStream) -> TokenStream {
7373
&Field {
7474
attrs: variant.attrs.clone(),
7575
vis: Visibility::Inherited,
76+
mutability: syn::FieldMutability::None,
7677
ident: None,
7778
colon_token: None,
7879
ty: inner.clone(),

bolos-derive/src/lazy_static.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ use proc_macro::TokenStream;
1717
use proc_macro2::TokenStream as TokenStream2;
1818
use quote::quote;
1919
use syn::{
20-
parse_macro_input, spanned::Spanned, AttributeArgs, Error, Expr, Ident, ItemStatic, Meta,
21-
NestedMeta, Token, Type,
20+
parse_macro_input, spanned::Spanned, Error, Expr, Ident, ItemStatic, Meta,
21+
Token, Type, punctuated::Punctuated, parse::Parser,
2222
};
2323

2424
pub fn lazy_static(metadata: TokenStream, input: TokenStream) -> TokenStream {
25-
let args = parse_macro_input!(metadata as AttributeArgs);
25+
let args = Punctuated::<Meta, Token![,]>::parse_terminated.parse(metadata).unwrap();
2626
let input = parse_macro_input!(input as ItemStatic);
2727

2828
let ItemStatic {
@@ -39,7 +39,7 @@ pub fn lazy_static(metadata: TokenStream, input: TokenStream) -> TokenStream {
3939
&name,
4040
*ty,
4141
*expr,
42-
mutability.is_some(),
42+
matches!(mutability, syn::StaticMutability::Mut(_)),
4343
is_cbindgen_mode(&args),
4444
)
4545
.map_err(|e| e.into_compile_error())
@@ -242,9 +242,9 @@ fn produce_custom_ty(
242242
// For example, it will return true for
243243
//#[attr(cbindgen)]
244244
#[allow(clippy::ptr_arg)]
245-
fn is_cbindgen_mode(args: &AttributeArgs) -> bool {
245+
fn is_cbindgen_mode(args: &Punctuated<Meta, Token![,]>) -> bool {
246246
for arg in args {
247-
if let NestedMeta::Meta(Meta::Path(path)) = arg {
247+
if let Meta::Path(path) = arg {
248248
if path
249249
.segments
250250
.iter()

0 commit comments

Comments
 (0)