diff --git a/common/client-core/src/client/topology_control/accessor.rs b/common/client-core/src/client/topology_control/accessor.rs index 5c08a6a9aef..9841127b524 100644 --- a/common/client-core/src/client/topology_control/accessor.rs +++ b/common/client-core/src/client/topology_control/accessor.rs @@ -126,7 +126,7 @@ impl TopologyAccessor { .map(|p| p.topology.clone()) } - pub async fn current_route_provider(&self) -> Option> { + pub async fn current_route_provider(&self) -> Option> { let provider = self.inner.topology.read().await; if provider.topology.is_empty() { None diff --git a/common/client-core/src/init/helpers.rs b/common/client-core/src/init/helpers.rs index 97c3be13b71..1ca4b681915 100644 --- a/common/client-core/src/init/helpers.rs +++ b/common/client-core/src/init/helpers.rs @@ -148,7 +148,7 @@ async fn connect(endpoint: &str) -> Result { JSWebsocket::new(endpoint).map_err(|_| ClientCoreError::GatewayJsConnectionFailure) } -async fn measure_latency(gateway: &G) -> Result, ClientCoreError> +async fn measure_latency(gateway: &G) -> Result, ClientCoreError> where G: ConnectableGateway, { diff --git a/common/commands/src/validator/mixnet/delegators/delegate_to_multiple_mixnodes.rs b/common/commands/src/validator/mixnet/delegators/delegate_to_multiple_mixnodes.rs index 70eb85e7cd0..79dc4347a02 100644 --- a/common/commands/src/validator/mixnet/delegators/delegate_to_multiple_mixnodes.rs +++ b/common/commands/src/validator/mixnet/delegators/delegate_to_multiple_mixnodes.rs @@ -241,7 +241,7 @@ pub async fn delegate_to_multiple_mixnodes(args: Args, client: SigningClient) { let node_id = row.node_id.clone().parse::().unwrap(); let coins: Vec = vec![]; undelegation_msgs.push((ExecuteMsg::Undelegate { node_id }, coins)); - undelegation_table.add_row(&[row.node_id.clone()]); + undelegation_table.add_row(std::slice::from_ref(&row.node_id)); if row.amount.amount > 0 { delegation_msgs diff --git a/common/cosmwasm-smart-contracts/contracts-common-testing/src/tester/mod.rs b/common/cosmwasm-smart-contracts/contracts-common-testing/src/tester/mod.rs index 2d041a09339..d6b88bafc52 100644 --- a/common/cosmwasm-smart-contracts/contracts-common-testing/src/tester/mod.rs +++ b/common/cosmwasm-smart-contracts/contracts-common-testing/src/tester/mod.rs @@ -188,7 +188,7 @@ impl ContractTesterBuilder { *self.app.api() } - pub fn querier(&self) -> QuerierWrapper { + pub fn querier(&self) -> QuerierWrapper<'_> { self.app.wrap() } } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/helpers.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/helpers.rs index 125359d9f5e..b5032e64be0 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/helpers.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/helpers.rs @@ -57,7 +57,7 @@ pub trait NodeBond { fn is_unbonding(&self) -> bool; - fn identity(&self) -> IdentityKeyRef; + fn identity(&self) -> IdentityKeyRef<'_>; fn original_pledge(&self) -> &Coin; @@ -125,7 +125,7 @@ impl NodeBond for MixNodeBond { self.is_unbonding } - fn identity(&self) -> IdentityKeyRef { + fn identity(&self) -> IdentityKeyRef<'_> { self.identity() } @@ -178,7 +178,7 @@ impl NodeBond for NymNodeBond { self.is_unbonding } - fn identity(&self) -> IdentityKeyRef { + fn identity(&self) -> IdentityKeyRef<'_> { self.identity() } diff --git a/common/cosmwasm-smart-contracts/mixnet-contract/src/nym_node.rs b/common/cosmwasm-smart-contracts/mixnet-contract/src/nym_node.rs index cecbd4392ff..6fc172db09e 100644 --- a/common/cosmwasm-smart-contracts/mixnet-contract/src/nym_node.rs +++ b/common/cosmwasm-smart-contracts/mixnet-contract/src/nym_node.rs @@ -58,7 +58,7 @@ impl<'a> PrimaryKey<'a> for Role { type Suffix = >::Suffix; type SuperSuffix = >::SuperSuffix; - fn key(&self) -> Vec { + fn key(&self) -> Vec> { // I'm not sure why it wasn't possible to delegate the call to // `(*self as u8).key()` directly... // I guess because of the `Key::Ref(&'a [u8])` variant? diff --git a/common/credential-storage/src/backends/sqlite.rs b/common/credential-storage/src/backends/sqlite.rs index 6ac45aec47c..8b0c5027a71 100644 --- a/common/credential-storage/src/backends/sqlite.rs +++ b/common/credential-storage/src/backends/sqlite.rs @@ -39,7 +39,7 @@ impl SqliteEcashTicketbookManager { Ok(()) } - pub(crate) async fn begin_storage_tx(&self) -> Result, sqlx::Error> { + pub(crate) async fn begin_storage_tx(&self) -> Result, sqlx::Error> { self.connection_pool.begin().await } diff --git a/common/credential-verification/src/ecash/mod.rs b/common/credential-verification/src/ecash/mod.rs index 107ac452997..5586ef5ab1e 100644 --- a/common/credential-verification/src/ecash/mod.rs +++ b/common/credential-verification/src/ecash/mod.rs @@ -39,7 +39,7 @@ impl traits::EcashManager for EcashManager { async fn verification_key( &self, epoch_id: EpochId, - ) -> Result, EcashTicketError> { + ) -> Result, EcashTicketError> { self.shared_state.verification_key(epoch_id).await } @@ -231,7 +231,7 @@ impl traits::EcashManager for MockEcashManager { async fn verification_key( &self, _epoch_id: EpochId, - ) -> Result, EcashTicketError> { + ) -> Result, EcashTicketError> { Ok(self.verfication_key.read().await) } diff --git a/common/credential-verification/src/ecash/state.rs b/common/credential-verification/src/ecash/state.rs index c16db2111fa..85ada02f5c8 100644 --- a/common/credential-verification/src/ecash/state.rs +++ b/common/credential-verification/src/ecash/state.rs @@ -125,7 +125,7 @@ impl SharedState { async fn set_epoch_data( &self, epoch_id: EpochId, - ) -> Result>, EcashTicketError> { + ) -> Result>, EcashTicketError> { let Some(threshold) = self.threshold(epoch_id).await? else { return Err(EcashTicketError::DKGThresholdUnavailable { epoch_id }); }; @@ -186,7 +186,7 @@ impl SharedState { pub(crate) async fn api_clients( &self, epoch_id: EpochId, - ) -> Result>, EcashTicketError> { + ) -> Result>, EcashTicketError> { let guard = self.epoch_data.read().await; // the key was already in the map @@ -212,7 +212,7 @@ impl SharedState { pub(crate) async fn verification_key( &self, epoch_id: EpochId, - ) -> Result, EcashTicketError> { + ) -> Result, EcashTicketError> { let guard = self.epoch_data.read().await; // the key was already in the map @@ -235,11 +235,11 @@ impl SharedState { })) } - pub(crate) async fn start_tx(&self) -> RwLockWriteGuard { + pub(crate) async fn start_tx(&self) -> RwLockWriteGuard<'_, DirectSigningHttpRpcNyxdClient> { self.nyxd_client.write().await } - pub(crate) async fn start_query(&self) -> RwLockReadGuard { + pub(crate) async fn start_query(&self) -> RwLockReadGuard<'_, DirectSigningHttpRpcNyxdClient> { self.nyxd_client.read().await } diff --git a/common/credential-verification/src/ecash/traits.rs b/common/credential-verification/src/ecash/traits.rs index a7e81976812..ae25016f193 100644 --- a/common/credential-verification/src/ecash/traits.rs +++ b/common/credential-verification/src/ecash/traits.rs @@ -12,7 +12,7 @@ pub trait EcashManager { async fn verification_key( &self, epoch_id: EpochId, - ) -> Result, EcashTicketError>; + ) -> Result, EcashTicketError>; fn storage(&self) -> Box; async fn check_payment( &self, diff --git a/nym-api/src/ecash/comm.rs b/nym-api/src/ecash/comm.rs index ef5deceb836..4910522a48c 100644 --- a/nym-api/src/ecash/comm.rs +++ b/nym-api/src/ecash/comm.rs @@ -83,7 +83,7 @@ impl QueryCommunicationChannel { } } - async fn update_epoch_cache(&self) -> Result> { + async fn update_epoch_cache(&self) -> Result> { let mut guard = self.cached_epoch.write().await; let epoch = ecash::client::Client::get_current_epoch(&self.nyxd_client).await?; diff --git a/nym-api/src/ecash/helpers.rs b/nym-api/src/ecash/helpers.rs index 62b09553312..c636d47157b 100644 --- a/nym-api/src/ecash/helpers.rs +++ b/nym-api/src/ecash/helpers.rs @@ -100,7 +100,7 @@ where &self, key: K, f: F, - ) -> Result, EcashError> + ) -> Result, EcashError> where F: FnOnce() -> U, U: Future>, diff --git a/nym-api/src/ecash/keys/mod.rs b/nym-api/src/ecash/keys/mod.rs index bf315f8b1ab..e7e8bf94c64 100644 --- a/nym-api/src/ecash/keys/mod.rs +++ b/nym-api/src/ecash/keys/mod.rs @@ -65,13 +65,13 @@ impl KeyPair { } } - pub async fn keys(&self) -> Result, EcashError> { + pub async fn keys(&self) -> Result, EcashError> { let keypair_guard = self.get().await.ok_or(EcashError::KeyPairNotDerivedYet)?; RwLockReadGuard::try_map(keypair_guard, |keypair| keypair.as_ref()) .map_err(|_| EcashError::KeyPairNotDerivedYet) } - pub async fn signing_key(&self) -> Result, EcashError> { + pub async fn signing_key(&self) -> Result, EcashError> { let keypair_guard = self.get().await.ok_or(EcashError::KeyPairNotDerivedYet)?; RwLockReadGuard::try_map(keypair_guard, |keypair| { @@ -80,7 +80,7 @@ impl KeyPair { .map_err(|_| EcashError::KeyPairNotDerivedYet) } - pub async fn verification_key(&self) -> Option> { + pub async fn verification_key(&self) -> Option> { RwLockReadGuard::try_map(self.get().await?, |maybe_keys| { maybe_keys.as_ref().map(|k| k.keys.verification_key_ref()) }) diff --git a/nym-api/src/ecash/state/mod.rs b/nym-api/src/ecash/state/mod.rs index 644a4b32fac..ce83e701df6 100644 --- a/nym-api/src/ecash/state/mod.rs +++ b/nym-api/src/ecash/state/mod.rs @@ -198,21 +198,21 @@ impl EcashState { Ok(()) } - pub(crate) async fn ecash_signing_key(&self) -> Result> { + pub(crate) async fn ecash_signing_key(&self) -> Result> { self.local.ecash_keypair.signing_key().await } #[allow(dead_code)] pub(crate) async fn current_master_verification_key( &self, - ) -> Result> { + ) -> Result> { self.master_verification_key(None).await } pub(crate) async fn master_verification_key( &self, epoch_id: Option, - ) -> Result> { + ) -> Result> { let epoch_id = match epoch_id { Some(id) => id, None => self.aux.current_epoch().await?, @@ -258,7 +258,7 @@ impl EcashState { pub(crate) async fn master_coin_index_signatures( &self, epoch_id: Option, - ) -> Result> { + ) -> Result> { let epoch_id = match epoch_id { Some(id) => id, None => self.aux.current_epoch().await?, @@ -344,7 +344,7 @@ impl EcashState { pub(crate) async fn partial_coin_index_signatures( &self, epoch_id: Option, - ) -> Result> { + ) -> Result> { let epoch_id = match epoch_id { Some(id) => id, None => self.aux.current_epoch().await?, @@ -401,7 +401,7 @@ impl EcashState { pub(crate) async fn master_expiration_date_signatures( &self, expiration_date: Date, - ) -> Result> { + ) -> Result> { self.global .expiration_date_signatures .get_or_init(expiration_date, || async { @@ -480,7 +480,7 @@ impl EcashState { pub(crate) async fn partial_expiration_date_signatures( &self, expiration_date: Date, - ) -> Result> { + ) -> Result> { self.local .partial_expiration_date_signatures .get_or_init(expiration_date, || async { @@ -721,7 +721,7 @@ impl EcashState { async fn get_updated_merkle_read( &self, expiration_date: Date, - ) -> Result> { + ) -> Result> { let write_guard = self.get_updated_full_write(expiration_date).await?; // SAFETY: the entry was either not empty or we just inserted data in there, whilst never dropping the lock @@ -735,7 +735,7 @@ impl EcashState { async fn get_updated_full_write( &self, expiration_date: Date, - ) -> Result>> { + ) -> Result>> { let mut write_guard = self.local.issued_merkle_trees.write().await; // double check if it's still empty in case another task has already grabbed the write lock and performed the update diff --git a/nym-api/src/epoch_operations/helpers.rs b/nym-api/src/epoch_operations/helpers.rs index f28021058c2..098afd44e48 100644 --- a/nym-api/src/epoch_operations/helpers.rs +++ b/nym-api/src/epoch_operations/helpers.rs @@ -75,7 +75,7 @@ pub(super) fn stake_to_f64(stake: Decimal) -> f64 { impl EpochAdvancer { fn load_performance( - status_cache: &Option>>>, + status_cache: &Option>>>, node_id: NodeId, ) -> NodeWithPerformance { let Some(status_cache) = status_cache.as_ref() else { diff --git a/nym-api/src/mixnet_contract_cache/cache/mod.rs b/nym-api/src/mixnet_contract_cache/cache/mod.rs index 39915845e8a..9279c989ecf 100644 --- a/nym-api/src/mixnet_contract_cache/cache/mod.rs +++ b/nym-api/src/mixnet_contract_cache/cache/mod.rs @@ -66,7 +66,7 @@ impl MixnetContractCache { pub async fn all_cached_legacy_mixnodes( &self, - ) -> Option>> { + ) -> Option>> { self.get(|c| &c.legacy_mixnodes).await.ok() } @@ -84,11 +84,11 @@ impl MixnetContractCache { pub async fn all_cached_legacy_gateways( &self, - ) -> Option>> { + ) -> Option>> { self.get(|c| &c.legacy_gateways).await.ok() } - pub async fn all_cached_nym_nodes(&self) -> Option>> { + pub async fn all_cached_nym_nodes(&self) -> Option>> { self.get(|c| &c.nym_nodes).await.ok() } @@ -125,7 +125,7 @@ impl MixnetContractCache { Ok(Cache::as_mapped(&cache, |c| c.rewarded_set.clone())) } - pub async fn rewarded_set(&self) -> Option> { + pub async fn rewarded_set(&self) -> Option> { self.get(|c| &c.rewarded_set).await.ok() } diff --git a/nym-api/src/node_status_api/cache/mod.rs b/nym-api/src/node_status_api/cache/mod.rs index 73aca9c848a..8791341b7a2 100644 --- a/nym-api/src/node_status_api/cache/mod.rs +++ b/nym-api/src/node_status_api/cache/mod.rs @@ -112,7 +112,7 @@ impl NodeStatusCache { pub(crate) async fn node_annotations( &self, - ) -> Option>>> { + ) -> Option>>> { self.get(|c| &c.node_annotations).await } @@ -127,7 +127,7 @@ impl NodeStatusCache { pub(crate) async fn annotated_legacy_mixnodes( &self, - ) -> Option>>> { + ) -> Option>>> { self.get(|c| &c.mixnodes_annotated).await } @@ -150,7 +150,7 @@ impl NodeStatusCache { pub(crate) async fn annotated_legacy_gateways( &self, - ) -> Option>>> { + ) -> Option>>> { self.get(|c| &c.gateways_annotated).await } diff --git a/nym-api/src/node_status_api/helpers.rs b/nym-api/src/node_status_api/helpers.rs index 91076e5963f..e4d6257acea 100644 --- a/nym-api/src/node_status_api/helpers.rs +++ b/nym-api/src/node_status_api/helpers.rs @@ -8,31 +8,13 @@ use crate::{MixnetContractCache, NodeStatusCache}; use nym_api_requests::models::{ ComputeRewardEstParam, GatewayBondAnnotated, GatewayCoreStatusResponse, GatewayStatusReportResponse, GatewayUptimeHistoryResponse, GatewayUptimeResponse, - MixNodeBondAnnotated, MixnodeCoreStatusResponse, MixnodeStatus, MixnodeStatusReportResponse, + MixNodeBondAnnotated, MixnodeCoreStatusResponse, MixnodeStatusReportResponse, MixnodeStatusResponse, MixnodeUptimeHistoryResponse, RewardEstimationResponse, StakeSaturationResponse, UptimeResponse, }; use nym_mixnet_contract_common::rewarding::RewardEstimate; use nym_mixnet_contract_common::NodeId; -pub(crate) enum RewardedSetStatus { - Active, - Standby, - Inactive, -} - -impl From for RewardedSetStatus { - fn from(value: MixnodeStatus) -> Self { - match value { - MixnodeStatus::Active => RewardedSetStatus::Active, - MixnodeStatus::Standby => RewardedSetStatus::Standby, - // for all intents and purposes, missing node is treated as inactive for rewarding (since it wouldn't get anything - MixnodeStatus::Inactive => RewardedSetStatus::Inactive, - MixnodeStatus::NotFound => RewardedSetStatus::Inactive, - } - } -} - async fn gateway_identity_to_node_id( cache: &NodeStatusCache, identity: &str, diff --git a/nym-api/src/support/http/state/mod.rs b/nym-api/src/support/http/state/mod.rs index 7a9bb8abb94..bad1b7f4ed2 100644 --- a/nym-api/src/support/http/state/mod.rs +++ b/nym-api/src/support/http/state/mod.rs @@ -148,7 +148,7 @@ impl AppState { impl AppState { pub(crate) async fn describe_nodes_cache_data( &self, - ) -> Result>, AxumErrorResponse> { + ) -> Result>, AxumErrorResponse> { Ok(self.described_nodes_cache().get().await?) } @@ -160,7 +160,8 @@ impl AppState { pub(crate) async fn node_annotations( &self, - ) -> Result>>, AxumErrorResponse> { + ) -> Result>>, AxumErrorResponse> + { self.node_status_cache() .node_annotations() .await @@ -169,7 +170,7 @@ impl AppState { pub(crate) async fn legacy_mixnode_annotations( &self, - ) -> Result>>, AxumErrorResponse> + ) -> Result>>, AxumErrorResponse> { self.node_status_cache() .annotated_legacy_mixnodes() @@ -179,7 +180,7 @@ impl AppState { pub(crate) async fn legacy_gateways_annotations( &self, - ) -> Result>>, AxumErrorResponse> + ) -> Result>>, AxumErrorResponse> { self.node_status_cache() .annotated_legacy_gateways() diff --git a/nym-credential-proxy/nym-credential-proxy/src/http/state/mod.rs b/nym-credential-proxy/nym-credential-proxy/src/http/state/mod.rs index 392fa719925..2fda74436e1 100644 --- a/nym-credential-proxy/nym-credential-proxy/src/http/state/mod.rs +++ b/nym-credential-proxy/nym-credential-proxy/src/http/state/mod.rs @@ -143,7 +143,7 @@ impl ApiState { availability: finish_dt, }) } else if epoch.state.is_waiting_initialisation() { - return Err(VpnApiError::UninitialisedDkg); + Err(VpnApiError::UninitialisedDkg) } else { Err(VpnApiError::UnknownEcashFailure) } @@ -203,7 +203,7 @@ impl ApiState { Ok(epoch.epoch_id) } - pub(crate) async fn query_chain(&self) -> RwLockReadGuard { + pub(crate) async fn query_chain(&self) -> RwLockReadGuard<'_, DirectSigningHttpRpcNyxdClient> { self.inner.client.query_chain().await } @@ -336,7 +336,7 @@ impl ApiState { pub(crate) async fn ecash_clients( &self, epoch_id: EpochId, - ) -> Result>, VpnApiError> { + ) -> Result>, VpnApiError> { self.inner .ecash_state .epoch_clients @@ -386,7 +386,7 @@ impl ApiState { pub(crate) async fn master_verification_key( &self, epoch_id: Option, - ) -> Result, VpnApiError> { + ) -> Result, VpnApiError> { let epoch_id = match epoch_id { Some(id) => id, None => self.current_epoch_id().await?, @@ -440,7 +440,7 @@ impl ApiState { pub(crate) async fn master_coin_index_signatures( &self, epoch_id: Option, - ) -> Result, VpnApiError> { + ) -> Result, VpnApiError> { let epoch_id = match epoch_id { Some(id) => id, None => self.current_epoch_id().await?, @@ -516,7 +516,7 @@ impl ApiState { pub(crate) async fn master_expiration_date_signatures( &self, expiration_date: Date, - ) -> Result, VpnApiError> { + ) -> Result, VpnApiError> { self.inner .ecash_state .expiration_date_signatures @@ -619,12 +619,12 @@ impl ChainClient { Ok(ChainClient(Arc::new(RwLock::new(client)))) } - pub(crate) async fn query_chain(&self) -> ChainReadPermit { + pub(crate) async fn query_chain(&self) -> ChainReadPermit<'_> { let _acquire_timer = LockTimer::new("acquire chain query permit"); self.0.read().await } - pub(crate) async fn start_chain_tx(&self) -> ChainWritePermit { + pub(crate) async fn start_chain_tx(&self) -> ChainWritePermit<'_> { let _acquire_timer = LockTimer::new("acquire exclusive chain write permit"); ChainWritePermit { diff --git a/nym-credential-proxy/nym-credential-proxy/src/nym_api_helpers.rs b/nym-credential-proxy/nym-credential-proxy/src/nym_api_helpers.rs index 3268ddb50c4..72d0e2a4675 100644 --- a/nym-credential-proxy/nym-credential-proxy/src/nym_api_helpers.rs +++ b/nym-credential-proxy/nym-credential-proxy/src/nym_api_helpers.rs @@ -86,7 +86,11 @@ impl CachedImmutableItems where K: Eq + Hash, { - pub(crate) async fn get_or_init(&self, key: K, f: F) -> Result, E> + pub(crate) async fn get_or_init( + &self, + key: K, + f: F, + ) -> Result, E> where F: FnOnce() -> U, U: Future>, diff --git a/nym-node/nym-node-metrics/src/entry.rs b/nym-node/nym-node-metrics/src/entry.rs index 59200b5991f..d236270b70e 100644 --- a/nym-node/nym-node-metrics/src/entry.rs +++ b/nym-node/nym-node-metrics/src/entry.rs @@ -16,7 +16,7 @@ impl EntryStats { *self.sessions.write().await = new } - pub async fn client_sessions(&self) -> RwLockReadGuard { + pub async fn client_sessions(&self) -> RwLockReadGuard<'_, ClientSessions> { self.sessions.read().await } } diff --git a/sdk/rust/nym-sdk/src/mixnet/native_client.rs b/sdk/rust/nym-sdk/src/mixnet/native_client.rs index fb940c5b4dd..7c8089d3243 100644 --- a/sdk/rust/nym-sdk/src/mixnet/native_client.rs +++ b/sdk/rust/nym-sdk/src/mixnet/native_client.rs @@ -181,7 +181,9 @@ impl MixnetClient { } /// Gets the value of the currently used network topology. - pub async fn read_current_route_provider(&self) -> Option> { + pub async fn read_current_route_provider( + &self, + ) -> Option> { self.client_state .topology_accessor .current_route_provider() diff --git a/sdk/rust/nym-sdk/src/tcp_proxy/utils.rs b/sdk/rust/nym-sdk/src/tcp_proxy/utils.rs index 1de4318ed6c..1e8085aa835 100644 --- a/sdk/rust/nym-sdk/src/tcp_proxy/utils.rs +++ b/sdk/rust/nym-sdk/src/tcp_proxy/utils.rs @@ -47,7 +47,7 @@ impl MessageBuffer { self.buffer.is_empty() } - pub fn iter(&self) -> std::slice::Iter> { + pub fn iter(&self) -> std::slice::Iter<'_, DecayWrapper> { self.buffer.iter() } diff --git a/service-providers/ip-packet-router/src/non_linux_dummy.rs b/service-providers/ip-packet-router/src/non_linux_dummy.rs index abac0ad1d3e..9197ae4cd1d 100644 --- a/service-providers/ip-packet-router/src/non_linux_dummy.rs +++ b/service-providers/ip-packet-router/src/non_linux_dummy.rs @@ -6,6 +6,7 @@ use std::pin::Pin; use std::task::{Context, Poll}; use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; +#[allow(dead_code)] pub(crate) struct DummyDevice; impl AsyncRead for DummyDevice { diff --git a/service-providers/ip-packet-router/src/util/parse_ip.rs b/service-providers/ip-packet-router/src/util/parse_ip.rs index 6b99a2ba898..0b9972b3f2e 100644 --- a/service-providers/ip-packet-router/src/util/parse_ip.rs +++ b/service-providers/ip-packet-router/src/util/parse_ip.rs @@ -9,7 +9,7 @@ pub(crate) struct ParsedPacket<'a> { pub(crate) dst: Option, } -pub(crate) fn parse_packet(packet: &[u8]) -> Result { +pub(crate) fn parse_packet(packet: &[u8]) -> Result, IpPacketRouterError> { let headers = etherparse::SlicedPacket::from_ip(packet).map_err(|err| { log::warn!("Unable to parse incoming data as IP packet: {err}"); IpPacketRouterError::PacketParseFailed { source: err }