Skip to content

Commit 8b24509

Browse files
committed
Format rust
1 parent 9ee9b35 commit 8b24509

File tree

7 files changed

+183
-149
lines changed

7 files changed

+183
-149
lines changed

src/rust/bitbox02-rust/src/hww/api/ethereum/address.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ pub fn from_pubkey_hash(recipient: &[u8; 20], address_case: pb::EthAddressCase)
4444
// valid utf8 because hex and the uppercasing above is correct.
4545
core::str::from_utf8_unchecked(&hex[..])
4646
})
47-
},
47+
}
4848
pb::EthAddressCase::Upper => {
4949
format!("0x{}", hex::encode_upper(recipient))
50-
},
50+
}
5151
pb::EthAddressCase::Lower => {
5252
format!("0x{}", hex::encode(recipient))
5353
}
@@ -58,7 +58,10 @@ pub fn from_pubkey_hash(recipient: &[u8; 20], address_case: pb::EthAddressCase)
5858
/// `recipient` - 20 byte tail (last 20 bytes of the pubkeyhash).
5959
pub fn from_pubkey(pubkey_uncompressed: &[u8; 65]) -> String {
6060
let hash = sha3::Keccak256::digest(&pubkey_uncompressed[1..]);
61-
from_pubkey_hash(hash[hash.len() - 20..].try_into().unwrap(), pb::EthAddressCase::Mixed)
61+
from_pubkey_hash(
62+
hash[hash.len() - 20..].try_into().unwrap(),
63+
pb::EthAddressCase::Mixed,
64+
)
6265
}
6366

6467
#[cfg(test)]

src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ impl<'a> Transaction<'a> {
9393
fn case(&self) -> Result<pb::EthAddressCase, Error> {
9494
match self {
9595
Transaction::Legacy(legacy) => Ok(pb::EthAddressCase::try_from(legacy.address_case)?),
96-
Transaction::Eip1559(eip1559) => Ok(pb::EthAddressCase::try_from(eip1559.address_case)?),
96+
Transaction::Eip1559(eip1559) => {
97+
Ok(pb::EthAddressCase::try_from(eip1559.address_case)?)
98+
}
9799
}
98100
}
99101
}
@@ -268,7 +270,7 @@ async fn verify_standard_transaction(
268270
})
269271
.await?;
270272
}
271-
273+
272274
let address = super::address::from_pubkey_hash(&recipient, request.case()?);
273275
let amount = Amount {
274276
unit: params.unit,

src/rust/bitbox02-rust/src/hww/api/sdcard.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ pub async fn process(
2525
) -> Result<Response, Error> {
2626
let inserted = bitbox02::sd::sdcard_inserted();
2727
match SdCardAction::try_from(action) {
28-
Ok(SdCardAction::InsertCard) => {},
28+
Ok(SdCardAction::InsertCard) => {}
2929
_ => return Ok(Response::Success(pb::Success {})),
3030
};
31-
if inserted
32-
{
31+
if inserted {
3332
return Ok(Response::Success(pb::Success {}));
3433
}
3534
sdcard::sdcard().await?;

src/rust/bitbox02-rust/src/workflow/mnemonic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,4 +502,4 @@ mod tests {
502502
&bruteforce_lastword(&mnemonic)
503503
);
504504
}
505-
}
505+
}

src/rust/bitbox02-rust/src/workflow/mnemonic_c_unit_tests.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ pub async fn get() -> Result<zeroize::Zeroizing<String>, CancelError> {
3030
let words = "boring mistake dish oyster truth pigeon viable emerge sort crash wire portion cannon couple enact box walk height pull today solid off enable tide";
3131
bitbox02::println_stdout("Restored from recovery words below:");
3232
bitbox02::println_stdout(words);
33-
34-
Ok(zeroize::Zeroizing::new(
35-
words
36-
.to_string()
37-
))
38-
}
33+
34+
Ok(zeroize::Zeroizing::new(words.to_string()))
35+
}

0 commit comments

Comments
 (0)