本頁尚未翻譯,以下為英文原文。
#E0099: unreachable match arm
Earlier arms already match every value this arm matches, so it never runs. Remove it, or move it before the arm that covers it.
nabi
let n = 1;
let r = match n {
_ => 0,
1 => 1,
};
error[E0099]: unreachable match arm 2: earlier arms already match every value it matches --> main.nabi:4:10 | 4 | 1 => 1, | ^
Move the catch-all arm last:
nabi
let n = 1;
let r = match n {
1 => 1,
_ => 0,
};
println(f"{r}");
1
Related: E0098 non-exhaustive match
Found a mistake? Edit this page on GitHub. Last updated