@@ -117,7 +117,7 @@ crate struct RenderType {
117117#[ derive( Debug ) ]
118118crate struct IndexItemFunctionType {
119119 inputs : Vec < TypeWithKind > ,
120- output : Option < Vec < TypeWithKind > > ,
120+ output : Vec < TypeWithKind > ,
121121}
122122
123123impl Serialize for IndexItemFunctionType {
@@ -126,21 +126,16 @@ impl Serialize for IndexItemFunctionType {
126126 S : Serializer ,
127127 {
128128 // If we couldn't figure out a type, just write `null`.
129- let mut iter = self . inputs . iter ( ) ;
130- if match self . output {
131- Some ( ref output) => iter. chain ( output. iter ( ) ) . any ( |i| i. ty . name . is_none ( ) ) ,
132- None => iter. any ( |i| i. ty . name . is_none ( ) ) ,
133- } {
129+ let has_missing = self . inputs . iter ( ) . chain ( self . output . iter ( ) ) . any ( |i| i. ty . name . is_none ( ) ) ;
130+ if has_missing {
134131 serializer. serialize_none ( )
135132 } else {
136133 let mut seq = serializer. serialize_seq ( None ) ?;
137134 seq. serialize_element ( & self . inputs ) ?;
138- if let Some ( output) = & self . output {
139- if output. len ( ) > 1 {
140- seq. serialize_element ( & output) ?;
141- } else {
142- seq. serialize_element ( & output[ 0 ] ) ?;
143- }
135+ match self . output . as_slice ( ) {
136+ [ ] => { }
137+ [ one] => seq. serialize_element ( one) ?,
138+ all => seq. serialize_element ( all) ?,
144139 }
145140 seq. end ( )
146141 }
0 commit comments