Skip to content

unused_parens incorrectly lints on if let Ok(x) = (try { ... #70490

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

Closed
comex opened this issue Mar 28, 2020 · 1 comment · Fixed by #70657
Closed

unused_parens incorrectly lints on if let Ok(x) = (try { ... #70490

comex opened this issue Mar 28, 2020 · 1 comment · Fixed by #70657
Assignees
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@comex
Copy link
Contributor

comex commented Mar 28, 2020

Playground link
This produces a lint:

if let Ok(x) = (try { }: Result<(), ()>) {}

But removing the parentheses produces an error.

This bug was already mentioned in #42528, but that issue is lost in feature-request purgatory since it asks for the version without parentheses to be allowed. I'm opening this issue to track the incorrect lint specifically.

(Edit: Fixed the example.)

This issue has been assigned to @lcnr via this comment.

@comex comex changed the title unused_parens incorrectly lints on if let Ok(x) = (try {}) {} unused_parens incorrectly lints on if let Ok(x) = (try { ... Mar 28, 2020
@jonas-schievink jonas-schievink added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 28, 2020
@lcnr
Copy link
Contributor

lcnr commented Mar 29, 2020

@rustbot claim

Will wait for #70081 to get merged before this is fixed though.

@rustbot rustbot self-assigned this Mar 29, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 14, 2020
Allow `try`-blocks in places where an open delim is expected

Closes rust-lang#70490
Closes rust-lang#56828

r? @Centril
@bors bors closed this as completed in 15ab586 Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants