-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Avoid incorrect tuple transformation in single-element case (C409
)
#10491
Avoid incorrect tuple transformation in single-element case (C409
)
#10491
Conversation
1b83088
to
41107a8
Compare
|
// Replace [1, 2] -> (1, 2) or [1] -> (1,) | ||
let tuple: String = if let [elt] = elts.as_slice() { | ||
let elt: &str = checker.locator().slice(elt); | ||
format!("({elt},)") |
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.
This is going to lose the spacing around the element. Can you take a look at how we solved this in #10461?
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.
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.
Thank you for suggestion!
…essary-literal-within-tuple-call)
41107a8
to
81b8b3a
Compare
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.
Thanks!
C409
)
Summary
Fixed: incorrect rule transformation rule C409 with single element.
Test Plan
Added examples from #10323 to test fixtures.