Skip to content

Commit

Permalink
fixes #3561 -- silence new clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Nov 27, 2023
1 parent 0f34fcd commit 028066d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions newsfragments/3564.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Silenced new `clippy::unnecessary_fallible_conversions` warning when using a `Py<Self>` `self` receiver
4 changes: 4 additions & 0 deletions pyo3-build-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ pub fn print_feature_cfgs() {
if rustc_minor_version >= 74 {
println!("cargo:rustc-cfg=invalid_from_utf8_lint");
}

if rustc_minor_version >= 75 {
println!("cargo:rustc-cfg=clippy_unnecessary_fallible_conversions_lint");
}
}

/// Private exports used in PyO3's build.rs
Expand Down
1 change: 1 addition & 0 deletions pyo3-macros-backend/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,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> (unknown_lints can be removed when clippy_unnecessary_fallible_conversions_lint is always available; MSRV 1.75+)
|cell| ::std::convert::TryFrom::try_from(cell).map_err(::std::convert::Into::into)
)

Expand Down

0 comments on commit 028066d

Please sign in to comment.