本页尚未翻译,以下为英文原文。
#E0131: lint
A lint finding: code that compiles but is likely a mistake. Its note names the lint (#[warn(name)], the JSON lint field). Fix the code, or allow the lint with #[allow(name)] or -A name; nabi lint --list describes every lint.
nabi
fn main() {
let total = 10;
let unused = 1;
println(f"{total}");
}
warning[E0131]: unused variable `unused` --> main.nabi:3:9 | 3 | let unused = 1; | ^^^^^^ | = note: if this is intentional, prefix it with an underscore: `_unused` = note: `#[warn(unused_variables)]` on by default
Remove the variable, or prefix it with _ if it is there on purpose:
nabi
fn main() {
let total = 10;
let _unused = 1;
println(f"{total}");
}
10
Every lint shares this code. Lints are warnings by default; they become errors with deny (in nabi.nabion, with -D on the command line, or with #[deny(..)] in source). The last note names the lint and where its level was set (6.2.9). See chapter 16 for setting levels.
Found a mistake? Edit this page on GitHub. Last updated