Inspectopedia Help

'@Deferred' result is unused

Reports function calls with the Deferred result type if the return value is not used.

If the Deferred return value is not used, the call site would not wait to complete this function.

Example:

fun calcEverythingAsync() = CompletableDeferred(42) fun usage() { calcEverythingAsync() }

The quick-fix provides a variable with the Deferred initializer:

fun calcEverythingAsync() = CompletableDeferred(42) fun usage() { val answer = calcEverythingAsync() }

Inspection options

Here you can find the description of settings available for the '@Deferred' result is unused inspection, and the reference of their default values.

Report only function calls from 'kotlinx.coroutines'

Not selected

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Kotlin, 241.16690-IJ

Last modified: 29 April 2024