File tree Expand file tree Collapse file tree 5 files changed +10
-14
lines changed Expand file tree Collapse file tree 5 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -60,8 +60,7 @@ pub mod boot_util {
60
60
pub fn boot_code_id ( name : & str , mainnet : bool ) -> QualifiedContractIdentifier {
61
61
let addr = boot_code_addr ( mainnet) ;
62
62
QualifiedContractIdentifier :: new (
63
- addr. try_into ( )
64
- . expect ( "FATAL: boot contract addr is not a legal principal" ) ,
63
+ addr. into ( ) ,
65
64
ContractName :: try_from ( name. to_string ( ) )
66
65
. expect ( "FATAL: boot contract name is not a legal ContractName" ) ,
67
66
)
Original file line number Diff line number Diff line change @@ -2140,8 +2140,8 @@ mod test {
2140
2140
// not simply rollback the tx and squelch the error as includable.
2141
2141
let e = env
2142
2142
. stx_transfer (
2143
- & PrincipalData :: try_from ( u1) . unwrap ( ) ,
2144
- & PrincipalData :: try_from ( u2) . unwrap ( ) ,
2143
+ & PrincipalData :: from ( u1) ,
2144
+ & PrincipalData :: from ( u2) ,
2145
2145
1000 ,
2146
2146
& BuffData :: empty ( ) ,
2147
2147
)
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ impl From<&StacksPrivateKey> for StandardPrincipalData {
108
108
& vec ! [ StacksPublicKey :: from_private( o) ] ,
109
109
)
110
110
. unwrap ( ) ;
111
- StandardPrincipalData :: try_from ( stacks_addr) . unwrap ( )
111
+ StandardPrincipalData :: from ( stacks_addr)
112
112
}
113
113
}
114
114
Original file line number Diff line number Diff line change @@ -430,7 +430,7 @@ fn test_secp256k1() {
430
430
)
431
431
. unwrap ( ) ;
432
432
eprintln ! ( "addr from privk {:?}" , & addr) ;
433
- let principal = addr. try_into ( ) . unwrap ( ) ;
433
+ let principal = addr. into ( ) ;
434
434
if let PrincipalData :: Standard ( data) = principal {
435
435
eprintln ! ( "test_secp256k1 principal {:?}" , data. to_address( ) ) ;
436
436
}
@@ -446,7 +446,7 @@ fn test_secp256k1() {
446
446
)
447
447
. unwrap ( ) ;
448
448
eprintln ! ( "addr from hex {:?}" , addr) ;
449
- let principal: PrincipalData = addr. try_into ( ) . unwrap ( ) ;
449
+ let principal: PrincipalData = addr. into ( ) ;
450
450
if let PrincipalData :: Standard ( data) = principal. clone ( ) {
451
451
eprintln ! ( "test_secp256k1 principal {:?}" , data. to_address( ) ) ;
452
452
}
@@ -491,8 +491,7 @@ fn test_principal_of_fix() {
491
491
. unwrap( ) ] ,
492
492
)
493
493
. unwrap ( )
494
- . try_into ( )
495
- . unwrap ( ) ;
494
+ . into ( ) ;
496
495
let testnet_principal: PrincipalData = StacksAddress :: from_public_keys (
497
496
C32_ADDRESS_VERSION_TESTNET_SINGLESIG ,
498
497
& AddressHashMode :: SerializeP2PKH ,
@@ -503,8 +502,7 @@ fn test_principal_of_fix() {
503
502
. unwrap( ) ] ,
504
503
)
505
504
. unwrap ( )
506
- . try_into ( )
507
- . unwrap ( ) ;
505
+ . into ( ) ;
508
506
509
507
// Clarity2, mainnet, should have a mainnet principal.
510
508
assert_eq ! (
Original file line number Diff line number Diff line change @@ -1531,9 +1531,8 @@ impl From<StandardPrincipalData> for StacksAddress {
1531
1531
fn from ( o : StandardPrincipalData ) -> StacksAddress {
1532
1532
// should be infallible because it's impossible to construct a StandardPrincipalData with
1533
1533
// an unsupported version byte
1534
- StacksAddress :: new ( o. version ( ) , hash:: Hash160 ( o. 1 ) ) . unwrap_or_else ( |_| {
1535
- panic ! ( "FATAL: could not convert a StandardPrincipalData to StacksAddress" )
1536
- } )
1534
+ StacksAddress :: new ( o. version ( ) , hash:: Hash160 ( o. 1 ) )
1535
+ . expect ( "FATAL: could not convert a StandardPrincipalData to StacksAddress" )
1537
1536
}
1538
1537
}
1539
1538
You can’t perform that action at this time.
0 commit comments