mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
fmt/clippy
This commit is contained in:
@@ -71,7 +71,7 @@ impl Output {
|
||||
|
||||
pub fn serialize<W: std::io::Write>(&self, w: &mut W) -> std::io::Result<()> {
|
||||
write_varint(&self.amount, w)?;
|
||||
w.write_all(&[2 + (if self.view_tag.is_some() { 1 } else { 0 })])?;
|
||||
w.write_all(&[2 + u8::from(self.view_tag.is_some())])?;
|
||||
w.write_all(&self.key.to_bytes())?;
|
||||
if let Some(view_tag) = self.view_tag {
|
||||
w.write_all(&[view_tag])?;
|
||||
|
||||
@@ -133,9 +133,7 @@ impl ToString for Address {
|
||||
if let AddressType::Featured(subaddress, payment_id, guaranteed) = self.meta.kind {
|
||||
// Technically should be a VarInt, yet we don't have enough features it's needed
|
||||
data.push(
|
||||
(if subaddress { 1 } else { 0 }) +
|
||||
((if payment_id.is_some() { 1 } else { 0 }) << 1) +
|
||||
((if guaranteed { 1 } else { 0 }) << 2),
|
||||
u8::from(subaddress) + (u8::from(payment_id.is_some()) << 1) + (u8::from(guaranteed) << 2),
|
||||
);
|
||||
}
|
||||
if let Some(id) = self.meta.kind.payment_id() {
|
||||
|
||||
@@ -223,7 +223,7 @@ impl SignableTransaction {
|
||||
if change && change_address.is_none() {
|
||||
Err(TransactionError::NoChange)?;
|
||||
}
|
||||
let outputs = payments.len() + (if change { 1 } else { 0 });
|
||||
let outputs = payments.len() + usize::from(change);
|
||||
|
||||
// Calculate the extra length
|
||||
let extra = Extra::fee_weight(outputs, data.as_ref());
|
||||
|
||||
Reference in New Issue
Block a user