Skip to content

Commit

Permalink
run just fmt
Browse files Browse the repository at this point in the history
Ran just fmt to remove CI fail
  • Loading branch information
jamillambert committed Sep 10, 2024
1 parent 28a4e23 commit d612dc0
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,10 @@ impl str::FromStr for PublicKey {
let mut res = [0u8; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE];
match from_hex(s, &mut res) {
Ok(constants::PUBLIC_KEY_SIZE) => {
let bytes: [u8; constants::PUBLIC_KEY_SIZE] = res[0..constants::PUBLIC_KEY_SIZE]
.try_into()
.expect("length checked above");
let bytes: [u8; constants::PUBLIC_KEY_SIZE] =
res[0..constants::PUBLIC_KEY_SIZE].try_into().expect("length checked above");
PublicKey::from_byte_array(&bytes)
},
}
Ok(constants::UNCOMPRESSED_PUBLIC_KEY_SIZE) =>
PublicKey::from_uncompressed_byte_array(&res),
_ => Err(Error::InvalidPublicKey),
Expand Down Expand Up @@ -236,10 +235,8 @@ impl SecretKey {
#[inline]
pub fn from_byte_array(data: &[u8; constants::SECRET_KEY_SIZE]) -> Result<SecretKey, Error> {
unsafe {
if ffi::secp256k1_ec_seckey_verify(
ffi::secp256k1_context_no_precomp,
data.as_c_ptr(),
) == 0
if ffi::secp256k1_ec_seckey_verify(ffi::secp256k1_context_no_precomp, data.as_c_ptr())
== 0
{
return Err(InvalidSecretKey);
}
Expand Down Expand Up @@ -462,8 +459,7 @@ impl PublicKey {
pub fn from_slice(data: &[u8]) -> Result<PublicKey, Error> {
match data.len() {
constants::PUBLIC_KEY_SIZE => PublicKey::from_byte_array(
&<[u8; constants::PUBLIC_KEY_SIZE]>::try_from(data)
.expect("length checked above"),
&<[u8; constants::PUBLIC_KEY_SIZE]>::try_from(data).expect("length checked above"),
),
constants::UNCOMPRESSED_PUBLIC_KEY_SIZE => PublicKey::from_uncompressed_byte_array(
&<[u8; constants::UNCOMPRESSED_PUBLIC_KEY_SIZE]>::try_from(data)
Expand Down Expand Up @@ -1165,8 +1161,7 @@ impl str::FromStr for XOnlyPublicKey {
fn from_str(s: &str) -> Result<XOnlyPublicKey, Error> {
let mut res = [0u8; constants::SCHNORR_PUBLIC_KEY_SIZE];
match from_hex(s, &mut res) {
Ok(constants::SCHNORR_PUBLIC_KEY_SIZE) =>
XOnlyPublicKey::from_byte_array(&res),
Ok(constants::SCHNORR_PUBLIC_KEY_SIZE) => XOnlyPublicKey::from_byte_array(&res),
_ => Err(Error::InvalidPublicKey),
}
}
Expand Down

0 comments on commit d612dc0

Please sign in to comment.