@@ -155,24 +155,20 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
155
155
let p2 = execute ( "'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G" ) ;
156
156
let p3 = execute ( "'SP3X6QWWETNBZWGBK6DRGTR1KX50S74D3433WDGJY" ) ;
157
157
158
- let p1_std_principal_data = match p1 {
159
- Value :: Principal ( PrincipalData :: Standard ( ref data) ) => data. clone ( ) ,
160
- _ => panic ! ( ) ,
158
+ let Value :: Principal ( PrincipalData :: Standard ( p1_std_principal_data) ) = p1. clone ( ) else {
159
+ panic ! ( "Expected standard principal data" ) ;
161
160
} ;
162
161
163
- let p1_principal = match p1 {
164
- Value :: Principal ( ref data) => data. clone ( ) ,
165
- _ => panic ! ( ) ,
162
+ let Value :: Principal ( p1_principal) = p1. clone ( ) else {
163
+ panic ! ( "Expected principal data" ) ;
166
164
} ;
167
165
168
- let p2_principal = match p2 {
169
- Value :: Principal ( ref data) => data. clone ( ) ,
170
- _ => panic ! ( ) ,
166
+ let Value :: Principal ( p2_principal) = p2. clone ( ) else {
167
+ panic ! ( "Expected principal data" ) ;
171
168
} ;
172
169
173
- let p3_principal = match p3 {
174
- Value :: Principal ( ref data) => data. clone ( ) ,
175
- _ => panic ! ( ) ,
170
+ let Value :: Principal ( p3_principal) = p3. clone ( ) else {
171
+ panic ! ( "Expected principal data" ) ;
176
172
} ;
177
173
178
174
let token_contract_id =
@@ -212,7 +208,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
212
208
. unwrap ( ) ;
213
209
214
210
assert ! ( is_err_code( & result, 3 ) ) ;
215
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
211
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
216
212
217
213
let ( result, asset_map, _events) = execute_transaction (
218
214
& mut owned_env,
@@ -224,7 +220,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
224
220
. unwrap ( ) ;
225
221
226
222
assert ! ( is_err_code( & result, 3 ) ) ;
227
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
223
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
228
224
229
225
// test 2: from = to
230
226
@@ -238,7 +234,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
238
234
. unwrap ( ) ;
239
235
240
236
assert ! ( is_err_code( & result, 2 ) ) ;
241
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
237
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
242
238
243
239
// test 3: sender is not tx-sender
244
240
@@ -252,7 +248,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
252
248
. unwrap ( ) ;
253
249
254
250
assert ! ( is_err_code( & result, 4 ) ) ;
255
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
251
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
256
252
257
253
let ( result, asset_map, _events) = execute_transaction (
258
254
& mut owned_env,
@@ -264,7 +260,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
264
260
. unwrap ( ) ;
265
261
266
262
assert ! ( is_err_code( & result, 4 ) ) ;
267
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
263
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
268
264
269
265
// test 4: amount > balance
270
266
@@ -278,7 +274,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
278
274
. unwrap ( ) ;
279
275
280
276
assert ! ( is_err_code( & result, 1 ) ) ;
281
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
277
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
282
278
283
279
let ( result, asset_map, _events) = execute_transaction (
284
280
& mut owned_env,
@@ -290,7 +286,7 @@ fn test_native_stx_ops(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnvi
290
286
. unwrap ( ) ;
291
287
292
288
assert ! ( is_err_code( & result, 1 ) ) ;
293
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
289
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
294
290
295
291
// test 5: overflow
296
292
// NOTE: this tested behavior is no longer reachable: the total liquid ustx supply
@@ -525,19 +521,16 @@ fn test_simple_token_system(
525
521
let p1 = execute ( "'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR" ) ;
526
522
let p2 = execute ( "'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G" ) ;
527
523
528
- let p1_std_principal_data = match p1 {
529
- Value :: Principal ( PrincipalData :: Standard ( ref data) ) => data. clone ( ) ,
530
- _ => panic ! ( ) ,
524
+ let Value :: Principal ( PrincipalData :: Standard ( p1_std_principal_data) ) = p1. clone ( ) else {
525
+ panic ! ( "Expected standard pincipal data" ) ;
531
526
} ;
532
527
533
- let p1_principal = match p1 {
534
- Value :: Principal ( ref data) => data. clone ( ) ,
535
- _ => panic ! ( ) ,
528
+ let Value :: Principal ( p1_principal) = p1. clone ( ) else {
529
+ panic ! ( "Expected principal data" ) ;
536
530
} ;
537
531
538
- let p2_principal = match p2 {
539
- Value :: Principal ( ref data) => data. clone ( ) ,
540
- _ => panic ! ( ) ,
532
+ let Value :: Principal ( p2_principal) = p2. clone ( ) else {
533
+ panic ! ( "Expected principal data" ) ;
541
534
} ;
542
535
543
536
let token_contract_id =
@@ -569,7 +562,7 @@ fn test_simple_token_system(
569
562
. unwrap ( ) ;
570
563
assert ! ( !is_committed( & result) ) ;
571
564
572
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
565
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
573
566
574
567
let ( result, asset_map, _events) = execute_transaction (
575
568
& mut owned_env,
@@ -597,7 +590,7 @@ fn test_simple_token_system(
597
590
. unwrap ( ) ;
598
591
599
592
assert ! ( is_err_code( & result, 1 ) ) ;
600
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
593
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
601
594
602
595
let ( result, asset_map, _events) = execute_transaction (
603
596
& mut owned_env,
@@ -609,7 +602,7 @@ fn test_simple_token_system(
609
602
. unwrap ( ) ;
610
603
611
604
assert ! ( is_err_code( & result, 2 ) ) ;
612
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
605
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
613
606
614
607
let err = execute_transaction (
615
608
& mut owned_env,
@@ -635,7 +628,7 @@ fn test_simple_token_system(
635
628
. unwrap ( ) ;
636
629
637
630
assert_eq ! ( result, Value :: UInt ( 1000 ) ) ;
638
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
631
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
639
632
640
633
let ( result, asset_map, _events) = execute_transaction (
641
634
& mut owned_env,
@@ -647,7 +640,7 @@ fn test_simple_token_system(
647
640
. unwrap ( ) ;
648
641
649
642
assert_eq ! ( result, Value :: UInt ( 9200 ) ) ;
650
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
643
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
651
644
652
645
let ( result, asset_map, _events) = execute_transaction (
653
646
& mut owned_env,
@@ -814,7 +807,7 @@ fn test_simple_token_system(
814
807
. unwrap ( ) ;
815
808
816
809
assert ! ( !is_committed( & result) ) ;
817
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
810
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
818
811
}
819
812
820
813
#[ apply( test_epochs) ]
@@ -836,14 +829,12 @@ fn test_total_supply(epoch: StacksEpochId, mut env_factory: TopLevelMemoryEnviro
836
829
837
830
let p1 = execute ( "'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR" ) ;
838
831
839
- let p1_std_principal_data = match p1 {
840
- Value :: Principal ( PrincipalData :: Standard ( ref data) ) => data. clone ( ) ,
841
- _ => panic ! ( ) ,
832
+ let Value :: Principal ( PrincipalData :: Standard ( p1_std_principal_data) ) = p1. clone ( ) else {
833
+ panic ! ( "Expected standard principal data" ) ;
842
834
} ;
843
835
844
- let p1_principal = match p1 {
845
- Value :: Principal ( ref data) => data. clone ( ) ,
846
- _ => panic ! ( ) ,
836
+ let Value :: Principal ( p1_principal) = p1. clone ( ) else {
837
+ panic ! ( "Expected principal data" ) ;
847
838
} ;
848
839
849
840
let token_contract_id =
@@ -939,9 +930,8 @@ fn test_overlapping_nfts(
939
930
940
931
let p1 = execute ( "'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR" ) ;
941
932
942
- let p1_std_principal_data = match p1 {
943
- Value :: Principal ( PrincipalData :: Standard ( ref data) ) => data. clone ( ) ,
944
- _ => panic ! ( ) ,
933
+ let Value :: Principal ( PrincipalData :: Standard ( p1_std_principal_data) ) = p1 else {
934
+ panic ! ( "Expected standard principal data" ) ;
945
935
} ;
946
936
947
937
let tokens_contract_id =
@@ -991,19 +981,16 @@ fn test_simple_naming_system(
991
981
let p1 = execute ( "'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR" ) ;
992
982
let p2 = execute ( "'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G" ) ;
993
983
994
- let p1_std_principal_data = match p1 {
995
- Value :: Principal ( PrincipalData :: Standard ( ref data) ) => data. clone ( ) ,
996
- _ => panic ! ( ) ,
984
+ let Value :: Principal ( PrincipalData :: Standard ( p1_std_principal_data) ) = p1. clone ( ) else {
985
+ panic ! ( "Expected standard principal data" ) ;
997
986
} ;
998
987
999
- let p1_principal = match p1 {
1000
- Value :: Principal ( ref data) => data. clone ( ) ,
1001
- _ => panic ! ( ) ,
988
+ let Value :: Principal ( p1_principal) = p1. clone ( ) else {
989
+ panic ! ( "Expected principal data" ) ;
1002
990
} ;
1003
991
1004
- let p2_principal = match p2 {
1005
- Value :: Principal ( ref data) => data. clone ( ) ,
1006
- _ => panic ! ( ) ,
992
+ let Value :: Principal ( p2_principal) = p2. clone ( ) else {
993
+ panic ! ( "Expected principal data" ) ;
1007
994
} ;
1008
995
1009
996
let placeholder_context =
@@ -1126,7 +1113,7 @@ fn test_simple_naming_system(
1126
1113
)
1127
1114
. unwrap ( ) ;
1128
1115
assert ! ( is_err_code( & result, 0 ) ) ;
1129
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1116
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1130
1117
1131
1118
let ( result, asset_map, _events) = execute_transaction (
1132
1119
& mut owned_env,
@@ -1157,7 +1144,7 @@ fn test_simple_naming_system(
1157
1144
. unwrap ( ) ;
1158
1145
1159
1146
assert ! ( is_err_code( & result, 1 ) ) ;
1160
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1147
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1161
1148
1162
1149
let ( result, asset_map, _events) = execute_transaction (
1163
1150
& mut owned_env,
@@ -1169,7 +1156,7 @@ fn test_simple_naming_system(
1169
1156
. unwrap ( ) ;
1170
1157
1171
1158
assert ! ( is_committed( & result) ) ;
1172
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1159
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1173
1160
1174
1161
// let's transfer name
1175
1162
@@ -1183,7 +1170,7 @@ fn test_simple_naming_system(
1183
1170
. unwrap ( ) ;
1184
1171
1185
1172
assert ! ( is_err_code( & result, 3 ) ) ;
1186
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1173
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1187
1174
1188
1175
let ( result, asset_map, _events) = execute_transaction (
1189
1176
& mut owned_env,
@@ -1195,7 +1182,7 @@ fn test_simple_naming_system(
1195
1182
. unwrap ( ) ;
1196
1183
1197
1184
assert ! ( is_err_code( & result, 1 ) ) ;
1198
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1185
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1199
1186
1200
1187
let ( result, asset_map, _events) = execute_transaction (
1201
1188
& mut owned_env,
@@ -1207,7 +1194,7 @@ fn test_simple_naming_system(
1207
1194
. unwrap ( ) ;
1208
1195
1209
1196
assert ! ( is_err_code( & result, 2 ) ) ;
1210
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1197
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1211
1198
1212
1199
let ( result, asset_map, _events) = execute_transaction (
1213
1200
& mut owned_env,
@@ -1314,7 +1301,7 @@ fn test_simple_naming_system(
1314
1301
. unwrap ( ) ;
1315
1302
1316
1303
assert ! ( is_committed( & result) ) ;
1317
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1304
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1318
1305
1319
1306
// p2 burning 8 (which belongs to p1) should succeed even though sender != tx_sender.
1320
1307
let ( result, asset_map, _events) = execute_transaction (
@@ -1375,7 +1362,7 @@ fn test_simple_naming_system(
1375
1362
. unwrap ( ) ;
1376
1363
1377
1364
assert ! ( is_committed( & result) ) ;
1378
- assert_eq ! ( asset_map. to_table( ) . len ( ) , 0 ) ;
1365
+ assert ! ( asset_map. to_table( ) . is_empty ( ) ) ;
1379
1366
1380
1367
{
1381
1368
let mut env = owned_env. get_exec_environment ( None , None , & placeholder_context) ;
0 commit comments