@@ -272,7 +272,8 @@ impl<'a> VerifyImports<'a> {
272
272
"selfDestruct" ,
273
273
FunctionType :: new( vec![ ValueType :: I32 ] , None ) ,
274
274
) ,
275
- ] . iter ( )
275
+ ]
276
+ . iter ( )
276
277
. cloned ( )
277
278
. collect ( ) ,
278
279
require_all : false ,
@@ -389,32 +390,40 @@ impl<'a> ImportCheck for ImportType<'a> {
389
390
{
390
391
match entry. external ( ) {
391
392
// TODO: Wrap this in a helper.
392
- External :: Function ( idx) => if let Some ( sig) = func_sig {
393
- if * sig == imported_func_sig_by_index ( module, * idx as usize ) {
394
- ImportStatus :: Good
393
+ External :: Function ( idx) => {
394
+ if let Some ( sig) = func_sig {
395
+ if * sig == imported_func_sig_by_index ( module, * idx as usize ) {
396
+ ImportStatus :: Good
397
+ } else {
398
+ ImportStatus :: Malformed
399
+ }
395
400
} else {
396
401
ImportStatus :: Malformed
397
402
}
398
- } else {
399
- ImportStatus :: Malformed
400
- } ,
403
+ }
401
404
// NOTE: There may be a better way to do mappings between enum variants.
402
405
// Just check import variant here.
403
- External :: Global ( _idx) => if let ImportType :: Global ( _n, _f) = self {
404
- ImportStatus :: Good
405
- } else {
406
- ImportStatus :: Malformed
407
- } ,
408
- External :: Memory ( _idx) => if let ImportType :: Memory ( _n, _f) = self {
409
- ImportStatus :: Good
410
- } else {
411
- ImportStatus :: Malformed
412
- } ,
413
- External :: Table ( _idx) => if let ImportType :: Table ( _n, _f) = self {
414
- ImportStatus :: Good
415
- } else {
416
- ImportStatus :: Malformed
417
- } ,
406
+ External :: Global ( _idx) => {
407
+ if let ImportType :: Global ( _n, _f) = self {
408
+ ImportStatus :: Good
409
+ } else {
410
+ ImportStatus :: Malformed
411
+ }
412
+ }
413
+ External :: Memory ( _idx) => {
414
+ if let ImportType :: Memory ( _n, _f) = self {
415
+ ImportStatus :: Good
416
+ } else {
417
+ ImportStatus :: Malformed
418
+ }
419
+ }
420
+ External :: Table ( _idx) => {
421
+ if let ImportType :: Table ( _n, _f) = self {
422
+ ImportStatus :: Good
423
+ } else {
424
+ ImportStatus :: Malformed
425
+ }
426
+ }
418
427
}
419
428
} else {
420
429
ImportStatus :: NotFound
@@ -777,7 +786,8 @@ mod tests {
777
786
"ethereum" ,
778
787
"storageStore" ,
779
788
FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
780
- ) ] . iter ( )
789
+ ) ]
790
+ . iter ( )
781
791
. cloned ( )
782
792
. collect ( ) ,
783
793
allow_unlisted : false ,
@@ -814,7 +824,8 @@ mod tests {
814
824
"ethereum" ,
815
825
"storageStore" ,
816
826
FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
817
- ) ] . iter ( )
827
+ ) ]
828
+ . iter ( )
818
829
. cloned ( )
819
830
. collect ( ) ,
820
831
allow_unlisted : true ,
@@ -851,7 +862,8 @@ mod tests {
851
862
"ethereum" ,
852
863
"storageStore" ,
853
864
FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
854
- ) ] . iter ( )
865
+ ) ]
866
+ . iter ( )
855
867
. cloned ( )
856
868
. collect ( ) ,
857
869
allow_unlisted : false ,
@@ -888,7 +900,8 @@ mod tests {
888
900
"ethereum" ,
889
901
"storageStore" ,
890
902
FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
891
- ) ] . iter ( )
903
+ ) ]
904
+ . iter ( )
892
905
. cloned ( )
893
906
. collect ( ) ,
894
907
allow_unlisted : false ,
0 commit comments