@@ -1572,21 +1572,13 @@ impl MutTxId {
1572
1572
let tx_row_ref = unsafe { tx_table. get_row_ref_unchecked ( tx_blob_store, tx_row_ptr) } ;
1573
1573
1574
1574
let err = ' error: {
1575
- // These two macros can be thought of as a `throw $e` and `$e? ` within `'error`.
1575
+ // This macros can be thought of as a `throw $e` within `'error`.
1576
1576
// TODO(centril): Get rid of this once we have stable `try` blocks or polonius.
1577
1577
macro_rules! throw {
1578
1578
( $e: expr) => {
1579
1579
break ' error $e. into( )
1580
1580
} ;
1581
1581
}
1582
- macro_rules! unwrap {
1583
- ( $e: expr) => {
1584
- match $e {
1585
- Ok ( x) => x,
1586
- Err ( e) => throw!( e) ,
1587
- }
1588
- } ;
1589
- }
1590
1582
1591
1583
// Check that the index exists and is unique.
1592
1584
// It's sufficient to check the committed state.
@@ -1618,15 +1610,16 @@ impl MutTxId {
1618
1610
} ;
1619
1611
// SAFETY: `commit_table.row_layout() == new_row.row_layout()` holds
1620
1612
// as the `tx_table` is derived from `commit_table`.
1621
- unwrap ! ( unsafe {
1613
+ if let Err ( e ) = unsafe {
1622
1614
commit_table. check_unique_constraints (
1623
1615
tx_row_ref,
1624
1616
// Don't check this index since we'll do a 1-1 old/new replacement.
1625
1617
|ixs| ixs. filter ( |( & id, _) | id != index_id) ,
1626
1618
is_deleted,
1627
1619
)
1620
+ } {
1621
+ throw ! ( IndexError :: from( e) ) ;
1628
1622
}
1629
- . map_err( IndexError :: from) ) ;
1630
1623
1631
1624
let tx_row_ptr = if let Some ( old_ptr) = commit_old_ptr {
1632
1625
// Row was found in the committed state!
@@ -1660,7 +1653,7 @@ impl MutTxId {
1660
1653
// in particular, the `write_gen_val_to_col` call does not remove the row.
1661
1654
// On error, `tx_row_ptr` has already been removed, so don't do it again.
1662
1655
let ( _, tx_row_ptr) =
1663
- unwrap ! ( unsafe { tx_table. confirm_insertion:: <false >( tx_blob_store, tx_row_ptr, blob_bytes) } ) ;
1656
+ unsafe { tx_table. confirm_insertion :: < false > ( tx_blob_store, tx_row_ptr, blob_bytes) } ? ;
1664
1657
1665
1658
// Delete the old row.
1666
1659
del_table. insert ( old_ptr) ;
@@ -1678,8 +1671,7 @@ impl MutTxId {
1678
1671
// SAFETY: `tx_table.is_row_present(tx_row_ptr)` and `tx_table.is_row_present(old_ptr)` both hold
1679
1672
// as we've deleted neither.
1680
1673
// In particular, the `write_gen_val_to_col` call does not remove the row.
1681
- let tx_row_ptr =
1682
- unwrap ! ( unsafe { tx_table. confirm_update( tx_blob_store, tx_row_ptr, old_ptr, blob_bytes) } ) ;
1674
+ let tx_row_ptr = unsafe { tx_table. confirm_update ( tx_blob_store, tx_row_ptr, old_ptr, blob_bytes) } ?;
1683
1675
1684
1676
if let Some ( old_commit_del_ptr) = old_commit_del_ptr {
1685
1677
// If we have an identical deleted row in the committed state,
0 commit comments