Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: spurrious unused_parens on assignment of comparison #56033

Open
thepowersgang opened this issue Nov 18, 2018 · 1 comment
Open

Lint: spurrious unused_parens on assignment of comparison #56033

thepowersgang opened this issue Nov 18, 2018 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. L-unused_parens Lint: unused_parens T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@thepowersgang
Copy link
Contributor

thepowersgang commented Nov 18, 2018

The following code triggers the unused_parens lint, but without the parens the equality operator can be (visually) confused with the assignment.

fn main()
{
    let bar = "";
    let _foo = (bar == "baz");
}
@zackmdavis zackmdavis added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 18, 2018
@Centril Centril added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Nov 19, 2018
@Centril
Copy link
Contributor

Centril commented Nov 19, 2018

I'm skeptical that the behavior of the lint is incorrect; it does not seem to me like let x = a == b; is so confusing or that it would arise often enough.

@crlf0710 crlf0710 added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 11, 2020
@jieyouxu jieyouxu added the L-unused_parens Lint: unused_parens label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-enhancement Category: An issue proposing an enhancement or a PR with one. L-unused_parens Lint: unused_parens T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants