@@ -266,27 +266,28 @@ fn validate(input: &mut StructuredInput) -> syn::Result<Vec<&'static MathOpInfo>
266
266
}
267
267
}
268
268
269
- if let Some ( map) = & input. fn_extra {
270
- if !map. keys ( ) . any ( |key| key == "_" ) {
271
- // No default provided; make sure every expected function is covered
272
- let mut fns_not_covered = Vec :: new ( ) ;
273
- for func in & fn_list {
274
- if !map. keys ( ) . any ( |key| key == func. name ) {
275
- // `name` was not mentioned in the `match` statement
276
- fns_not_covered. push ( func) ;
277
- }
269
+ if input
270
+ . fn_extra
271
+ . map_or_default ( |map| !map. keys ( ) . any ( |key| key == "_" ) )
272
+ {
273
+ // No default provided; make sure every expected function is covered
274
+ let mut fns_not_covered = Vec :: new ( ) ;
275
+ for func in & fn_list {
276
+ if !map. keys ( ) . any ( |key| key == func. name ) {
277
+ // `name` was not mentioned in the `match` statement
278
+ fns_not_covered. push ( func) ;
278
279
}
280
+ }
279
281
280
- if !fns_not_covered. is_empty ( ) {
281
- let e = syn:: Error :: new (
282
- input. fn_extra_span . unwrap ( ) ,
283
- format ! (
284
- "`fn_extra`: no default `_` pattern specified and the following \
285
- patterns are not covered: {fns_not_covered:#?}"
286
- ) ,
287
- ) ;
288
- return Err ( e) ;
289
- }
282
+ if !fns_not_covered. is_empty ( ) {
283
+ let e = syn:: Error :: new (
284
+ input. fn_extra_span . unwrap ( ) ,
285
+ format ! (
286
+ "`fn_extra`: no default `_` pattern specified and the following \
287
+ patterns are not covered: {fns_not_covered:#?}"
288
+ ) ,
289
+ ) ;
290
+ return Err ( e) ;
290
291
}
291
292
} ;
292
293
0 commit comments