If a label is declared but not used in the program, it can be considered as dead code and should therefore be removed.
This will improve maintainability as developers will not wonder what this label is used for.
Noncompliant code example
void foo() {
outer: //label is not used.
for(int i = 0; i < 10; i++) {
break;
}
}
Compliant solution
void foo() {
for(int i = 0; i < 10; i++) {
break;
}
}