@@ -272,7 +272,8 @@ impl<'a> VerifyImports<'a> {
272272 "selfDestruct" ,
273273 FunctionType :: new( vec![ ValueType :: I32 ] , None ) ,
274274 ) ,
275- ] . iter ( )
275+ ]
276+ . iter ( )
276277 . cloned ( )
277278 . collect ( ) ,
278279 require_all : false ,
@@ -389,32 +390,40 @@ impl<'a> ImportCheck for ImportType<'a> {
389390 {
390391 match entry. external ( ) {
391392 // 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+ }
395400 } else {
396401 ImportStatus :: Malformed
397402 }
398- } else {
399- ImportStatus :: Malformed
400- } ,
403+ }
401404 // NOTE: There may be a better way to do mappings between enum variants.
402405 // 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+ }
418427 }
419428 } else {
420429 ImportStatus :: NotFound
@@ -777,7 +786,8 @@ mod tests {
777786 "ethereum" ,
778787 "storageStore" ,
779788 FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
780- ) ] . iter ( )
789+ ) ]
790+ . iter ( )
781791 . cloned ( )
782792 . collect ( ) ,
783793 allow_unlisted : false ,
@@ -814,7 +824,8 @@ mod tests {
814824 "ethereum" ,
815825 "storageStore" ,
816826 FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
817- ) ] . iter ( )
827+ ) ]
828+ . iter ( )
818829 . cloned ( )
819830 . collect ( ) ,
820831 allow_unlisted : true ,
@@ -851,7 +862,8 @@ mod tests {
851862 "ethereum" ,
852863 "storageStore" ,
853864 FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
854- ) ] . iter ( )
865+ ) ]
866+ . iter ( )
855867 . cloned ( )
856868 . collect ( ) ,
857869 allow_unlisted : false ,
@@ -888,7 +900,8 @@ mod tests {
888900 "ethereum" ,
889901 "storageStore" ,
890902 FunctionType :: new( vec![ ValueType :: I32 , ValueType :: I32 ] , None ) ,
891- ) ] . iter ( )
903+ ) ]
904+ . iter ( )
892905 . cloned ( )
893906 . collect ( ) ,
894907 allow_unlisted : false ,
0 commit comments