diff --git a/src/control/firewall_state.rs b/src/control/firewall_state.rs index 10f7c3d..1bf8d71 100644 --- a/src/control/firewall_state.rs +++ b/src/control/firewall_state.rs @@ -31,6 +31,8 @@ //! and the ICMPv6-echo-request accept are not classified — they //! don't pertain to listening TCP/UDP ports the operator binds. +#![cfg_attr(not(target_os = "linux"), allow(dead_code))] + use serde_json::Value; use crate::control::listening::Proto; diff --git a/src/transport/ethernet/socket_macos.rs b/src/transport/ethernet/socket_macos.rs index 4f24fdc..b31eaf5 100644 --- a/src/transport/ethernet/socket_macos.rs +++ b/src/transport/ethernet/socket_macos.rs @@ -534,8 +534,8 @@ fn get_mac_addr(interface: &str) -> Result<[u8; 6], TransportError> { // MAC address starts after the interface name in sdl_data let data_ptr = sdl.sdl_data.as_ptr(); let mut mac = [0u8; 6]; - for i in 0..6 { - mac[i] = unsafe { *data_ptr.add(nlen + i) } as u8; + for (i, byte) in mac.iter_mut().enumerate() { + *byte = unsafe { *data_ptr.add(nlen + i) } as u8; } return Ok(mac); } @@ -565,6 +565,7 @@ fn get_mac_addr(interface: &str) -> Result<[u8; 6], TransportError> { #[cfg(test)] #[cfg(target_os = "macos")] +#[allow(clippy::items_after_test_module)] mod tests { use super::*; diff --git a/src/upper/tun.rs b/src/upper/tun.rs index 0d01dcb..e9dddd6 100644 --- a/src/upper/tun.rs +++ b/src/upper/tun.rs @@ -389,6 +389,7 @@ fn utun_af_inet6_header() -> [u8; 4] { /// from the dup'd fd directly. #[cfg(target_os = "macos")] #[inline] +#[allow(dead_code)] fn parse_utun_af_prefix(buf: &[u8]) -> Option { if buf.len() < 4 { return None; @@ -565,6 +566,7 @@ impl Drop for ShutdownFd { /// avoiding the need to close the TUN fd externally (which would cause a /// double-close when `TunDevice` drops). #[cfg(target_os = "macos")] +#[allow(clippy::too_many_arguments)] pub fn run_tun_reader( mut device: TunDevice, mtu: u16,