The Deferred of async is dropped, so its result is never awaited
What it finds
async { work() } as a statement computes a value nobody reads. launch says that no result is wanted; with async, a failure stays in the dropped Deferred until the scope fails, which reads like a bug in either case.
From the rule's source, dropped_deferred.rs.
import kotlinx.coroutines.* suspend fun loadAll() = coroutineScope { async { load(1) }tx0 reports: the result of async is dropped val second = async { load(2) } launch { load(3) } second.await()} fun CoroutineScope.last() { val values = listOf(1, 2).map { async { load(it) } }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/kotlin:dropped-async-result" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/kotlin:dropped-async-result] reason="..."tx0 explain tx0/kotlin:dropped-async-result shows the same in the terminal. Found a false positive? Report it.