W0003
Warning
todo left in the program
WarningA todo marks code that is not written yet. It panics when it runs, with the message not yet implemented, or not yet implemented: <message> for todo("message"). The warning points at each todo, and the program still builds.
Why
A todo lets a function type-check before its body exists: it is an expression of type never, so it stands in for any value. A program that still holds one builds, but it should not ship that way, so the compiler says where each one is. Rust's todo!() does not warn, and Clippy's todo lint is off by default; Sisu warns because the next run that reaches the todo will fail.
Broken
fn area(width: i64, height: i64) -> i64 {
todo("multiply")
}
fn main() {
print(area(2, 3))
}
What sisu says
warning[W0003]: `todo` panics when it runs --> W0003.sisu:2:5 | 2 | todo("multiply") | ^^^^ sisu: 1 warning sisu: for more on a code, run `sisu explain <code>`: W0003
Fixed
fn area(width: i64, height: i64) -> i64 {
width * height
}
fn main() {
print(area(2, 3))
}
Sisu