-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Useless conversion error when using PyResult<PyObject> in pyo3 #14272
Comments
I'm hitting this too and I've used https://github.com/rust-lang/cargo-bisect-rustc to bisect to rust-lang/rust@19e75f4. cargo bisect-rustc --start=1.84.0 --end=1.85.0 -c clippy -- clippy -- -F clippy::useless_conversion I'm not immediately sure how to bisect further, but I'll spend a bit more time this evening to see if I can work it out. |
I think I managed to bisect to 2ddfc92, but now it's passing and I don't know why... |
Assuming that's the right commit, I now suspect this requires a fix in PyO3's |
Actually, this does appear to be fixed on |
As the author of the commit you identified, which indeed lints more cases of useless conversions than it did before, I also had a look and could not reproduce it, and suspected a proc macro problem as well. I haven't looked at the If you can exhibit a minimal compilable reproducer that I can use, I'll look at it, unless you consider the problem fixed already, in which case this issue can be closed. |
I think there might be more to do in PyO3, but right now I don't think there's anything wrong in Clippy. |
Thanks! I'll take a look again in the morning and close the issue once I confirm it is fixed. |
Using `#[allow(clippy::useless_conversion)]` still causes failures if the PyO3 user uses `#[forbid(clippy::useless_conversion)]`. Instead we can ensure the `into` call is not within a `quote_spanned!` block, allowing clippy to know this is macro code. rust-lang/rust-clippy#14272 (comment)
Summary
In rustc v1.84 we didn't have this issue but after upgrading to 1.85, we started getting this error. Downgrading back to 1.84 seemed to fix the issue.
Reproducer
For example I tried this dummy code:
I expected to see no warnings or errors
Instead, this happened:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: