Back to Intellij Community

RedundantLabel

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/RedundantLabel.html

2025.3-rc-2413 B
Original Source

Reports redundant labels that cannot be referenced from 'break', 'continue' or 'return' statements.

Such labels can be safely removed.

Example:

fun foo(c: Boolean) {
    b@ while (true) a@ {
        while (true) {
            break@b
        }
    }
}

After the quick fix is applied:

fun foo(c: Boolean) {
    b@ while (true) {
        while (true) {
            break@b
        }
    }
}