From 96f57d753a8a1b40dd66e7cd2c7c7fe9962eb85a Mon Sep 17 00:00:00 2001 From: pyrite Date: Wed, 10 Sep 2025 15:25:01 +0200 Subject: [PATCH] fix(codegen): fix raw repr enums when there is no description --- torn-api-codegen/Cargo.toml | 2 +- torn-api-codegen/src/model/enum.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/torn-api-codegen/Cargo.toml b/torn-api-codegen/Cargo.toml index d700456..038e453 100644 --- a/torn-api-codegen/Cargo.toml +++ b/torn-api-codegen/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "torn-api-codegen" authors = ["Pyrit [2111649]"] -version = "0.7.3" +version = "0.7.4" edition = "2021" description = "Contains the v2 torn API model descriptions and codegen for the bindings" license = { workspace = true } diff --git a/torn-api-codegen/src/model/enum.rs b/torn-api-codegen/src/model/enum.rs index 8a2d556..fbc54a9 100644 --- a/torn-api-codegen/src/model/enum.rs +++ b/torn-api-codegen/src/model/enum.rs @@ -444,7 +444,7 @@ impl Enum { if shared.len() >= 2 { for (idx, variant) in shared.into_iter().enumerate() { let label = idx + 1; - variant.name = format!("Variant{}", label); + variant.name = format!("Variant{label}"); if let EnumVariantValue::Tuple(values) = &mut variant.value { if let [EnumVariantTupleValue::Enum { name, inner, .. }] = values.as_mut_slice() { @@ -475,7 +475,6 @@ impl Enum { let name = format_ident!("{}", self.name); let desc = self.description.as_ref().map(|d| { quote! { - #repr #[doc = #d] } }); @@ -540,6 +539,7 @@ impl Enum { #[derive(Debug, Clone, PartialEq, #(#derives),*)] #[cfg_attr(feature = "strum", derive(strum::EnumIs, strum::EnumTryAs))] #serde_attr + #repr pub enum #name { #(#variants),* }