or_patterns: unused_parens lints erroneously on _a @ (0 | 1) (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Assignees

Centril

@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

Labels

Development

No branches or pull requests

Issue actions