W0008
Loop label that is never used
WarningSafe fixA loop label that no break or continue names is a warning, and the program still builds. The fix deletes the loop label, and its line break when it stands on a line of its own. A loop label that only a failed jump names is not reported: that jump's error is.
Why
A loop label tells a reader that a jump inside the loop names it. One that no jump names is left over from an edit, or belongs to a break or continue that lost its loop label. Deleting it changes nothing the program does.
Broken
fn main() {
outer: for x in [1, 2] {
print(x)
}
}
What sisu says
warning[W0008]: loop label `outer` is never used --> W0008.sisu:2:5 | 2 | outer: for x in [1, 2] { | ^^^^^ | = help: delete the loop label, or name it in a `break` or `continue` help: delete the loop label | 2 - outer: for x in [1, 2] { 2 + for x in [1, 2] { | sisu: 1 warning sisu: for more on a code, run `sisu explain <code>`: W0008
Fixed
fn main() {
for x in [1, 2] {
print(x)
}
}
Sisu