I tried this code:
fn main() {
match Some(42) {
Some(unused) if true => (),
_ => (),
}
}
I expected to see this happen: the compiler should warn that unused is unused.
Instead, this happened: the code compiles without any warnings, unless the if true part is removed.
Meta
rustc --version --verbose:
rustc 1.93.0 (254b59607 2026-01-19)
binary: rustc
commit-hash: 254b59607d4417e9dffbc307138ae5c86280fe4c
commit-date: 2026-01-19
host: x86_64-unknown-linux-gnu
release: 1.93.0
LLVM version: 21.1.8
I tried this code:
I expected to see this happen: the compiler should warn that
unusedis unused.Instead, this happened: the code compiles without any warnings, unless the
if truepart is removed.Meta
rustc --version --verbose: