@@ -569,25 +569,28 @@ impl<'ns, 'c> NamespaceGenerator<'ns, 'c> {
569569 out,
570570 ) ;
571571 let field_size = field. size ( ) . unwrap ( ) ;
572- if bytes_name. is_some ( ) && field_size == union_size {
573- outln ! ( out, "Self({})" , bytes_name. unwrap( ) ) ;
574- } else {
575- outln ! ( out, "let value = [" ) ;
576- for result_byte in result_bytes. iter ( ) {
577- outln ! ( out. indent( ) , "{}," , result_byte) ;
572+ match bytes_name {
573+ Some ( bytes_name) if field_size == union_size => {
574+ outln ! ( out, "Self({})" , bytes_name) ;
578575 }
579- // This is needed to handle cases such as Behavior.type or
580- // Action.type from the XKB extension.
581- //
582- // FIXME: For those cases it might be better to omit the
583- // serialize implementation.
584- if field_size != union_size {
585- for _ in 0 ..( union_size - field_size) {
586- outln ! ( out. indent( ) , "0," ) ;
576+ _ => {
577+ outln ! ( out, "let value = [" ) ;
578+ for result_byte in result_bytes. iter ( ) {
579+ outln ! ( out. indent( ) , "{}," , result_byte) ;
580+ }
581+ // This is needed to handle cases such as Behavior.type or
582+ // Action.type from the XKB extension.
583+ //
584+ // FIXME: For those cases it might be better to omit the
585+ // serialize implementation.
586+ if field_size != union_size {
587+ for _ in 0 ..( union_size - field_size) {
588+ outln ! ( out. indent( ) , "0," ) ;
589+ }
587590 }
591+ outln ! ( out, "];" ) ;
592+ outln ! ( out, "Self(value)" ) ;
588593 }
589- outln ! ( out, "];" ) ;
590- outln ! ( out, "Self(value)" ) ;
591594 }
592595 } ) ;
593596 outln ! ( out, "}}" ) ;
0 commit comments