@@ -895,38 +895,62 @@ fn zero_fields_of_group(
895
895
match typ {
896
896
type_:: Void ( ( ) ) => { }
897
897
type_:: Bool ( ( ) ) => {
898
- let line = Line ( format ! ( "self.builder.set_bool_field({}, false);" ,
899
- slot. get_offset( ) ) ) ;
898
+ let line = Line ( format ! (
899
+ "self.builder.set_bool_field({}, false);" ,
900
+ slot. get_offset( )
901
+ ) ) ;
900
902
// PERF could dedup more efficiently
901
- if !result. contains ( & line) { result. push ( line) }
903
+ if !result. contains ( & line) {
904
+ result. push ( line)
905
+ }
902
906
}
903
- type_:: Int8 ( ( ) ) |
904
- type_:: Int16 ( ( ) ) | type_:: Int32 ( ( ) ) | type_:: Int64 ( ( ) ) |
905
- type_:: Uint8 ( ( ) ) | type_:: Uint16 ( ( ) ) | type_:: Uint32 ( ( ) ) |
906
- type_:: Uint64 ( ( ) ) | type_:: Float32 ( ( ) ) | type_:: Float64 ( ( ) ) => {
907
+ type_:: Int8 ( ( ) )
908
+ | type_:: Int16 ( ( ) )
909
+ | type_:: Int32 ( ( ) )
910
+ | type_:: Int64 ( ( ) )
911
+ | type_:: Uint8 ( ( ) )
912
+ | type_:: Uint16 ( ( ) )
913
+ | type_:: Uint32 ( ( ) )
914
+ | type_:: Uint64 ( ( ) )
915
+ | type_:: Float32 ( ( ) )
916
+ | type_:: Float64 ( ( ) ) => {
907
917
let line = Line ( format ! (
908
918
"self.builder.set_data_field::<{0}>({1}, 0{0});" ,
909
919
slot. get_type( ) ?. type_string( ctx, Leaf :: Builder ( "'a" ) ) ?,
910
- slot. get_offset( ) ) ) ;
920
+ slot. get_offset( )
921
+ ) ) ;
911
922
// PERF could dedup more efficiently
912
- if !result. contains ( & line) { result. push ( line) }
923
+ if !result. contains ( & line) {
924
+ result. push ( line)
925
+ }
913
926
}
914
927
type_:: Enum ( _) => {
915
- let line = Line ( format ! ( "self.builder.set_data_field::<u16>({}, 0u16);" ,
916
- slot. get_offset( ) ) ) ;
928
+ let line = Line ( format ! (
929
+ "self.builder.set_data_field::<u16>({}, 0u16);" ,
930
+ slot. get_offset( )
931
+ ) ) ;
917
932
// PERF could dedup more efficiently
918
- if !result. contains ( & line) { result. push ( line) }
933
+ if !result. contains ( & line) {
934
+ result. push ( line)
935
+ }
919
936
}
920
- type_:: Struct ( _) | type_:: List ( _) | type_:: Text ( ( ) ) | type_:: Data ( ( ) ) |
921
- type_:: AnyPointer ( _) |
922
- type_:: Interface ( _)
923
- => { // Is this the right thing to do for interfaces?
924
- let line = Line ( format ! ( "self.builder.reborrow().get_pointer_field({}).clear();" ,
925
- slot. get_offset( ) ) ) ;
926
- * clear = true ;
927
- // PERF could dedup more efficiently
928
- if !result. contains ( & line) { result. push ( line) }
937
+ type_:: Struct ( _)
938
+ | type_:: List ( _)
939
+ | type_:: Text ( ( ) )
940
+ | type_:: Data ( ( ) )
941
+ | type_:: AnyPointer ( _)
942
+ | type_:: Interface ( _) => {
943
+ // Is this the right thing to do for interfaces?
944
+ let line = Line ( format ! (
945
+ "self.builder.reborrow().get_pointer_field({}).clear();" ,
946
+ slot. get_offset( )
947
+ ) ) ;
948
+ * clear = true ;
949
+ // PERF could dedup more efficiently
950
+ if !result. contains ( & line) {
951
+ result. push ( line)
929
952
}
953
+ }
930
954
}
931
955
}
932
956
}
0 commit comments