File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -179,15 +179,19 @@ impl Encode for RegisterInfo {
179
179
180
180
match self . fields {
181
181
Some ( ref v) => {
182
- let children: Result < Vec < Element > , SVDError > =
183
- v. iter ( ) . map ( Field :: encode) . collect ( ) ;
184
- let fields = Element {
185
- name : String :: from ( "fields" ) ,
186
- attributes : HashMap :: new ( ) ,
187
- children : children?,
188
- text : None ,
189
- } ;
190
- elem. children . push ( fields) ;
182
+ let children = v
183
+ . iter ( )
184
+ . map ( Field :: encode)
185
+ . collect :: < Result < Vec < Element > , SVDError > > ( ) ?;
186
+ if !children. is_empty ( ) {
187
+ let fields = Element {
188
+ name : String :: from ( "fields" ) ,
189
+ attributes : HashMap :: new ( ) ,
190
+ children,
191
+ text : None ,
192
+ } ;
193
+ elem. children . push ( fields) ;
194
+ }
191
195
}
192
196
None => ( ) ,
193
197
} ;
You can’t perform that action at this time.
0 commit comments