-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
unused_braces warning emitted for braces that have semantic value #154247
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-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).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-false-positiveLint: False positive (should not have fired).Lint: False positive (should not have fired).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.
Summary
Since the adoption of tail expression temporary scope changes in the 2024 edition, it is safe to wrap a method call on a temporary lock guard in a block with assurance that the lock will be dropped before exiting the scope. It seems like this lint is either being emitted in error (false positive) or the other, very similar expression in the same file is not being detected (false negative).
Lint Name
unused_braces
Reproducer
Diagnostic emitted by rustc:
There's a similar implementation in an impl block right below this that does not have this lint emitted
Version
Additional Labels
No response