Style: do not highlight single return when as "Use expresison body"
This commit is contained in:
@@ -60,7 +60,7 @@ class UseExpressionBodyInspection(private val convertEmptyToUnit: Boolean) : Abs
|
|||||||
val toHighlight = valueStatement.toHighlight()
|
val toHighlight = valueStatement.toHighlight()
|
||||||
return when {
|
return when {
|
||||||
valueStatement !is KtReturnExpression -> Status(toHighlight, "block body", INFORMATION)
|
valueStatement !is KtReturnExpression -> Status(toHighlight, "block body", INFORMATION)
|
||||||
valueStatement.returnedExpression is KtWhenExpression -> Status(toHighlight, "'return when'", GENERIC_ERROR_OR_WARNING)
|
valueStatement.returnedExpression is KtWhenExpression -> Status(toHighlight, "'return when'", INFORMATION)
|
||||||
valueStatement.isOneLiner() -> Status(toHighlight, "one-line return", GENERIC_ERROR_OR_WARNING)
|
valueStatement.isOneLiner() -> Status(toHighlight, "one-line return", GENERIC_ERROR_OR_WARNING)
|
||||||
else -> Status(toHighlight, "return", INFORMATION)
|
else -> Status(toHighlight, "return", INFORMATION)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// HIGHLIGHT: INFORMATION
|
||||||
|
|
||||||
fun sign(x: Int): Int {
|
fun sign(x: Int): Int {
|
||||||
<caret>return when {
|
<caret>return when {
|
||||||
x < 0 -> -1
|
x < 0 -> -1
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// HIGHLIGHT: INFORMATION
|
||||||
|
|
||||||
fun sign(x: Int): Int = when {
|
fun sign(x: Int): Int = when {
|
||||||
x < 0 -> -1
|
x < 0 -> -1
|
||||||
x > 0 -> 1
|
x > 0 -> 1
|
||||||
|
|||||||
Reference in New Issue
Block a user