@@ -101,7 +101,7 @@ impl VariantRepr {
101
101
}
102
102
}
103
103
104
- pub ( crate ) fn to_variant (
104
+ pub ( crate ) fn make_to_variant_expr (
105
105
& self ,
106
106
trait_kind : ToVariantTrait ,
107
107
) -> Result < TokenStream2 , syn:: Error > {
@@ -119,13 +119,13 @@ impl VariantRepr {
119
119
"cannot skip the only field in a tuple" ,
120
120
) ) ;
121
121
}
122
- field. to_variant ( trait_kind)
122
+ field. make_to_variant_expr ( trait_kind)
123
123
} else {
124
124
let exprs = fields. iter ( ) . filter_map ( |f| {
125
125
if f. attr . skip_to_variant {
126
126
None
127
127
} else {
128
- Some ( f. to_variant ( trait_kind) )
128
+ Some ( f. make_to_variant_expr ( trait_kind) )
129
129
}
130
130
} ) ;
131
131
@@ -150,7 +150,7 @@ impl VariantRepr {
150
150
let name_string_literals =
151
151
name_strings. iter ( ) . map ( |string| Literal :: string ( string) ) ;
152
152
153
- let exprs = fields. iter ( ) . map ( |f| f. to_variant ( trait_kind) ) ;
153
+ let exprs = fields. iter ( ) . map ( |f| f. make_to_variant_expr ( trait_kind) ) ;
154
154
155
155
quote ! {
156
156
{
@@ -170,7 +170,7 @@ impl VariantRepr {
170
170
Ok ( tokens)
171
171
}
172
172
173
- pub ( crate ) fn from_variant (
173
+ pub ( crate ) fn make_from_variant_expr (
174
174
& self ,
175
175
variant : & Ident ,
176
176
ctor : & TokenStream2 ,
@@ -199,7 +199,7 @@ impl VariantRepr {
199
199
"cannot skip the only field in a tuple" ,
200
200
) ) ;
201
201
}
202
- let expr = field. from_variant ( & quote ! ( #variant) ) ;
202
+ let expr = field. make_from_variant_expr ( & quote ! ( #variant) ) ;
203
203
quote ! {
204
204
{
205
205
#expr. map( #ctor)
@@ -224,7 +224,7 @@ impl VariantRepr {
224
224
let expr_variant = & quote ! ( & __array. get( __index) ) ;
225
225
let non_skipped_exprs = non_skipped_fields
226
226
. iter ( )
227
- . map ( |f| f. from_variant ( expr_variant) ) ;
227
+ . map ( |f| f. make_from_variant_expr ( expr_variant) ) ;
228
228
229
229
quote ! {
230
230
{
@@ -283,7 +283,7 @@ impl VariantRepr {
283
283
let expr_variant = & quote ! ( & __dict. get_or_nil( & __key) ) ;
284
284
let exprs = non_skipped_fields
285
285
. iter ( )
286
- . map ( |f| f. from_variant ( expr_variant) ) ;
286
+ . map ( |f| f. make_from_variant_expr ( expr_variant) ) ;
287
287
288
288
quote ! {
289
289
{
@@ -317,7 +317,7 @@ impl VariantRepr {
317
317
}
318
318
319
319
impl Field {
320
- fn to_variant ( & self , trait_kind : ToVariantTrait ) -> TokenStream2 {
320
+ fn make_to_variant_expr ( & self , trait_kind : ToVariantTrait ) -> TokenStream2 {
321
321
let Field { ident, attr, .. } = self ;
322
322
if let Some ( to_variant_with) = & attr. to_variant_with {
323
323
quote ! ( #to_variant_with( #ident) )
@@ -327,7 +327,7 @@ impl Field {
327
327
}
328
328
}
329
329
330
- fn from_variant ( & self , variant : & TokenStream2 ) -> TokenStream2 {
330
+ fn make_from_variant_expr ( & self , variant : & TokenStream2 ) -> TokenStream2 {
331
331
if let Some ( from_variant_with) = & self . attr . from_variant_with {
332
332
quote ! ( #from_variant_with( #variant) )
333
333
} else {
0 commit comments