Skip to content

Conversation

KisaragiEffective
Copy link
Contributor

check list:

  • Followed [lint naming conventions][lint_naming]
  • Added passing UI tests (including committed .stderr file)
  • cargo test passes locally
  • Executed cargo dev update_lints
  • Added lint documentation
  • Run cargo dev fmt

unresolved questions:

  • should this lint fire not only local variables, but also do other unary (such as literals) expressions?

close #10557.

Please write a short comment explaining your change (or "none" for internal only changes)

changelog: Add [unary_parenthesis_followed_by_cast]

@rustbot
Copy link
Collaborator

rustbot commented Apr 10, 2023

r? @llogiq

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 10, 2023
@KisaragiEffective KisaragiEffective force-pushed the feature/unary_parenthesis_followed_by_cast branch from 3484a01 to 59c299a Compare April 10, 2023 11:38
@KisaragiEffective
Copy link
Contributor Author

(force-pushed due to lack of my GPG signature)

@KisaragiEffective KisaragiEffective marked this pull request as ready for review April 10, 2023 11:54
@llogiq
Copy link
Contributor

llogiq commented Apr 10, 2023

I'm curious why the unused_parens lint doesn't catch this. (x) is just parenthesized x, if one wants to build a 1-tuple, the correct syntax is (x,).

@KisaragiEffective
Copy link
Contributor Author

@llogiq It seems current implementation doesn't handle ExprKind::Cast. Should I submit another PR (to solve the issue) on rustc?

@llogiq
Copy link
Contributor

llogiq commented Apr 10, 2023

Yeah, fixing the false negative in rustc is a better solution. You can keep this PR open in case the other one doesn't go through.

@KisaragiEffective
Copy link
Contributor Author

submitted rust-lang/rust#110189, I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unnecssary parenthesis lint
3 participants