LYR-SEM0178
the value of a '@MustUse' call is dropped
An expression statement drops the non-void value of a call to a function marked @MustUse, or a value whose type is marked @MustUse (such as a Result or a task handle from std.task.spawn).
Explanation
@MustUse says that ignoring the value is almost always a mistake: a Result carries an error, a task handle is the only way to the task's error. A call written as a statement throws that value away without a word.
Use the value, or drop it on purpose with let _ = ….
Wrong
@MustUse
fn token(): int {
return 7;
}
fn main(): void {
token();
}
Right
@MustUse
fn token(): int {
return 7;
}
fn main(): void {
let _ = token();
}