Align clippy lints

Lints in `main.rs` are not used if there is a `lib.rs` file.
This commit is contained in:
Franck Royer 2020-12-23 14:33:29 +11:00
parent ece689f5ca
commit cdf2800fa5
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
11 changed files with 28 additions and 4 deletions

View File

@ -11,6 +11,7 @@ use libp2p::{
use tokio::sync::mpsc::{Receiver, Sender}; use tokio::sync::mpsc::{Receiver, Sender};
use xmr_btc::{alice, bob}; use xmr_btc::{alice, bob};
#[allow(missing_debug_implementations)]
pub struct Channels<T> { pub struct Channels<T> {
sender: Sender<T>, sender: Sender<T>,
receiver: Receiver<T>, receiver: Receiver<T>,
@ -29,6 +30,7 @@ impl<T> Default for Channels<T> {
} }
} }
#[derive(Debug)]
pub struct EventLoopHandle { pub struct EventLoopHandle {
msg0: Receiver<(bob::Message0, ResponseChannel<AliceToBob>)>, msg0: Receiver<(bob::Message0, ResponseChannel<AliceToBob>)>,
msg1: Receiver<(bob::Message1, ResponseChannel<AliceToBob>)>, msg1: Receiver<(bob::Message1, ResponseChannel<AliceToBob>)>,
@ -122,6 +124,7 @@ impl EventLoopHandle {
} }
} }
#[allow(missing_debug_implementations)]
pub struct EventLoop { pub struct EventLoop {
swarm: libp2p::Swarm<Behaviour>, swarm: libp2p::Swarm<Behaviour>,
msg0: Sender<(bob::Message0, ResponseChannel<AliceToBob>)>, msg0: Sender<(bob::Message0, ResponseChannel<AliceToBob>)>,

View File

@ -41,6 +41,7 @@ trait Rng: RngCore + CryptoRng + Send {}
impl<T> Rng for T where T: RngCore + CryptoRng + Send {} impl<T> Rng for T where T: RngCore + CryptoRng + Send {}
#[derive(Debug)]
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
pub enum AliceState { pub enum AliceState {
Started { Started {

View File

@ -19,7 +19,7 @@ use crate::{
SwapAmounts, SwapAmounts,
}; };
#[derive(Debug)] #[derive(Copy, Clone, Debug)]
pub enum OutEvent { pub enum OutEvent {
Amounts(SwapAmounts), Amounts(SwapAmounts),
} }

View File

@ -12,6 +12,7 @@ use tokio::{
use tracing::{debug, error, info}; use tracing::{debug, error, info};
use xmr_btc::{alice, bitcoin::EncryptedSignature, bob}; use xmr_btc::{alice, bitcoin::EncryptedSignature, bob};
#[derive(Debug)]
pub struct Channels<T> { pub struct Channels<T> {
sender: Sender<T>, sender: Sender<T>,
receiver: Receiver<T>, receiver: Receiver<T>,
@ -30,6 +31,7 @@ impl<T> Default for Channels<T> {
} }
} }
#[derive(Debug)]
pub struct EventLoopHandle { pub struct EventLoopHandle {
msg0: Receiver<alice::Message0>, msg0: Receiver<alice::Message0>,
msg1: Receiver<alice::Message1>, msg1: Receiver<alice::Message1>,
@ -105,6 +107,7 @@ impl EventLoopHandle {
} }
} }
#[allow(missing_debug_implementations)]
pub struct EventLoop { pub struct EventLoop {
swarm: libp2p::Swarm<Behaviour>, swarm: libp2p::Swarm<Behaviour>,
alice_peer_id: PeerId, alice_peer_id: PeerId,

View File

@ -16,7 +16,7 @@ use tracing::error;
use crate::network::request_response::{AliceToBob, BobToAlice, Codec, Message3Protocol, TIMEOUT}; use crate::network::request_response::{AliceToBob, BobToAlice, Codec, Message3Protocol, TIMEOUT};
use xmr_btc::bob; use xmr_btc::bob;
#[derive(Debug)] #[derive(Debug, Copy, Clone)]
pub enum OutEvent { pub enum OutEvent {
Msg, Msg,
} }

View File

@ -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)] #![allow(non_snake_case)]
use ::serde::{Deserialize, Serialize}; use ::serde::{Deserialize, Serialize};
@ -42,7 +55,7 @@ pub struct SwapAmounts {
// TODO: Display in XMR and BTC (not picos and sats). // TODO: Display in XMR and BTC (not picos and sats).
impl Display for SwapAmounts { impl Display for SwapAmounts {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( write!(
f, f,
"{} sats for {} piconeros", "{} sats for {} piconeros",

View File

@ -11,6 +11,7 @@
clippy::dbg_macro clippy::dbg_macro
)] )]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![allow(non_snake_case)]
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use libp2p::{core::Multiaddr, PeerId}; use libp2p::{core::Multiaddr, PeerId};

View File

@ -7,6 +7,7 @@ use url::Url;
pub use xmr_btc::monero::*; pub use xmr_btc::monero::*;
#[derive(Debug)]
pub struct Wallet(pub wallet::Client); pub struct Wallet(pub wallet::Client);
impl Wallet { impl Wallet {

View File

@ -7,6 +7,7 @@ pub mod peer_tracker;
pub mod request_response; pub mod request_response;
pub mod transport; pub mod transport;
#[allow(missing_debug_implementations)]
pub struct TokioExecutor { pub struct TokioExecutor {
pub handle: Handle, pub handle: Handle,
} }

View File

@ -35,7 +35,7 @@ pub enum Alice {
Done(AliceEndState), Done(AliceEndState),
} }
#[derive(Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)] #[derive(Copy, Clone, strum::Display, Debug, Deserialize, Serialize, PartialEq)]
pub enum AliceEndState { pub enum AliceEndState {
SafelyAborted, SafelyAborted,
BtcRedeemed, BtcRedeemed,

View File

@ -4,6 +4,7 @@ use serde::{de::DeserializeOwned, Serialize};
use std::path::Path; use std::path::Path;
use uuid::Uuid; use uuid::Uuid;
#[derive(Debug)]
pub struct Database(sled::Db); pub struct Database(sled::Db);
impl Database { impl Database {