From e62dcc4d25a323872676613bae5ff16c2cd747f1 Mon Sep 17 00:00:00 2001 From: argv-minus-one Date: Wed, 24 Mar 2021 12:47:18 -0700 Subject: [PATCH] Make the bounds on `Connection::transaction` less strict. The provided callback doesn't need to be `'static`. It should be enough that it doesn't borrow anything from the `Connection` itself, even if it does borrow data from elsewhere. --- sqlx-core/src/connection.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlx-core/src/connection.rs b/sqlx-core/src/connection.rs index 5313c6c7a7..402a198c9e 100644 --- a/sqlx-core/src/connection.rs +++ b/sqlx-core/src/connection.rs @@ -50,10 +50,10 @@ pub trait Connection: Send { /// })).await /// # } /// ``` - fn transaction(&mut self, callback: F) -> BoxFuture<'_, Result> + fn transaction<'a, F, R, E>(&'a mut self, callback: F) -> BoxFuture<'a, Result> where for<'c> F: FnOnce(&'c mut Transaction<'_, Self::Database>) -> BoxFuture<'c, Result> - + 'static + + 'a + Send + Sync, Self: Sized,