From 202c676c96b56e24120bf48ba2d6898b195cfec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20H=C3=A4ggblad?= Date: Mon, 9 Oct 2023 22:10:04 +0200 Subject: [PATCH] Fix rust-analyzer warnings Fix some warnings that rust-analyzer emits due to enabling all features. These are annoying when you try to list all warnings in the entire workspace. --- .../src/nyxd/contract_traits/mixnet_signing_client.rs | 8 ++++++++ sdk/rust/nym-sdk/examples/libp2p_ping/main.rs | 3 +-- sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/common/client-libs/validator-client/src/nyxd/contract_traits/mixnet_signing_client.rs b/common/client-libs/validator-client/src/nyxd/contract_traits/mixnet_signing_client.rs index f8b5521e0d3..4df59f304c1 100644 --- a/common/client-libs/validator-client/src/nyxd/contract_traits/mixnet_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/contract_traits/mixnet_signing_client.rs @@ -932,6 +932,14 @@ mod tests { MixnetExecuteMsg::TestingResolveAllPendingEvents {} => { client.testing_resolve_all_pending_events(None).ignore() } + + // We add this entry purely to try to make rust-analyzer happy + #[cfg(not(feature = "nym_mixnet_contract_common/contract-testing"))] + _ => { + unimplemented!( + "testing functionality is only available in contract-testing feature" + ) + } }; } } diff --git a/sdk/rust/nym-sdk/examples/libp2p_ping/main.rs b/sdk/rust/nym-sdk/examples/libp2p_ping/main.rs index 24ea089c102..1a787afb1b7 100644 --- a/sdk/rust/nym-sdk/examples/libp2p_ping/main.rs +++ b/sdk/rust/nym-sdk/examples/libp2p_ping/main.rs @@ -45,7 +45,6 @@ use libp2p::ping::Success; use libp2p::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2p::{identity, ping, Multiaddr, PeerId}; use log::{debug, info, LevelFilter}; -use nym_sdk::mixnet::MixnetClient; use std::error::Error; use std::time::Duration; @@ -70,7 +69,7 @@ async fn main() -> Result<(), Box> { use libp2p::swarm::SwarmBuilder; use rust_libp2p_nym::transport::NymTransport; - let client = MixnetClient::connect_new().await.unwrap(); + let client = nym_sdk::mixnet::MixnetClient::connect_new().await.unwrap(); let transport = NymTransport::new(client, local_key.clone()).await?; SwarmBuilder::with_tokio_executor( diff --git a/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs b/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs index 88142cc37f7..79c3de5cbbf 100644 --- a/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs +++ b/sdk/rust/nym-sdk/examples/libp2p_shared/transport.rs @@ -80,6 +80,7 @@ pub struct NymTransport { impl NymTransport { /// New transport. + #[allow(unused)] pub async fn new(client: MixnetClient, keypair: Keypair) -> Result { Self::new_maybe_with_notify_inbound(client, keypair, None, None).await }