diff --git a/Cargo.lock b/Cargo.lock index 3cf629e6..634b7401 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -290,6 +290,7 @@ dependencies = [ "butane_core", "proc-macro2 1.0.79", "quote 1.0.35", + "serde_variant", "syn 2.0.58", ] @@ -326,7 +327,6 @@ dependencies = [ "serde", "serde_json", "sqlparser", - "strum", "syn 2.0.58", "tempfile", "thiserror", @@ -466,7 +466,7 @@ version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2 1.0.79", "quote 1.0.35", "syn 2.0.58", @@ -952,12 +952,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1669,6 +1663,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_variant" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a0068df419f9d9b6488fdded3f1c818522cdea328e02ce9d9f147380265a432" +dependencies = [ + "serde", +] + [[package]] name = "sha1_smol" version = "1.0.0" @@ -1761,28 +1764,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" -dependencies = [ - "heck 0.4.1", - "proc-macro2 1.0.79", - "quote 1.0.35", - "rustversion", - "syn 2.0.58", -] - [[package]] name = "subtle" version = "2.5.0" diff --git a/butane_codegen/Cargo.toml b/butane_codegen/Cargo.toml index 7fa5871a..822098a0 100644 --- a/butane_codegen/Cargo.toml +++ b/butane_codegen/Cargo.toml @@ -17,6 +17,7 @@ uuid = ["butane_core/uuid"] butane_core = { workspace = true } proc-macro2 = { workspace = true } quote = { workspace = true } +serde_variant = "0.1.3" syn = { workspace = true } [lib] diff --git a/butane_codegen/src/lib.rs b/butane_codegen/src/lib.rs index 4f327935..f4782f8e 100644 --- a/butane_codegen/src/lib.rs +++ b/butane_codegen/src/lib.rs @@ -268,7 +268,7 @@ pub fn derive_field_type(input: TokenStream) -> TokenStream { } fn derive_field_type_for_newtype(ident: &Ident, sqltype: SqlType) -> TokenStream { - let sqltype_name: &'static str = sqltype.clone().into(); + let sqltype_name = serde_variant::to_variant_name(&sqltype).unwrap(); let sqltype_ident = syn::Ident::new(sqltype_name, proc_macro2::Span::call_site()); let mut migrations = migrations_for_dir(); diff --git a/butane_core/Cargo.toml b/butane_core/Cargo.toml index 0b45b9bf..8aaebd05 100644 --- a/butane_core/Cargo.toml +++ b/butane_core/Cargo.toml @@ -45,7 +45,6 @@ regex = { version = "1.5", features = ["std"] } rusqlite = { workspace = true, optional = true } serde = { features = ["derive"], workspace = true } serde_json = { workspace = true } -strum = { version = "0.26", features = ["derive"] } sqlparser = { workspace = true } syn = { workspace = true } thiserror = "1.0" diff --git a/butane_core/src/lib.rs b/butane_core/src/lib.rs index d869259f..7213c4e0 100644 --- a/butane_core/src/lib.rs +++ b/butane_core/src/lib.rs @@ -268,7 +268,7 @@ impl From for Error { /// Enumeration of the types a database value may take. /// /// See also [`SqlVal`]. -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, strum::IntoStaticStr)] +#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] pub enum SqlType { /// Boolean Bool,