The Deferred of async is dropped, so its result is never awaited

tx0/kotlin:dropped-async-resultrecommendedwarningreliability/concurrencydepth fastsmell, concurrency

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.

Example from the rule's tests
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) } }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

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.