@@ -34,35 +34,35 @@ pub fn derive_plan_trace_object(input: TokenStream) -> TokenStream {
34
34
let ident = input. ident ;
35
35
let ( impl_generics, ty_generics, where_clause) = input. generics . split_for_impl ( ) ;
36
36
37
- let output = if let syn:: Data :: Struct ( syn:: DataStruct {
37
+ let syn:: Data :: Struct ( syn:: DataStruct {
38
38
fields : syn:: Fields :: Named ( ref fields) ,
39
39
..
40
- } ) = input. data
41
- {
42
- let spaces = util:: get_fields_with_attribute ( fields, "trace" ) ;
43
- let post_scan_spaces = util:: get_fields_with_attribute ( fields, "post_scan" ) ;
44
- let fallback = util:: get_unique_field_with_attribute ( fields, "fallback_trace" ) ;
40
+ } ) = input. data else {
41
+ abort_call_site ! ( "`#[derive(PlanTraceObject)]` only supports structs with named fields." ) ;
42
+ } ;
43
+
44
+ let spaces = util:: get_fields_with_attribute ( fields, "trace" ) ;
45
+ let post_scan_spaces = util:: get_fields_with_attribute ( fields, "post_scan" ) ;
46
+ let fallback = util:: get_unique_field_with_attribute ( fields, "fallback_trace" ) ;
47
+
48
+ let trace_object_function =
49
+ plan_trace_object_impl:: generate_trace_object ( & spaces, & fallback, & ty_generics) ;
50
+ let post_scan_object_function = plan_trace_object_impl:: generate_post_scan_object (
51
+ & post_scan_spaces,
52
+ & fallback,
53
+ & ty_generics,
54
+ ) ;
55
+ let may_move_objects_function =
56
+ plan_trace_object_impl:: generate_may_move_objects ( & spaces, & fallback, & ty_generics) ;
45
57
46
- let trace_object_function =
47
- plan_trace_object_impl:: generate_trace_object ( & spaces, & fallback, & ty_generics) ;
48
- let post_scan_object_function = plan_trace_object_impl:: generate_post_scan_object (
49
- & post_scan_spaces,
50
- & fallback,
51
- & ty_generics,
52
- ) ;
53
- let may_move_objects_function =
54
- plan_trace_object_impl:: generate_may_move_objects ( & spaces, & fallback, & ty_generics) ;
55
- quote ! {
56
- impl #impl_generics crate :: plan:: PlanTraceObject #ty_generics for #ident #ty_generics #where_clause {
57
- #trace_object_function
58
+ let output = quote ! {
59
+ impl #impl_generics crate :: plan:: PlanTraceObject #ty_generics for #ident #ty_generics #where_clause {
60
+ #trace_object_function
58
61
59
- #post_scan_object_function
62
+ #post_scan_object_function
60
63
61
- #may_move_objects_function
62
- }
64
+ #may_move_objects_function
63
65
}
64
- } else {
65
- abort_call_site ! ( "`#[derive(PlanTraceObject)]` only supports structs with named fields." )
66
66
} ;
67
67
68
68
// Debug the output - use the following code to debug the generated code (when cargo exapand is not working)
0 commit comments