-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
False unused_braces lint warning when using non-proc macro #73068
Copy link
Copy link
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.L-unused_bracesLint: unused_bracesLint: unused_bracesT-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.
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.L-unused_bracesLint: unused_bracesLint: unused_bracesT-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
I expected to see this happen: No warnings, or applying hints from warnings improves the code.
Instead, this happened: The unused_braces lint fired, and applying the hint breaks the code.
The hint:
If the braces are removed:
Note: Adding a semicolon after the
println!()(and leaving the braces) results in no warning and the code still compiles.I'm using stable, but reproduced on stable, debug, and nightly on play.rust-lang.org. The lint was added in #70081. I see #70717, but there are no explicit
refs here. And I also see #70814, but these are not proc macros.rustc --version --verbose: