Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77181c4

Browse files
committed
Cleanup
1 parent 616b725 commit 77181c4

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/transaction.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,13 @@ impl<'conn> Transaction<'conn> {
199199
debug_assert!(self.depth == conn.trans_depth);
200200
conn.trans_depth -= 1;
201201
match (self.commit.get(), &self.savepoint_name) {
202-
(false, &Some(ref savepoint_name)) => conn.quick_query(&format!("ROLLBACK TO {}", savepoint_name)),
202+
(false, &Some(ref savepoint_name)) => {
203+
conn.quick_query(&format!("ROLLBACK TO {}", savepoint_name))
204+
}
203205
(false, &None) => conn.quick_query("ROLLBACK"),
204-
(true, &Some(ref savepoint_name)) => conn.quick_query(&format!("RELEASE {}", savepoint_name)),
206+
(true, &Some(ref savepoint_name)) => {
207+
conn.quick_query(&format!("RELEASE {}", savepoint_name))
208+
}
205209
(true, &None) => conn.quick_query("COMMIT"),
206210
}.map(|_| ())
207211
}
@@ -234,17 +238,18 @@ impl<'conn> Transaction<'conn> {
234238
self.conn.batch_execute(query)
235239
}
236240

237-
/// Like `Connection::transaction`, but creates a nested transaction.
241+
/// Like `Connection::transaction`, but creates a nested transaction via
242+
/// a savepoint.
238243
///
239244
/// # Panics
240245
///
241246
/// Panics if there is an active nested transaction.
242247
pub fn transaction<'a>(&'a self) -> Result<Transaction<'a>> {
243248
self.savepoint("sp")
244249
}
245-
246-
/// Like `Connection::transaction`, but creates a nested transaction
247-
/// with the provided name.
250+
251+
/// Like `Connection::transaction`, but creates a nested transaction via
252+
/// a savepoint with the specified name.
248253
///
249254
/// # Panics
250255
///

0 commit comments

Comments
 (0)