I tried this code:
#![feature(guard_patterns)]
#![expect(incomplete_features)]
fn main() {
let (_ if false) = ();
}
I expected to see this happen: no warnings.
Instead, this happened: unused parens warning:
warning: unnecessary parentheses around pattern
--> src/main.rs:5:9
|
5 | let (_ if false) = ();
| ^ ^
|
= note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
|
5 - let (_ if false) = ();
5 + let _ if false = ();
|
Note that removing parentheses makes the code not compile:
error: expected one of `:`, `;`, `=`, or `|`, found keyword `if`
--> src/main.rs:5:11
|
5 | let _ if false = ();
| ^^ expected one of `:`, `;`, `=`, or `|`
Meta
rustc version:
1.93.0-nightly (2025-12-02 646a3f8c15baefb98dc6)
I tried this code:
I expected to see this happen: no warnings.
Instead, this happened: unused parens warning:
Note that removing parentheses makes the code not compile:
Meta
rustcversion: