Skip to content

Files

Latest commit

 

History

History
28 lines (18 loc) · 647 Bytes

RedundantSuspendModifier.md

File metadata and controls

28 lines (18 loc) · 647 Bytes

Pattern: Redundant suspend modifier

Issue: -

Description

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.

Example of incorrect code:

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

Example of correct code:

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

Further Reading