Skip to content

Commit

Permalink
Address' cargo clippy' errors following the update to Rust 1.65
Browse files Browse the repository at this point in the history
  • Loading branch information
dmidem committed Sep 15, 2023
1 parent bb2d38c commit 1a4755f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,11 @@ impl Builder {
.max()
.cloned()
.unwrap();
(num_actions < MIN_ACTIONS)
.then_some(MIN_ACTIONS - num_actions)
.unwrap_or(0)
if num_actions < MIN_ACTIONS {
MIN_ACTIONS - num_actions
} else {
0
}
}

/// Builds a bundle containing the given spent notes and recipients.
Expand Down
6 changes: 3 additions & 3 deletions src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,9 +1333,9 @@ mod tests {
w.write_all(&<[u8; 32]>::from(instance.rk.clone()))?;
w.write_all(&instance.cmx.to_bytes())?;
w.write_all(&[
if instance.enable_spend { 1 } else { 0 },
if instance.enable_output { 1 } else { 0 },
if instance.enable_zsa { 1 } else { 0 },
u8::from(instance.enable_spend),
u8::from(instance.enable_output),
u8::from(instance.enable_zsa),
])?;

w.write_all(proof.as_ref())?;
Expand Down
2 changes: 1 addition & 1 deletion src/issuance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl IssueAction {

/// Serialize `finalize` flag to a byte
pub fn flags(&self) -> u8 {
self.finalize.then_some(0b0000_0001).unwrap_or(0b0000_0000)
u8::from(self.finalize)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/supply_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{issuance::Error, note::AssetBase, value::ValueSum};

/// Represents the amount of an asset and its finalization status.
#[derive(Debug, Clone, Copy)]
#[cfg_attr(test, derive(PartialEq))]
#[cfg_attr(test, derive(PartialEq, Eq))]
pub struct AssetSupply {
/// The amount of the asset.
pub amount: ValueSum,
Expand Down
8 changes: 4 additions & 4 deletions tests/zsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ fn prepare_keys() -> Keychain {

fn sign_issue_bundle(
unauthorized: IssueBundle<Unauthorized>,
mut rng: OsRng,
rng: OsRng,
isk: &IssuanceAuthorizingKey,
) -> IssueBundle<Signed> {
let sighash = unauthorized.commitment().into();
let proven = unauthorized.prepare(sighash);
proven.sign(&mut rng, isk).unwrap()
proven.sign(rng, isk).unwrap()
}

fn build_and_sign_bundle(
Expand All @@ -95,7 +95,7 @@ fn build_and_sign_bundle(
let sighash = unauthorized.commitment().into();
let proven = unauthorized.create_proof(pk, &mut rng).unwrap();
proven
.apply_signatures(&mut rng, sighash, &[SpendAuthorizingKey::from(sk)])
.apply_signatures(rng, sighash, &[SpendAuthorizingKey::from(sk)])
.unwrap()
}

Expand Down Expand Up @@ -203,7 +203,7 @@ fn create_native_note(keys: &Keychain) -> Note {
let unauthorized = builder.build(&mut rng).unwrap();
let sighash = unauthorized.commitment().into();
let proven = unauthorized.create_proof(keys.pk(), &mut rng).unwrap();
proven.apply_signatures(&mut rng, sighash, &[]).unwrap()
proven.apply_signatures(rng, sighash, &[]).unwrap()
};
let ivk = keys.fvk().to_ivk(Scope::External);
let (native_note, _, _) = shielding_bundle
Expand Down

0 comments on commit 1a4755f

Please sign in to comment.