From 6c238b161719f5bfbb97386e35d15f16e785c42a Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 4 May 2021 11:29:59 +1000 Subject: [PATCH] Clippy fixes after Rust update --- swap/src/bin/asb.rs | 2 +- swap/src/protocol/alice/state.rs | 4 ++-- swap/src/protocol/bob/state.rs | 2 +- tokio-tar/src/header.rs | 10 ++-------- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 663cf266..2188c95d 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -257,7 +257,7 @@ async fn register_tor_services( } }) }) - .filter_map(|details| details) + .flatten() .collect::>(); let key = seed.derive_torv3_key(); diff --git a/swap/src/protocol/alice/state.rs b/swap/src/protocol/alice/state.rs index 86810e5b..339be1a4 100644 --- a/swap/src/protocol/alice/state.rs +++ b/swap/src/protocol/alice/state.rs @@ -274,11 +274,11 @@ impl State2 { // recover(encsign(a, S_b, d), sign(a, d), S_b) = s_b where d is a digest, (a, // A) is alice's keypair and (s_b, S_b) is bob's keypair. let tx_refund_encsig = self.a.encsign(self.S_b_bitcoin, tx_refund.digest()); - let tx_cancel_sig = self.a.sign(tx_cancel.digest()); + Message3 { - tx_refund_encsig, tx_cancel_sig, + tx_refund_encsig, } } diff --git a/swap/src/protocol/bob/state.rs b/swap/src/protocol/bob/state.rs index df184f6e..9e5e94d9 100644 --- a/swap/src/protocol/bob/state.rs +++ b/swap/src/protocol/bob/state.rs @@ -139,7 +139,7 @@ impl State0 { let valid = CROSS_CURVE_PROOF_SYSTEM.verify( &msg.dleq_proof_s_a, ( - msg.S_a_bitcoin.clone().into(), + msg.S_a_bitcoin.into(), msg.S_a_monero .point .decompress() diff --git a/tokio-tar/src/header.rs b/tokio-tar/src/header.rs index 34769c6e..86d5a54e 100644 --- a/tokio-tar/src/header.rs +++ b/tokio-tar/src/header.rs @@ -516,11 +516,7 @@ impl Header { pub fn username_bytes(&self) -> Option<&[u8]> { if let Some(ustar) = self.as_ustar() { Some(ustar.username_bytes()) - } else if let Some(gnu) = self.as_gnu() { - Some(gnu.username_bytes()) - } else { - None - } + } else { self.as_gnu().map(|gnu| gnu.username_bytes()) } } /// Sets the username inside this header. @@ -558,10 +554,8 @@ impl Header { pub fn groupname_bytes(&self) -> Option<&[u8]> { if let Some(ustar) = self.as_ustar() { Some(ustar.groupname_bytes()) - } else if let Some(gnu) = self.as_gnu() { - Some(gnu.groupname_bytes()) } else { - None + self.as_gnu().map(|gnu| gnu.groupname_bytes()) } }