diff --git a/swap/src/alice/event_loop.rs b/swap/src/alice/event_loop.rs index b9cd08f4..52a056c1 100644 --- a/swap/src/alice/event_loop.rs +++ b/swap/src/alice/event_loop.rs @@ -11,6 +11,7 @@ use libp2p::{ use tokio::sync::mpsc::{Receiver, Sender}; use xmr_btc::{alice, bob}; +#[allow(missing_debug_implementations)] pub struct Channels { sender: Sender, receiver: Receiver, @@ -29,6 +30,7 @@ impl Default for Channels { } } +#[derive(Debug)] pub struct EventLoopHandle { msg0: Receiver<(bob::Message0, ResponseChannel)>, msg1: Receiver<(bob::Message1, ResponseChannel)>, @@ -122,6 +124,7 @@ impl EventLoopHandle { } } +#[allow(missing_debug_implementations)] pub struct EventLoop { swarm: libp2p::Swarm, msg0: Sender<(bob::Message0, ResponseChannel)>, diff --git a/swap/src/alice/swap.rs b/swap/src/alice/swap.rs index e6e6e8b4..64114511 100644 --- a/swap/src/alice/swap.rs +++ b/swap/src/alice/swap.rs @@ -41,6 +41,7 @@ trait Rng: RngCore + CryptoRng + Send {} impl Rng for T where T: RngCore + CryptoRng + Send {} +#[derive(Debug)] #[allow(clippy::large_enum_variant)] pub enum AliceState { Started { diff --git a/swap/src/bob/amounts.rs b/swap/src/bob/amounts.rs index 7428ad30..6350467c 100644 --- a/swap/src/bob/amounts.rs +++ b/swap/src/bob/amounts.rs @@ -19,7 +19,7 @@ use crate::{ SwapAmounts, }; -#[derive(Debug)] +#[derive(Copy, Clone, Debug)] pub enum OutEvent { Amounts(SwapAmounts), } diff --git a/swap/src/bob/event_loop.rs b/swap/src/bob/event_loop.rs index fd88a294..16cc19c2 100644 --- a/swap/src/bob/event_loop.rs +++ b/swap/src/bob/event_loop.rs @@ -12,6 +12,7 @@ use tokio::{ use tracing::{debug, error, info}; use xmr_btc::{alice, bitcoin::EncryptedSignature, bob}; +#[derive(Debug)] pub struct Channels { sender: Sender, receiver: Receiver, @@ -30,6 +31,7 @@ impl Default for Channels { } } +#[derive(Debug)] pub struct EventLoopHandle { msg0: Receiver, msg1: Receiver, @@ -105,6 +107,7 @@ impl EventLoopHandle { } } +#[allow(missing_debug_implementations)] pub struct EventLoop { swarm: libp2p::Swarm, alice_peer_id: PeerId, diff --git a/swap/src/bob/message3.rs b/swap/src/bob/message3.rs index 20873bfa..e53c08e9 100644 --- a/swap/src/bob/message3.rs +++ b/swap/src/bob/message3.rs @@ -16,7 +16,7 @@ use tracing::error; use crate::network::request_response::{AliceToBob, BobToAlice, Codec, Message3Protocol, TIMEOUT}; use xmr_btc::bob; -#[derive(Debug)] +#[derive(Debug, Copy, Clone)] pub enum OutEvent { Msg, } diff --git a/swap/src/lib.rs b/swap/src/lib.rs index b71d005f..fc16a59f 100644 --- a/swap/src/lib.rs +++ b/swap/src/lib.rs @@ -1,3 +1,16 @@ +#![warn( + unused_extern_crates, + missing_debug_implementations, + missing_copy_implementations, + rust_2018_idioms, + clippy::cast_possible_truncation, + clippy::cast_sign_loss, + clippy::fallible_impl_from, + clippy::cast_precision_loss, + clippy::cast_possible_wrap, + clippy::dbg_macro +)] +#![forbid(unsafe_code)] #![allow(non_snake_case)] use ::serde::{Deserialize, Serialize}; @@ -42,7 +55,7 @@ pub struct SwapAmounts { // TODO: Display in XMR and BTC (not picos and sats). impl Display for SwapAmounts { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{} sats for {} piconeros", diff --git a/swap/src/main.rs b/swap/src/main.rs index deb18d18..a9785213 100644 --- a/swap/src/main.rs +++ b/swap/src/main.rs @@ -11,6 +11,7 @@ clippy::dbg_macro )] #![forbid(unsafe_code)] +#![allow(non_snake_case)] use anyhow::{bail, Context, Result}; use libp2p::{core::Multiaddr, PeerId}; diff --git a/swap/src/monero.rs b/swap/src/monero.rs index e97e9d64..3c860c5c 100644 --- a/swap/src/monero.rs +++ b/swap/src/monero.rs @@ -7,6 +7,7 @@ use url::Url; pub use xmr_btc::monero::*; +#[derive(Debug)] pub struct Wallet(pub wallet::Client); impl Wallet { diff --git a/swap/src/network.rs b/swap/src/network.rs index 90bf44de..916ffa5a 100644 --- a/swap/src/network.rs +++ b/swap/src/network.rs @@ -7,6 +7,7 @@ pub mod peer_tracker; pub mod request_response; pub mod transport; +#[allow(missing_debug_implementations)] pub struct TokioExecutor { pub handle: Handle, } diff --git a/swap/src/state.rs b/swap/src/state.rs index 7590c2c8..82fb901e 100644 --- a/swap/src/state.rs +++ b/swap/src/state.rs @@ -35,7 +35,7 @@ pub enum Alice { Done(AliceEndState), } -#[derive(Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)] +#[derive(Copy, Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)] pub enum AliceEndState { SafelyAborted, BtcRedeemed, diff --git a/swap/src/storage.rs b/swap/src/storage.rs index dc6c3e80..d7cf3466 100644 --- a/swap/src/storage.rs +++ b/swap/src/storage.rs @@ -4,6 +4,7 @@ use serde::{de::DeserializeOwned, Serialize}; use std::path::Path; use uuid::Uuid; +#[derive(Debug)] pub struct Database(sled::Db); impl Database {