Lyricdev
GitHub

LYR-SEM0071

a local that is never used

warning · spec 07-statements · lint unused-variable, group unused, warn unless said

A local binding, loop variable, catch binding or pattern binding is never read after it is declared.

Explanation

A name nobody reads is usually a mistake: a value computed and forgotten, or a typo in a later use. Parameters, binders named _, and shorthand field patterns such as Rect { w, h } are exempt.

Use the value, or name the binding _ when it is deliberately unused. @Allow or [lints] allow in the manifest take the warning back where it is intended.

Wrong

fn main(): void {
    let count = 3;
}
import std.io { println };

fn main(): void {
    let count = 3;
    println(count);
}