@@ -151,7 +151,7 @@ impl Config {
151
151
pub struct Transaction < ' conn > {
152
152
conn : & ' conn Connection ,
153
153
depth : u32 ,
154
- savepoint_name : Option < & ' conn str > ,
154
+ savepoint_name : Option < String > ,
155
155
commit : Cell < bool > ,
156
156
finished : bool ,
157
157
}
@@ -198,11 +198,11 @@ impl<'conn> Transaction<'conn> {
198
198
let mut conn = self . conn . conn . borrow_mut ( ) ;
199
199
debug_assert ! ( self . depth == conn. trans_depth) ;
200
200
conn. trans_depth -= 1 ;
201
- match ( self . commit . get ( ) , self . savepoint_name ) {
202
- ( false , Some ( savepoint_name) ) => conn. quick_query ( & format ! ( "ROLLBACK TO {}" , savepoint_name) ) ,
203
- ( false , None ) => conn. quick_query ( "ROLLBACK" ) ,
204
- ( true , Some ( savepoint_name) ) => conn. quick_query ( & format ! ( "RELEASE {}" , savepoint_name) ) ,
205
- ( true , None ) => conn. quick_query ( "COMMIT" ) ,
201
+ match ( self . commit . get ( ) , & self . savepoint_name ) {
202
+ ( false , & Some ( ref savepoint_name) ) => conn. quick_query ( & format ! ( "ROLLBACK TO {}" , savepoint_name) ) ,
203
+ ( false , & None ) => conn. quick_query ( "ROLLBACK" ) ,
204
+ ( true , & Some ( ref savepoint_name) ) => conn. quick_query ( & format ! ( "RELEASE {}" , savepoint_name) ) ,
205
+ ( true , & None ) => conn. quick_query ( "COMMIT" ) ,
206
206
} . map ( |_| ( ) )
207
207
}
208
208
@@ -249,7 +249,7 @@ impl<'conn> Transaction<'conn> {
249
249
/// # Panics
250
250
///
251
251
/// Panics if there is an active nested transaction.
252
- pub fn savepoint < ' a > ( & ' a self , name : & ' a str ) -> Result < Transaction < ' a > > {
252
+ pub fn savepoint < ' a > ( & ' a self , name : & str ) -> Result < Transaction < ' a > > {
253
253
let mut conn = self . conn . conn . borrow_mut ( ) ;
254
254
check_desync ! ( conn) ;
255
255
assert ! ( conn. trans_depth == self . depth,
@@ -259,7 +259,7 @@ impl<'conn> Transaction<'conn> {
259
259
Ok ( Transaction {
260
260
conn : self . conn ,
261
261
depth : self . depth + 1 ,
262
- savepoint_name : Some ( name) ,
262
+ savepoint_name : Some ( name. to_owned ( ) ) ,
263
263
commit : Cell :: new ( false ) ,
264
264
finished : false ,
265
265
} )
0 commit comments