@@ -117,7 +117,7 @@ crate struct RenderType {
117
117
#[ derive( Debug ) ]
118
118
crate struct IndexItemFunctionType {
119
119
inputs : Vec < TypeWithKind > ,
120
- output : Option < Vec < TypeWithKind > > ,
120
+ output : Vec < TypeWithKind > ,
121
121
}
122
122
123
123
impl Serialize for IndexItemFunctionType {
@@ -126,21 +126,16 @@ impl Serialize for IndexItemFunctionType {
126
126
S : Serializer ,
127
127
{
128
128
// 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 {
134
131
serializer. serialize_none ( )
135
132
} else {
136
133
let mut seq = serializer. serialize_seq ( None ) ?;
137
134
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) ?,
144
139
}
145
140
seq. end ( )
146
141
}
0 commit comments