-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.F-guard_patterns`#![feature(guard_patterns)]``#![feature(guard_patterns)]`L-unused_parensLint: unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-incomplete-featuresThis issue requires the use of incomplete features.This issue requires the use of incomplete features.
Description
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)
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.F-guard_patterns`#![feature(guard_patterns)]``#![feature(guard_patterns)]`L-unused_parensLint: unused_parensLint: unused_parensT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-incomplete-featuresThis issue requires the use of incomplete features.This issue requires the use of incomplete features.