From 9710f41a3aa08eb30f9e957c8f84d7a2aab9f050 Mon Sep 17 00:00:00 2001 From: Jonas Platte <158304798+svix-jplatte@users.noreply.github.com> Date: Sun, 29 Sep 2024 23:39:54 +0200 Subject: [PATCH] macros: Stop using syn's extra-traits feature (#378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … to reduce compile times. --- strum_macros/Cargo.toml | 2 +- strum_macros/src/helpers/inner_variant_props.rs | 2 +- strum_macros/src/helpers/metadata.rs | 1 - strum_macros/src/helpers/type_props.rs | 2 +- strum_macros/src/helpers/variant_props.rs | 2 +- strum_macros/src/macros/enum_table.rs | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/strum_macros/Cargo.toml b/strum_macros/Cargo.toml index c053ac26..243d7231 100644 --- a/strum_macros/Cargo.toml +++ b/strum_macros/Cargo.toml @@ -23,7 +23,7 @@ heck = "0.5.0" proc-macro2 = "1.0" quote = "1.0" rustversion = "1.0" -syn = { version = "2.0", features = ["parsing", "extra-traits"] } +syn = { version = "2.0", features = ["parsing"] } [dev-dependencies] strum = { path = "../strum", version= "0.26" } diff --git a/strum_macros/src/helpers/inner_variant_props.rs b/strum_macros/src/helpers/inner_variant_props.rs index bc0fe799..f37bac99 100644 --- a/strum_macros/src/helpers/inner_variant_props.rs +++ b/strum_macros/src/helpers/inner_variant_props.rs @@ -6,7 +6,7 @@ pub trait HasInnerVariantProperties { fn get_variant_inner_properties(&self) -> syn::Result; } -#[derive(Clone, Eq, PartialEq, Debug, Default)] +#[derive(Clone, Default)] pub struct StrumInnerVariantProperties { pub default_with: Option, } diff --git a/strum_macros/src/helpers/metadata.rs b/strum_macros/src/helpers/metadata.rs index 94100a7f..5a44c785 100644 --- a/strum_macros/src/helpers/metadata.rs +++ b/strum_macros/src/helpers/metadata.rs @@ -295,7 +295,6 @@ fn get_metadata_inner<'a, T: Parse>( }) } -#[derive(Debug)] pub enum InnerVariantMeta { DefaultWith { kw: kw::default_with, value: LitStr }, } diff --git a/strum_macros/src/helpers/type_props.rs b/strum_macros/src/helpers/type_props.rs index 7302853e..cdc7a8c2 100644 --- a/strum_macros/src/helpers/type_props.rs +++ b/strum_macros/src/helpers/type_props.rs @@ -11,7 +11,7 @@ pub trait HasTypeProperties { fn get_type_properties(&self) -> syn::Result; } -#[derive(Debug, Clone, Default)] +#[derive(Clone, Default)] pub struct StrumTypeProperties { pub case_style: Option, pub ascii_case_insensitive: bool, diff --git a/strum_macros/src/helpers/variant_props.rs b/strum_macros/src/helpers/variant_props.rs index 681c7c06..e0fffdc5 100644 --- a/strum_macros/src/helpers/variant_props.rs +++ b/strum_macros/src/helpers/variant_props.rs @@ -9,7 +9,7 @@ pub trait HasStrumVariantProperties { fn get_variant_properties(&self) -> syn::Result; } -#[derive(Clone, Eq, PartialEq, Debug, Default)] +#[derive(Clone, Default)] pub struct StrumVariantProperties { pub disabled: Option, pub default: Option, diff --git a/strum_macros/src/macros/enum_table.rs b/strum_macros/src/macros/enum_table.rs index f9d4e81d..3d6b3090 100644 --- a/strum_macros/src/macros/enum_table.rs +++ b/strum_macros/src/macros/enum_table.rs @@ -58,7 +58,7 @@ pub fn enum_table_inner(ast: &DeriveInput) -> syn::Result { } // Error on variants with data - if variant.fields != Fields::Unit { + if !matches!(variant.fields, Fields::Unit) { return Err(syn::Error::new( variant.fields.span(), "`EnumTable` doesn't support enums with non-unit variants",