-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
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-postfix_match`#![feature(postfix_match)]``#![feature(postfix_match)]`S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.
Description
cc #121618.
I tried this code:
#![feature(postfix_match)]
fn main() {
(&1).match { a => a };
(1 + 2).match { b => b };
}
I expected to see this happen: no warnings
Instead, this happened:
warning: unnecessary parentheses around `match` scrutinee expression
--> src/main.rs:3:5
|
3 | (&1).match { a => a };
| ^ ^
|
= note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
|
3 - (&1).match { a => a };
3 + &1.match { a => a };
|
warning: unnecessary parentheses around `match` scrutinee expression
--> src/main.rs:4:5
|
4 | (1 + 2).match { b => b };
| ^ ^
|
help: remove these parentheses
|
4 - (1 + 2).match { b => b };
4 + 1 + 2.match { b => b };
|
warning: `playground` (bin "playground") generated 2 warnings (run `cargo fix --bin "playground"` to apply 2 suggestions)
Meta
rustc --version --verbose
:
1.79.0-nightly (2024-03-24 0824b300eb0dae5d9ed5)
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-postfix_match`#![feature(postfix_match)]``#![feature(postfix_match)]`S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.