Skip to content

Commit bbbb985

Browse files
authored
Merge pull request #291 from Emurgo/run-cargo-fmt
run cargo fmt on rust code
2 parents ee29de4 + 5b9563e commit bbbb985

File tree

24 files changed

+7633
-4216
lines changed

24 files changed

+7633
-4216
lines changed

rust/src/address.rs

Lines changed: 456 additions & 174 deletions
Large diffs are not rendered by default.

rust/src/chain_crypto/algorithms/ed25519_derive.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use crate::chain_crypto::key::{
22
AsymmetricKey, AsymmetricPublicKey, PublicKeyError, SecretKeyError, SecretKeySizeStatic,
33
};
4-
use crate::chain_crypto::sign::{SignatureError, SigningAlgorithm, Verification, VerificationAlgorithm};
4+
use crate::chain_crypto::sign::{
5+
SignatureError, SigningAlgorithm, Verification, VerificationAlgorithm,
6+
};
57

68
use ed25519_bip32 as i;
79
use ed25519_bip32::{XPrv, XPub, XPRV_SIZE, XPUB_SIZE};

rust/src/chain_crypto/bech32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn try_from_bech32_to_bytes<B: Bech32>(bech32_str: &str) -> Result<Vec<u8>>
2626
if hrp != B::BECH32_HRP {
2727
return Err(Error::HrpInvalid {
2828
expected: B::BECH32_HRP,
29-
actual: hrp
29+
actual: hrp,
3030
});
3131
}
3232
Vec::<u8>::from_base32(&bech32_data).map_err(Into::into)

rust/src/chain_crypto/derive.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
use crate::chain_crypto::algorithms::{
2+
ed25519::Pub, ed25519_derive::Ed25519Bip32, ed25519_extended::ExtendedPriv, Ed25519,
3+
};
14
use crate::chain_crypto::key::{PublicKey, SecretKey};
2-
use crate::chain_crypto::algorithms::{Ed25519, ed25519_derive::Ed25519Bip32, ed25519_extended::ExtendedPriv, ed25519::Pub};
5+
use crate::chain_crypto::Ed25519Extended;
36
use cryptoxide::hmac::Hmac;
47
use cryptoxide::pbkdf2::pbkdf2;
58
use cryptoxide::sha2::Sha512;
69
use ed25519_bip32::{DerivationError, DerivationScheme};
710
use ed25519_bip32::{XPrv, XPRV_SIZE};
8-
use crate::chain_crypto::Ed25519Extended;
911

1012
pub fn derive_sk_ed25519(key: &SecretKey<Ed25519Bip32>, index: u32) -> SecretKey<Ed25519Bip32> {
1113
let new_key = key.0.derive(DerivationScheme::V2, index);

rust/src/chain_crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ pub mod bech32;
1111
pub mod derive;
1212
pub mod digest;
1313
pub mod hash;
14-
mod sign;
1514
mod key;
15+
mod sign;
1616

1717
pub use algorithms::*;
1818
pub use hash::{Blake2b256, Sha3_256};

rust/src/chain_crypto/sign.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use crate::chain_crypto::{
22
bech32::{self, Bech32},
33
key,
44
};
5+
use crate::typed_bytes::{ByteArray, ByteSlice};
56
use hex::FromHexError;
67
use std::{fmt, marker::PhantomData, str::FromStr};
7-
use crate::typed_bytes::{ByteArray, ByteSlice};
88

99
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1010
pub enum Verification {
@@ -189,11 +189,9 @@ impl<T, A: VerificationAlgorithm> Clone for Signature<T, A> {
189189
}
190190
}
191191

192-
193192
impl<T, A: VerificationAlgorithm> PartialEq<Self> for Signature<T, A> {
194193
fn eq(&self, other: &Self) -> bool {
195-
self.signdata.as_ref() == other.signdata.as_ref()
196-
&& self.phantom == other.phantom
194+
self.signdata.as_ref() == other.signdata.as_ref() && self.phantom == other.phantom
197195
}
198196
}
199197

0 commit comments

Comments
 (0)