[WIP] unnecessary_cast: append suffix on `(literal as ty).method(args)`
Please write a short comment explaining your change (or "none" for internal only changes)
changelog: [unnecessary_cast]: fix handling if it is in method receiver
fix #11882, but it needs help about adding suffix to integral literal. Currently UI tests are not changed, I'll commit it before it become actually reviewable
r? @giraffate
(rustbot has picked a reviewer for you, use r? to override)
:umbrella: The latest upstream changes (presumably #12365) made this pull request unmergeable. Please resolve the merge conflicts.
@giraffate is currently sadly busy, let's get you a new reviewer
r? clippy
Hey, this is a ping from triage. @y21 can you give this PR a review? It's totally fine if you don't have the time right now, you can reassign the PR to a random team member using r? clippy.
@rustbot ready
I'm not sure what the state of this PR is, it seems like it's not finished yet.
The linked issue mentions that another PR fixed a very similar issue which affects this as well, and the lint today already suggests wrapping it in a block to avoid breaking precedence (I'm not sure why a block was chosen instead of parentheses).
But there's still the problem that { !0 }.overflowing_shr(..) results in an "ambiguous integer type" error, which I assume this PR also fixes by taking a different path in the lint for suggesting (!0_u64) specifically?
I checked out your branch and it seems like what's left is expanding the check here to also consider UnOp::Not
https://github.com/rust-lang/rust-clippy/blob/0ce07f61db8c9de51e6ecd38aa62eb3145417c0f/clippy_lints/src/casts/unnecessary_cast.rs#L222
With that it seems to make the correct suggestion.
Hey @KisaragiEffective, this is a ping from triage, since there hasn't been any activity in some time. Are you still planning to continue this implementation?
If you have any questions, you're always welcome to ask them in this PR or on Zulip.
@rustbot author