Skip to content

Commit 85cc4e4

Browse files
authored
Resolve new clippy warnings (#10755)
The fixes themselves are of marginal value 🙃
1 parent 15b1186 commit 85cc4e4

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

src/rust/src/x509/crl.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,18 @@ fn try_map_arc_data_mut_crl_iterator<E>(
471471
) -> Result<crl::RevokedCertificate<'this>, E>,
472472
) -> Result<OwnedRevokedCertificate, E> {
473473
OwnedRevokedCertificate::try_new(Arc::clone(it.borrow_owner()), |inner_it| {
474-
// SAFETY: This is safe because `Arc::clone` ensures the data is
475-
// alive, but Rust doesn't understand the lifetime relationship it
476-
// produces. Open-coded implementation of the API discussed in
477-
// https://github.com/joshua-maros/ouroboros/issues/38
478-
it.with_dependent_mut(|_, value| f(inner_it, unsafe { std::mem::transmute(value) }))
474+
it.with_dependent_mut(|_, value| {
475+
// SAFETY: This is safe because `Arc::clone` ensures the data is
476+
// alive, but Rust doesn't understand the lifetime relationship it
477+
// produces. Open-coded implementation of the API discussed in
478+
// https://github.com/joshua-maros/ouroboros/issues/38
479+
f(inner_it, unsafe {
480+
std::mem::transmute::<
481+
&mut Option<asn1::SequenceOf<'_, crl::RevokedCertificate<'_>>>,
482+
&mut Option<asn1::SequenceOf<'_, crl::RevokedCertificate<'_>>>,
483+
>(value)
484+
})
485+
})
479486
})
480487
}
481488

src/rust/src/x509/ocsp_resp.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,11 @@ fn map_arc_data_ocsp_response(
457457
// alive, but Rust doesn't understand the lifetime relationship it
458458
// produces. Open-coded implementation of the API discussed in
459459
// https://github.com/joshua-maros/ouroboros/issues/38
460-
f(inner_it.as_bytes(py), unsafe { std::mem::transmute(value) })
460+
f(inner_it.as_bytes(py), unsafe {
461+
std::mem::transmute::<&ocsp_resp::OCSPResponse<'_>, &ocsp_resp::OCSPResponse<'_>>(
462+
value,
463+
)
464+
})
461465
})
462466
})
463467
}
@@ -469,11 +473,18 @@ fn try_map_arc_data_mut_ocsp_response_iterator<E>(
469473
) -> Result<ocsp_resp::SingleResponse<'this>, E>,
470474
) -> Result<OwnedSingleResponse, E> {
471475
OwnedSingleResponse::try_new(Arc::clone(it.borrow_owner()), |inner_it| {
472-
// SAFETY: This is safe because `Arc::clone` ensures the data is
473-
// alive, but Rust doesn't understand the lifetime relationship it
474-
// produces. Open-coded implementation of the API discussed in
475-
// https://github.com/joshua-maros/ouroboros/issues/38
476-
it.with_dependent_mut(|_, value| f(inner_it, unsafe { std::mem::transmute(value) }))
476+
it.with_dependent_mut(|_, value| {
477+
// SAFETY: This is safe because `Arc::clone` ensures the data is
478+
// alive, but Rust doesn't understand the lifetime relationship it
479+
// produces. Open-coded implementation of the API discussed in
480+
// https://github.com/joshua-maros/ouroboros/issues/38
481+
f(inner_it, unsafe {
482+
std::mem::transmute::<
483+
&mut asn1::SequenceOf<'_, ocsp_resp::SingleResponse<'_>>,
484+
&mut asn1::SequenceOf<'_, ocsp_resp::SingleResponse<'_>>,
485+
>(value)
486+
})
487+
})
477488
})
478489
}
479490

0 commit comments

Comments
 (0)