@@ -1028,9 +1028,7 @@ impl Connection {
10281028 pub fn transaction < ' a > ( & ' a self ) -> Result < Transaction < ' a > > {
10291029 let mut conn = self . conn . borrow_mut ( ) ;
10301030 check_desync ! ( conn) ;
1031- if conn. trans_depth != 0 {
1032- panic ! ( "`transaction` must be called on the active transaction" ) ;
1033- }
1031+ assert ! ( conn. trans_depth == 0 , "`transaction` must be called on the active transaction" ) ;
10341032 try!( conn. quick_query ( "BEGIN" ) ) ;
10351033 conn. trans_depth += 1 ;
10361034 Ok ( Transaction {
@@ -1230,9 +1228,8 @@ impl<'conn> Transaction<'conn> {
12301228 pub fn transaction < ' a > ( & ' a self ) -> Result < Transaction < ' a > > {
12311229 let mut conn = self . conn . conn . borrow_mut ( ) ;
12321230 check_desync ! ( conn) ;
1233- if conn. trans_depth != self . depth {
1234- panic ! ( "`transaction` may only be called on the active transaction" ) ;
1235- }
1231+ assert ! ( conn. trans_depth == self . depth, "`transaction` may only be called on the active \
1232+ transaction") ;
12361233 try!( conn. quick_query ( "SAVEPOINT sp" ) ) ;
12371234 conn. trans_depth += 1 ;
12381235 Ok ( Transaction {
@@ -1493,15 +1490,13 @@ impl<'conn> Statement<'conn> {
14931490 params : & [ & ToSql ] ,
14941491 row_limit : i32 )
14951492 -> Result < LazyRows < ' trans , ' stmt > > {
1496- if self . conn as * const _ != trans. conn as * const _ {
1497- panic ! ( "the `Transaction` passed to `lazy_query` must be associated with the same \
1498- `Connection` as the `Statement`") ;
1499- }
1493+ assert ! ( self . conn as * const _ == trans. conn as * const _,
1494+ "the `Transaction` passed to `lazy_query` must be associated with the same \
1495+ `Connection` as the `Statement`") ;
15001496 let conn = self . conn . conn . borrow ( ) ;
15011497 check_desync ! ( conn) ;
1502- if conn. trans_depth != trans. depth {
1503- panic ! ( "`lazy_query` may only be called on the active transaction" ) ;
1504- }
1498+ assert ! ( conn. trans_depth == trans. depth,
1499+ "`lazy_query` may only be called on the active transaction" ) ;
15051500 drop ( conn) ;
15061501
15071502 let id = self . next_portal_id . get ( ) ;
0 commit comments