introduce `fallible_impl_from` lint with exeptions (#4609)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
3b3b59f71a
commit
b7536c7f7e
|
|
@ -50,7 +50,10 @@ rustflags = [
|
||||||
"-Aclippy::try_err",
|
"-Aclippy::try_err",
|
||||||
|
|
||||||
# Links in public docs can point to private items.
|
# Links in public docs can point to private items.
|
||||||
"-Arustdoc::private_intra_doc_links"
|
"-Arustdoc::private_intra_doc_links",
|
||||||
|
|
||||||
|
# Panics
|
||||||
|
"-Wclippy::fallible_impl_from",
|
||||||
|
|
||||||
# TODOs:
|
# TODOs:
|
||||||
# `cargo fix` might help do these fixes,
|
# `cargo fix` might help do these fixes,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
//! Orchard key types.
|
//! Orchard key types.
|
||||||
//!
|
//!
|
||||||
//! <https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents>
|
//! <https://zips.z.cash/protocol/nu5.pdf#orchardkeycomponents>
|
||||||
|
#![allow(clippy::fallible_impl_from)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
@ -308,7 +308,9 @@ impl From<SpendValidatingKey> for [u8; 32] {
|
||||||
|
|
||||||
impl From<SpendAuthorizingKey> for SpendValidatingKey {
|
impl From<SpendAuthorizingKey> for SpendValidatingKey {
|
||||||
fn from(ask: SpendAuthorizingKey) -> Self {
|
fn from(ask: SpendAuthorizingKey) -> Self {
|
||||||
let sk = redpallas::SigningKey::<SpendAuth>::try_from(<[u8; 32]>::from(ask)).unwrap();
|
let sk = redpallas::SigningKey::<SpendAuth>::try_from(<[u8; 32]>::from(ask)).expect(
|
||||||
|
"a scalar converted to byte array and then converted back to a scalar should not fail",
|
||||||
|
);
|
||||||
|
|
||||||
Self(redpallas::VerificationKey::from(&sk))
|
Self(redpallas::VerificationKey::from(&sk))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
//! [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
//! [ps]: https://zips.z.cash/protocol/protocol.pdf#saplingkeycomponents
|
||||||
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
//! [3.1]: https://zips.z.cash/protocol/protocol.pdf#addressesandkeys
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
|
#![allow(clippy::fallible_impl_from)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
@ -507,7 +508,9 @@ impl From<AuthorizingKey> for [u8; 32] {
|
||||||
|
|
||||||
impl From<SpendAuthorizingKey> for AuthorizingKey {
|
impl From<SpendAuthorizingKey> for AuthorizingKey {
|
||||||
fn from(ask: SpendAuthorizingKey) -> Self {
|
fn from(ask: SpendAuthorizingKey) -> Self {
|
||||||
let sk = redjubjub::SigningKey::<SpendAuth>::try_from(<[u8; 32]>::from(ask)).unwrap();
|
let sk = redjubjub::SigningKey::<SpendAuth>::try_from(<[u8; 32]>::from(ask)).expect(
|
||||||
|
"a scalar converted to byte array and then converted back to a scalar should not fail",
|
||||||
|
);
|
||||||
Self(redjubjub::VerificationKey::from(&sk))
|
Self(redjubjub::VerificationKey::from(&sk))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
// it raises a lot of issues in the macro.
|
// it raises a lot of issues in the macro.
|
||||||
#![allow(clippy::all)]
|
#![allow(clippy::all)]
|
||||||
#![allow(clippy::range_plus_one)]
|
#![allow(clippy::range_plus_one)]
|
||||||
|
#![allow(clippy::fallible_impl_from)]
|
||||||
|
|
||||||
use uint::construct_uint;
|
use uint::construct_uint;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,11 @@ where
|
||||||
// use specific varieties of `RejectReason`.
|
// use specific varieties of `RejectReason`.
|
||||||
ccode: RejectReason::Other,
|
ccode: RejectReason::Other,
|
||||||
|
|
||||||
reason: e.source().unwrap().to_string(),
|
reason: if let Some(reason) = e.source() {
|
||||||
|
reason.to_string()
|
||||||
|
} else {
|
||||||
|
String::from("")
|
||||||
|
},
|
||||||
|
|
||||||
// Allow this to be overridden but not populated by default, methinks.
|
// Allow this to be overridden but not populated by default, methinks.
|
||||||
data: None,
|
data: None,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue