KT.REDUNDANT_SUSPEND_MODIFIER

Usage of 'suspend' modifier

suspend modifier should only be used where needed, otherwise the function can only be used from other suspending functions. This needlessly restricts use of the function and should be avoided by removing the suspend modifier where it's not needed.

Noncompliant Code

Copy
suspend fun normalFunction() {
    println("string")
}

Compliant Code

Copy
fun normalFunction() {
    println("string")
}

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html