W0001
Unreachable code
WarningA statement that comes after one that never finishes, such as return,
break, continue, or an if whose branches all return, can never run. The
warning points at the first such statement in the block.
Why
Code that cannot run is almost always a mistake: a return written too
early, or a statement meant to come before a break. Sisu warns where the
source tells its reader something false, as it does for a let mut that never
changes (ADR 0011).
Broken
fn main() {
print(1)
return
print(2)
}
What sisu says
warning[W0001]: unreachable code --> W0001.sisu:4:5 | 4 | print(2) | ^^^^^^^^ sisu: 1 warning sisu: for more on a code, run `sisu explain <code>`: W0001
Fixed
fn main() {
print(1)
print(2)
}
Sisu