diff --git a/Cargo.toml b/Cargo.toml index c1300d28..2d808a5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,15 +13,15 @@ repository = "https://github.com/ruma/ruma-api-macros" version = "0.1.0" [dependencies] -syn = { version = "0.15.36", features = ["full"] } -quote = "0.6.12" -proc-macro2 = "0.4.30" +syn = { version = "1.0.4", features = ["full"] } +quote = "1.0.2" +proc-macro2 = "1.0.1" [lib] proc-macro = true [dev-dependencies] -ruma-identifiers = "0.13.1" -serde_json = "1.0.39" -js_int = { version = "0.1.0", features = ["serde"] } -serde = { version = "1.0.92", features = ["derive"] } +ruma-identifiers = "0.14.0" +serde_json = "1.0.40" +js_int = { version = "0.1.2", features = ["serde"] } +serde = { version = "1.0.99", features = ["derive"] } diff --git a/src/gen.rs b/src/gen.rs index 96529e43..c3fc9b96 100644 --- a/src/gen.rs +++ b/src/gen.rs @@ -557,13 +557,13 @@ fn populate_state_fields(is_custom: bool, content_name: Ident, fields: Vec bool { - event_type.segments.last().unwrap().value().ident == "Custom" + event_type.segments.last().unwrap().ident == "Custom" } /// Checks if a type is an `Option`. fn is_option(ty: &Type) -> bool { if let Type::Path(ref type_path) = ty { - type_path.path.segments.first().unwrap().value().ident == "Option" + type_path.path.segments.first().unwrap().ident == "Option" } else { panic!("struct field had unexpected non-path type"); } diff --git a/src/parse.rs b/src/parse.rs index 266f8756..e2fb6ba5 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -81,20 +81,11 @@ impl Parse for RumaEventInput { if ident == "kind" { let event_kind = match field_value.expr { Expr::Path(expr_path) => { - if expr_path - .path - .is_ident(Ident::new("Event", Span::call_site())) - { + if expr_path.path.is_ident("Event") { EventKind::Event - } else if expr_path - .path - .is_ident(Ident::new("RoomEvent", Span::call_site())) - { + } else if expr_path.path.is_ident("RoomEvent") { EventKind::RoomEvent - } else if expr_path - .path - .is_ident(Ident::new("StateEvent", Span::call_site())) - { + } else if expr_path.path.is_ident("StateEvent") { EventKind::StateEvent } else { panic!("value of field `kind` must be one of `Event`, `RoomEvent`, or `StateEvent`"); @@ -114,7 +105,7 @@ impl Parse for RumaEventInput { } let path = expr_path.path; - let variant = path.segments.first().unwrap().into_value(); + let variant = path.segments.first().unwrap(); let mut punctuated = Punctuated::new(); punctuated.push(PathSegment { @@ -189,6 +180,7 @@ pub enum Content { } /// The style of field within the macro body. +#[allow(clippy::large_enum_variant)] enum RumaEventField { /// The value of a field is a block with a type alias in it. ///