-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Detect literals with unary operators (UP018) #10060
Conversation
if unary { | ||
if !matches!(literal_type, LiteralType::Int | LiteralType::Float) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding a comment why this check is necessary for unary
only and add a test case that verifies that ruff early returns if it's an unary and neither an Int
nor Float
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved this up into the match.
2e1820c
to
7d309e7
Compare
|
Fix #10029.