-
Notifications
You must be signed in to change notification settings - Fork 763
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
fixes #3561 -- silence new clippy warning #3564
Conversation
pyo3-macros-backend/src/method.rs
Outdated
@@ -178,6 +178,7 @@ impl SelfType { | |||
.map_err(::std::convert::Into::<_pyo3::PyErr>::into) | |||
.and_then( | |||
#[allow(clippy::useless_conversion)] // In case slf is PyCell<Self> | |||
#[allow(unknown_lints, clippy::unnecessary_fallible_conversions)] // In case slf is Py<Self> |
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.
The unknown_lints
is necessary for this to work on stable, right?
I am not sure we should commit to doing this until the lint hits stable as lints often change/are demoted before being released to stable.
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.
Also for any older release, I assume
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 wonder if we can also silence this lint by moving away from TryFrom
to some other implementation, given that's what clippy is complaining about.
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 assume (but didn't check in depth) that TryFrom
is needed for other receiver types.
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.
It is, but we could replace it all with some other trait or function call
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.
In the end in #3587 we stuck with From
, so I think it's correct to stick to TryFrom
What is the status now that 1.74 is released? Is stable Rust affected? If so, from my point of view, I would prefer silencing the now stable lint instead of trying to work around Clippy by using a different trait. |
I think this is now in beta, so we have one more release cycle to solve it 😂 |
It struck me that we probably want to fix this before it hits stable, so that users don't have to temporarily silence clippy waiting for a PyO3 upgrade. |
Yes, I agree with that. Obviously those of us who test on nightly got this a bit early :-) |
The one alternative which I'd think we could consider is to use feature detection to only emit this on 1.75 and up. I'd slightly prefer that given we already have the machinery in our |
Hmm, started looking at doing that, but Could also split the baby: Add a |
Ah good point. Maybe just add a comment |
Done |
pyo3-build-config/src/lib.rs
Outdated
|
||
if rustc_minor_version >= 75 { | ||
println!("cargo:rustc-cfg=clippy_unnecessary_fallible_conversions_lint"); | ||
} |
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 think this bit can be reverted, otherwise please merge 👍
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.
Done
No description provided.