Skip to content

Commit e23d880

Browse files
committed
fix: resolve additional clippy warnings
- Fix let_underscore_future by explicitly dropping the future - Remove unused type parameter DB from deadline_as_timeout function
1 parent be77046 commit e23d880

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

sqlx-core/src/pool/inner.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ impl<DB: Database> PoolInner<DB> {
142142

143143
if parent_close_event.as_mut().poll(cx).is_ready() {
144144
// Propagate the parent's close event to the child.
145-
// We can't await here, so we spawn the close future
146-
let close_future = self.close();
147-
sqlx_rt::spawn(async move {
148-
close_future.await;
149-
});
145+
// Note: We can't await the close future here, but it's fine
146+
// because close() is designed to be fire-and-forget
147+
drop(self.close());
150148
return Poll::Ready(Err(Error::PoolClosed));
151149
}
152150

@@ -291,10 +289,10 @@ impl<DB: Database> PoolInner<DB> {
291289
}
292290

293291
let mut backoff = Duration::from_millis(10);
294-
let max_backoff = deadline_as_timeout::<DB>(deadline)? / 5;
292+
let max_backoff = deadline_as_timeout(deadline)? / 5;
295293

296294
loop {
297-
let timeout = deadline_as_timeout::<DB>(deadline)?;
295+
let timeout = deadline_as_timeout(deadline)?;
298296

299297
// result here is `Result<Result<C, Error>, TimeoutError>`
300298
// if this block does not return, sleep for the backoff timeout and try again

sqlx-core/src/pool/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ impl FusedFuture for CloseEvent {
598598
/// get the time between the deadline and now and use that as our timeout
599599
///
600600
/// returns `Error::PoolTimedOut` if the deadline is in the past
601-
fn deadline_as_timeout<DB: Database>(deadline: Instant) -> Result<Duration, Error> {
601+
fn deadline_as_timeout(deadline: Instant) -> Result<Duration, Error> {
602602
deadline
603603
.checked_duration_since(Instant::now())
604604
.ok_or(Error::PoolTimedOut)

sqlx-core/src/postgres/listener.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,7 @@ impl<'c> Executor<'c> for &'c mut PgListener {
353353
.boxed()
354354
}
355355

356-
fn fetch_optional<'e, 'q: 'e, E>(
357-
self,
358-
query: E,
359-
) -> BoxFuture<'e, Result<Option<PgRow>, Error>>
356+
fn fetch_optional<'e, 'q: 'e, E>(self, query: E) -> BoxFuture<'e, Result<Option<PgRow>, Error>>
360357
where
361358
'c: 'e,
362359
E: Execute<'q, Self::Database> + 'q,

sqlx-macros/src/query/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ fn expand_from_db(input: QueryMacroInput, db_url: &str) -> crate::Result<TokenSt
246246
}
247247
// Variants depend on feature flags
248248
#[allow(unreachable_patterns)]
249-
item => {
250-
Err(format!("Missing expansion needed for: {:?}", item).into())
251-
}
249+
item => Err(format!("Missing expansion needed for: {:?}", item).into()),
252250
}
253251
})
254252
}

0 commit comments

Comments
 (0)