From b854b7407c8bd90496e03d8573a976071ea8916c Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Tue, 21 Oct 2025 16:19:07 +1100 Subject: [PATCH] chore: fix clippy warnings in eBPF code (#10660) This code appears to be configured out in CI and thus we don't run clippy there. My IDE pointed these out however so it seems fair enough to fix them. It is just unnecessary references, doesn't actually have an impact on the functionality. --- .../src/try_handle_turn/routing.rs | 16 ++++++++-------- .../src/try_handle_turn/stats.rs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rust/relay/ebpf-turn-router/src/try_handle_turn/routing.rs b/rust/relay/ebpf-turn-router/src/try_handle_turn/routing.rs index e49699600..175cb1368 100644 --- a/rust/relay/ebpf-turn-router/src/try_handle_turn/routing.rs +++ b/rust/relay/ebpf-turn-router/src/try_handle_turn/routing.rs @@ -65,10 +65,10 @@ pub fn get_port_and_peer(key: impl Into) -> Result) -> Result { match key.into() { - PortAndPeer::V4(pp) => unsafe { UDP_TO_CHAN_44.get(&pp) } + PortAndPeer::V4(pp) => unsafe { UDP_TO_CHAN_44.get(pp) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Udp4ToChan)), - PortAndPeer::V6(pp) => unsafe { UDP_TO_CHAN_64.get(&pp) } + PortAndPeer::V6(pp) => unsafe { UDP_TO_CHAN_64.get(pp) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Udp6ToChan)), } @@ -77,10 +77,10 @@ fn get_client_and_channel_v4(key: impl Into) -> Result) -> Result { match key.into() { - PortAndPeer::V4(pp) => unsafe { UDP_TO_CHAN_46.get(&pp) } + PortAndPeer::V4(pp) => unsafe { UDP_TO_CHAN_46.get(pp) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Udp4ToChan)), - PortAndPeer::V6(pp) => unsafe { UDP_TO_CHAN_66.get(&pp) } + PortAndPeer::V6(pp) => unsafe { UDP_TO_CHAN_66.get(pp) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Udp6ToChan)), } @@ -89,10 +89,10 @@ fn get_client_and_channel_v6(key: impl Into) -> Result) -> Result { match key.into() { - ClientAndChannel::V4(pp) => unsafe { CHAN_TO_UDP_44.get(&pp) } + ClientAndChannel::V4(cc) => unsafe { CHAN_TO_UDP_44.get(cc) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Chan4ToUdp)), - ClientAndChannel::V6(pp) => unsafe { CHAN_TO_UDP_64.get(&pp) } + ClientAndChannel::V6(cc) => unsafe { CHAN_TO_UDP_64.get(cc) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Chan6ToUdp)), } @@ -101,10 +101,10 @@ fn get_port_and_peer_v4(key: impl Into) -> Result) -> Result { match key.into() { - ClientAndChannel::V4(pp) => unsafe { CHAN_TO_UDP_46.get(&pp) } + ClientAndChannel::V4(cc) => unsafe { CHAN_TO_UDP_46.get(cc) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Chan4ToUdp)), - ClientAndChannel::V6(pp) => unsafe { CHAN_TO_UDP_66.get(&pp) } + ClientAndChannel::V6(cc) => unsafe { CHAN_TO_UDP_66.get(cc) } .copied() .ok_or(Error::NoEntry(SupportedChannel::Chan6ToUdp)), } diff --git a/rust/relay/ebpf-turn-router/src/try_handle_turn/stats.rs b/rust/relay/ebpf-turn-router/src/try_handle_turn/stats.rs index 90cd7ad76..f5bac5108 100644 --- a/rust/relay/ebpf-turn-router/src/try_handle_turn/stats.rs +++ b/rust/relay/ebpf-turn-router/src/try_handle_turn/stats.rs @@ -7,7 +7,7 @@ static STATS: PerfEventArray = PerfEventArray::new(0); pub fn emit_data_relayed(ctx: &XdpContext, bytes: impl Into) { STATS.output( ctx, - &StatsEvent { + StatsEvent { relayed_data: bytes.into(), }, 0,