From 75ccb9f83080a9e22c8ab45af691fcb2a1d1639f Mon Sep 17 00:00:00 2001 From: Jack Ye Date: Wed, 23 Sep 2026 21:39:30 -0700 Subject: [PATCH] fix(python): detach background spawns with drop, not `let _` `cargo clippy --all-features --tests` fails on `clippy::let_underscore_future` for both spawns in `spawn_background`, which breaks the Rust lint job. It is failing on main as well, not just here, so the Node matrix never runs: fail-fast cancels it before it starts. Discarding a `JoinHandle` leaves the task running, which is what `spawn_background` is for, and the `OutstandingGuard` the task carries is what keeps it visible to `shutdown`. `drop` says that; `let _ =` reads as throwing away an unpolled future, which is what the lint is for. --- python/src/runtime.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/python/src/runtime.rs b/python/src/runtime.rs index 33ffd8bf9..8891e2bf2 100644 --- a/python/src/runtime.rs +++ b/python/src/runtime.rs @@ -208,13 +208,12 @@ where let _guard = guard; fut.await; }; + // Detaching is the point: dropping the `JoinHandle` leaves the task running, and the + // `OutstandingGuard` it carries is what keeps it visible to `shutdown`. Written as `drop` + // rather than `let _ =`, which reads as discarding an unpolled future. match runtime::Handle::try_current() { - Ok(handle) => { - let _ = handle.spawn(task); - } - Err(_) => { - let _ = get_runtime().spawn(task); - } + Ok(handle) => drop(handle.spawn(task)), + Err(_) => drop(get_runtime().spawn(task)), } }