@@ -149,14 +149,13 @@ fn check_wasm_features(module: &Module, supported_features: &HashSet<String>) ->
149
149
mod tests {
150
150
use super :: * ;
151
151
use crate :: errors:: VmError ;
152
- use std:: iter:: FromIterator ;
153
152
154
153
static CONTRACT_0_6 : & [ u8 ] = include_bytes ! ( "../testdata/hackatom_0.6.wasm" ) ;
155
154
static CONTRACT_0_7 : & [ u8 ] = include_bytes ! ( "../testdata/hackatom_0.7.wasm" ) ;
156
155
static CONTRACT : & [ u8 ] = include_bytes ! ( "../testdata/hackatom.wasm" ) ;
157
156
158
157
fn default_features ( ) -> HashSet < String > {
159
- HashSet :: from_iter ( [ "staking" . to_string ( ) ] . iter ( ) . cloned ( ) )
158
+ [ "staking" . to_string ( ) ] . iter ( ) . cloned ( ) . collect ( )
160
159
}
161
160
162
161
#[ test]
@@ -277,7 +276,7 @@ mod tests {
277
276
#[ test]
278
277
fn check_wasm_exports_works ( ) {
279
278
// this is invalid, as it doesn't contain all required exports
280
- const WAT_MISSING_EXPORTS : & ' static str = r#"
279
+ const WAT_MISSING_EXPORTS : & str = r#"
281
280
(module
282
281
(type $t0 (func (param i32) (result i32)))
283
282
(func $add_one (export "add_one") (type $t0) (param $p0 i32) (result i32)
@@ -417,16 +416,15 @@ mod tests {
417
416
)
418
417
. unwrap ( ) ;
419
418
let module = deserialize_wasm ( & wasm) . unwrap ( ) ;
420
- let supported = HashSet :: from_iter (
421
- [
422
- "water" . to_string ( ) ,
423
- "nutrients" . to_string ( ) ,
424
- "sun" . to_string ( ) ,
425
- "freedom" . to_string ( ) ,
426
- ]
427
- . iter ( )
428
- . cloned ( ) ,
429
- ) ;
419
+ let supported = [
420
+ "water" . to_string ( ) ,
421
+ "nutrients" . to_string ( ) ,
422
+ "sun" . to_string ( ) ,
423
+ "freedom" . to_string ( ) ,
424
+ ]
425
+ . iter ( )
426
+ . cloned ( )
427
+ . collect ( ) ;
430
428
check_wasm_features ( & module, & supported) . unwrap ( ) ;
431
429
}
432
430
@@ -448,15 +446,14 @@ mod tests {
448
446
let module = deserialize_wasm ( & wasm) . unwrap ( ) ;
449
447
450
448
// Support set 1
451
- let supported = HashSet :: from_iter (
452
- [
453
- "water" . to_string ( ) ,
454
- "nutrients" . to_string ( ) ,
455
- "freedom" . to_string ( ) ,
456
- ]
457
- . iter ( )
458
- . cloned ( ) ,
459
- ) ;
449
+ let supported = [
450
+ "water" . to_string ( ) ,
451
+ "nutrients" . to_string ( ) ,
452
+ "freedom" . to_string ( ) ,
453
+ ]
454
+ . iter ( )
455
+ . cloned ( )
456
+ . collect ( ) ;
460
457
match check_wasm_features ( & module, & supported) . unwrap_err ( ) {
461
458
VmError :: StaticValidationErr { msg, .. } => assert_eq ! (
462
459
msg,
@@ -466,15 +463,14 @@ mod tests {
466
463
}
467
464
468
465
// Support set 2
469
- let supported = HashSet :: from_iter (
470
- [
471
- "nutrients" . to_string ( ) ,
472
- "freedom" . to_string ( ) ,
473
- "Water" . to_string ( ) , // features are case sensitive (and lowercase by convention)
474
- ]
475
- . iter ( )
476
- . cloned ( ) ,
477
- ) ;
466
+ let supported = [
467
+ "nutrients" . to_string ( ) ,
468
+ "freedom" . to_string ( ) ,
469
+ "Water" . to_string ( ) , // features are case sensitive (and lowercase by convention)
470
+ ]
471
+ . iter ( )
472
+ . cloned ( )
473
+ . collect ( ) ;
478
474
match check_wasm_features ( & module, & supported) . unwrap_err ( ) {
479
475
VmError :: StaticValidationErr { msg, .. } => assert_eq ! (
480
476
msg,
@@ -484,7 +480,7 @@ mod tests {
484
480
}
485
481
486
482
// Support set 3
487
- let supported = HashSet :: from_iter ( [ "freedom" . to_string ( ) ] . iter ( ) . cloned ( ) ) ;
483
+ let supported = [ "freedom" . to_string ( ) ] . iter ( ) . cloned ( ) . collect ( ) ;
488
484
match check_wasm_features ( & module, & supported) . unwrap_err ( ) {
489
485
VmError :: StaticValidationErr { msg, .. } => assert_eq ! (
490
486
msg,
@@ -494,7 +490,7 @@ mod tests {
494
490
}
495
491
496
492
// Support set 4
497
- let supported = HashSet :: from_iter ( [ ] . iter ( ) . cloned ( ) ) ;
493
+ let supported = [ ] . iter ( ) . cloned ( ) . collect ( ) ;
498
494
match check_wasm_features ( & module, & supported) . unwrap_err ( ) {
499
495
VmError :: StaticValidationErr { msg, .. } => assert_eq ! (
500
496
msg,
0 commit comments