Lyricdev
GitHub

LYR-SEM0201

a declaration nothing uses

warning · spec 04-modules · lint dead-code, group unused, warn unless said

A declaration of a module that is not pub and carries no attribute is named nowhere in the compilation. main is not reported.

Explanation

A function, type or alias nothing uses is code to read and keep that does nothing. Another package cannot reach it: it is not pub.

Take it out, or make it pub where another package is meant to use it. A declaration with an attribute (@Test, @Bench, …) is used by what reads the attribute, and is not reported.

Wrong

fn helper(): int {
    return 1;
}

fn main(): void {
}
fn helper(): int {
    return 1;
}

fn main(): void {
    let _ = helper();
}