69
69
//! }
70
70
//! }
71
71
//! }
72
- //!
72
+ //!
73
73
//! impl From<Cat> for Animal {
74
74
//! fn from(from: Cat) -> Self {
75
75
//! Animal::Cat(from)
@@ -250,7 +250,9 @@ fn implement_trait(
250
250
}
251
251
}
252
252
253
- let match_block = gen_match_block ( variants, |_| gen_static_method_call ( quote ! { #trait_ident } , sig) ) ;
253
+ let match_block = gen_match_block ( variants, |_| {
254
+ gen_static_method_call ( quote ! { #trait_ident } , sig)
255
+ } ) ;
254
256
let tokens = quote ! { #sig { #match_block } } ;
255
257
parse2 :: < ImplItem > ( tokens) . unwrap ( )
256
258
}
@@ -279,7 +281,7 @@ fn implement_raw(variants: &[WrapperVariant], pseudo_impl: &mut ItemImpl) {
279
281
280
282
let match_block = gen_match_block ( variants, |variant| {
281
283
let ty = & variant. wrapped ;
282
- gen_static_method_call ( quote ! { #ty } , & method. sig )
284
+ gen_static_method_call ( quote ! { < #ty> } , & method. sig )
283
285
} ) ;
284
286
let body = quote ! { { #match_block } } ;
285
287
method. block = syn:: parse2 ( body) . unwrap ( ) ;
@@ -332,10 +334,13 @@ impl GenerateProxyImpl {
332
334
. get ( & path)
333
335
. unwrap_or_else ( || panic ! ( "missing declaration of trait `{}`" , path) )
334
336
}
335
-
337
+
336
338
fn impl_from_variants ( & self , module : & mut ItemMod ) {
337
339
let proxy_enum = & self . proxy_enum ;
338
- for WrapperVariant { variant, wrapped, .. } in self . get_variants ( ) {
340
+ for WrapperVariant {
341
+ variant, wrapped, ..
342
+ } in self . get_variants ( )
343
+ {
339
344
let variant = & variant. ident ;
340
345
let tokens = quote ! {
341
346
impl From <#wrapped> for #proxy_enum {
@@ -345,7 +350,7 @@ impl GenerateProxyImpl {
345
350
}
346
351
} ;
347
352
let from_impl: ItemImpl = syn:: parse2 ( tokens) . unwrap ( ) ;
348
- module. content . as_mut ( ) . unwrap ( ) . 1 . push ( from_impl. into ( ) ) ;
353
+ module. content . as_mut ( ) . unwrap ( ) . 1 . push ( from_impl. into ( ) ) ;
349
354
}
350
355
}
351
356
}
0 commit comments