From 8d3dc405a5cabf4a2015ffc47c4dd1ef2b625f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Mon, 20 Mar 2023 14:32:01 +0000 Subject: [PATCH] clippy --- clients/client-core/src/config/mod.rs | 3 +++ clients/webassembly/src/client/config.rs | 15 +++++++++------ service-providers/network-requester/src/core.rs | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/clients/client-core/src/config/mod.rs b/clients/client-core/src/config/mod.rs index 0ed5220b92..9ea3ad3756 100644 --- a/clients/client-core/src/config/mod.rs +++ b/clients/client-core/src/config/mod.rs @@ -812,6 +812,9 @@ pub enum ExtendedPacketSize { Extended32, } +// it could be derived, sure, but I'd rather have an explicit implementation in case we had to change +// something manually at some point +#[allow(clippy::derivable_impls)] impl Default for DebugConfig { fn default() -> Self { DebugConfig { diff --git a/clients/webassembly/src/client/config.rs b/clients/webassembly/src/client/config.rs index a51381a97a..7547af2b66 100644 --- a/clients/webassembly/src/client/config.rs +++ b/clients/webassembly/src/client/config.rs @@ -3,6 +3,8 @@ // due to expansion of #[wasm_bindgen] macro on `Debug` Config struct #![allow(clippy::drop_non_drop)] +// another issue due to #[wasm_bindgen] and `Copy` trait +#![allow(clippy::drop_copy)] use client_core::config::{ Acknowledgements as ConfigAcknowledgements, CoverTraffic as ConfigCoverTraffic, @@ -54,7 +56,7 @@ impl Config { } #[wasm_bindgen] -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] pub struct Traffic { /// The parameter of Poisson distribution determining how long, on average, /// sent packet is going to be delayed at any given mix node. @@ -108,7 +110,7 @@ impl From for Traffic { } #[wasm_bindgen] -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] pub struct CoverTraffic { /// The parameter of Poisson distribution determining how long, on average, /// it is going to take for another loop cover traffic message to be sent. @@ -142,7 +144,7 @@ impl From for CoverTraffic { } #[wasm_bindgen] -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] pub struct GatewayConnection { /// How long we're willing to wait for a response to a message sent to the gateway, /// before giving up on it. @@ -169,7 +171,7 @@ impl From for GatewayConnection { } #[wasm_bindgen] -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] pub struct Acknowledgements { /// The parameter of Poisson distribution determining how long, on average, /// sent acknowledgement is going to be delayed at any given mix node. @@ -209,7 +211,7 @@ impl From for Acknowledgements { } #[wasm_bindgen] -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] pub struct Topology { /// The uniform delay every which clients are querying the directory server /// to try to obtain a compatible network topology to send sphinx packets through. @@ -242,7 +244,7 @@ impl From for Topology { } #[wasm_bindgen] -#[derive(Copy, Clone)] +#[derive(Debug, Copy, Clone)] pub struct ReplySurbs { /// Defines the minimum number of reply surbs the client wants to keep in its storage at all times. /// It can only allow to go below that value if its to request additional reply surbs. @@ -321,6 +323,7 @@ impl From for ReplySurbs { // just a helper structure to more easily pass through the JS boundary #[wasm_bindgen] +#[derive(Debug, Copy, Clone)] pub struct Debug { /// Defines all configuration options related to traffic streams. pub traffic: Traffic, diff --git a/service-providers/network-requester/src/core.rs b/service-providers/network-requester/src/core.rs index 2ce61e6c62..cbe557018b 100644 --- a/service-providers/network-requester/src/core.rs +++ b/service-providers/network-requester/src/core.rs @@ -460,7 +460,7 @@ async fn create_mixnet_client( config: &client_core::config::Config, ) -> Result { let nym_api_endpoints = config.get_nym_api_endpoints(); - let debug_config = config.get_debug_config().clone(); + let debug_config = *config.get_debug_config(); let mixnet_config = nym_sdk::mixnet::Config { user_chosen_gateway: None,