Pattern: Use of verbose function body
Issue: -
Functions which only contain a return
statement can be collapsed to an expression body. This shortens and cleans up the code.
Example of incorrect code:
fun stuff(): Int {
return 5
}
Example of correct code:
fun stuff() = 5
fun stuff() {
return
moreStuff()
.getStuff()
.stuffStuff()
}