Skip to content

or_patterns: unused_parens lints erroneously on _a @ (0 | 1) #64106

Closed
@Centril

Description

@Centril
#![feature(or_patterns)]
#![allow(incomplete_features)]

fn foo() {
    match 0 {
        _a @ (0 | 1) => {}
        _ => {}
    }

    let () = 0; // Prevent the ICE in MIR.
}

results in:

warning: unnecessary parentheses around pattern
 --> src/lib.rs:6:14
  |
6 |         _a @ (0 | 1) => {}
  |              ^^^^^^^ help: remove these parentheses
  |
  = note: `#[warn(unused_parens)]` on by default

changing things into _a @ (0 | 1) will correctly refuse to parse.

cc @dlrobertson #54883

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.F-or_patterns`#![feature(or_patterns)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions