KT-12019 Highlighting of redundant 'if' statements (#871)
This commit is contained in:
committed by
Dmitry Jemerov
parent
cf56ac0305
commit
bb32c2d350
@@ -0,0 +1,18 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>redundantIf.kt</file>
|
||||
<line>2</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="redundantIf.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant 'if' statement</problem_class>
|
||||
<description>Redundant 'if' statement</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>redundantIf.kt</file>
|
||||
<line>10</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="redundantIf.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant 'if' statement</problem_class>
|
||||
<description>Redundant 'if' statement</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.RedundantIfInspection
|
||||
@@ -0,0 +1,11 @@
|
||||
fun foo() {
|
||||
if (value % 2 == 0) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
if (value % 2 == 0) return true else return false
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.RedundantIfInspection
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Remove redundant 'if' statement" "true"
|
||||
fun bar() {
|
||||
<caret>if (value % 2 == 0) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// "Remove redundant 'if' statement" "true"
|
||||
fun bar() {
|
||||
return value % 2 == 0
|
||||
}
|
||||
Reference in New Issue
Block a user