Lyricdev
GitHub

LYR-SEM0218

a 'return;' that ends a body

warning · spec 07-statements · lint needless-return, group style, allow unless said

The last statement of a function's or a lambda's body is return;. Not said unless the lint is set to warn.

Explanation

A body ends after its last statement; a return; there says nothing more. The lint is allow by default.

Take it out.

Wrong

@Warn("needless-return")
fn main(): void {
    let _ = 1;
    return;
}
@Warn("needless-return")
fn main(): void {
    let _ = 1;
}