You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnErr( syn::Error::new_spanned( variant,"#[arg_for_constructor] cannot be applied directly to an enum variant identifier. Apply it to the fields *within* the variant instead, e.g., `MyVariant( #[arg_for_constructor] i32 )`."));
syn::Fields::Named( fields ) =>// <<< Use fields variable >>>
277
+
syn::Fields::Named( fields ) =>
285
278
{
286
-
// --- DEBUG PRINT 3c ---
287
-
// ...
288
-
// --- END DEBUG PRINT 3c ---
289
-
290
279
if variant_attrs.arg_for_constructor.value(false)
291
280
{
292
281
returnErr( syn::Error::new_spanned( variant,"#[arg_for_constructor] cannot be applied directly to an enum variant identifier. Apply it to the fields *within* the variant instead, e.g., `MyVariant { #[arg_for_constructor] field : i32 }`."));
293
282
}
294
283
295
-
// <<< Start: Logic for Named Fields (Struct-like Variants) >>>
296
-
println!("DEBUG: Processing Named fields for variant: {}", variant.ident );// Debug print
297
284
match fields.named.len()
298
285
{
299
286
// Sub-case: Zero fields (Struct(0))
300
287
0 =>
301
288
{
302
-
println!("DEBUG: Calling handle_struct_zero_variant for variant: {}", variant.ident );// Debug print
Copy file name to clipboardExpand all lines: module/core/former_meta/src/derive_former/former_enum/tuple_non_zero.rs
+1-4Lines changed: 1 addition & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,6 @@ use syn::
14
14
{
15
15
self,
16
16
Fields,
17
-
Error,
18
17
GenericParam,
19
18
TypeParam,
20
19
ConstParam,
@@ -99,9 +98,7 @@ pub( super ) fn handle_tuple_non_zero_variant< 'a >
99
98
if !matches!( inner_type, syn::Type::Path( _ )){returnErr( syn::Error::new_spanned( inner_type,"#[subform_scalar] can only be applied to variants holding a path type (e.g., MyStruct, Option<T>), not tuples, references, etc."));}
100
99
}
101
100
else// Default case
102
-
{
103
-
if !matches!( inner_type, syn::Type::Path( _ )){returnErr( syn::Error::new_spanned( inner_type,"Default subforming requires the single field of a tuple variant to be a path type (e.g., MyStruct, Option<T>)."));}
104
-
}
101
+
if !matches!( inner_type, syn::Type::Path( _ )){returnErr( syn::Error::new_spanned( inner_type,"Default subforming requires the single field of a tuple variant to be a path type (e.g., MyStruct, Option<T>)."));}
105
102
106
103
let end_struct_name = format_ident!("{}{}End", enum_name, variant_ident );
0 commit comments